Author Topic: Buycar Scriptin Sasan  (Read 31216 times)

0 Members and 2 Guests are viewing this topic.

Offline TanaX01

  • Made Man
  • ***
  • Posts: 214
  • BlackList! <3
    • View Profile
Buycar Scriptin Sasan
« on: July 22, 2008, 11:34:40 pm »
Commands Car, Buycar, Sellcar, Mycars, Sharecar, Delsharecar  ;)

Command !Car:
Code: [Select]
    elseif ($2 == !car) {
      var %p = $iif($3,$v1,%id)
      if ( $vcmp.hgetcarid(%id) = 0 ) {
        vcmp.adminmsg %id You are Currently on Foot
        !halt
    }
      elseif ($vcmp.nameid(%p) != $null) vcmp.adminmsg %id Vehicle Status: Model:[ $vcmp.carsnames($vcmp.hgetcarid(%id)) ] ID:[ $vcmp.carsids($vcmp.hgetcarid(%id)) ]  Hp:[ $vcmp.hgetcarhp(%id) ]
      vcmp.adminmsg %id Owner:[ $vcmp.carsowners($vcmp.hgetcarid(%id)) ] Price:[ $ $+  $vcmp.carsprices($vcmp.hgetcarid(%id)) ] Share:[ $vcmp.carsshares($vcmp.hgetcarid(%id)) ]
      else vcmp.adminmsg %id Error: Invalid ID.
    }

Command !Mycars:
Code: [Select]
    elseif ($2 == !mycars) {
      var %a = 0,%b = 0,%c = 0,%d
      while (%a < $ini(vcmp.cars.ini,OWNERS,0)) {
        %b = $readini(vcmp.cars.ini,OWNERS,$ini(vcmp.cars.ini,OWNERS,%a))
        %c = %b
        %d = $ini(vcmp.cars.ini,OWNERS,%a)
        !inc %a
        if (%c == $vcmp.hgetname(%id)) vcmp.adminmsg %id Mycars:[ $vcmp.carsnames(%d) ( %d ) ]
      }
    }

Command !Buycar:
Code: [Select]
   
    elseif ($2 == !buycar) {
      if ( $vcmp.hgetcarid(%id) = 0 ) {
        vcmp.adminmsg %id You are Currently on Foot
        !halt
      }
      if (Sunshine-Autos-Viceport-Vice-City-Mainland !isin $vcmp.playerarea(%id)) {
        vcmp.adminmsg %id Error - You Must Be in Sunshine-Autos To Buy a Car!
        !halt
      }
      elseif ( $vcmp.carsowners($vcmp.hgetcarid(%id)) != Sunshine-Autos ) {
        vcmp.adminmsg %id Error - This Vehicle is already Owned.
        !halt
      }
      elseif ($hget(mycars, $vcmp.hgetname(%id)) >= 2) vcmp.adminmsg %id Error, you have reached your car limit.

      elseif ( $vcmp.carsprices($vcmp.hgetcarid(%id)) > $vcmp.hgetmoney(%id)) {
        vcmp.adminmsg %id Error - You need atleast $ $+ $vcmp.carsprices($vcmp.hgetcarid(%id)) to buy this vehicle.
        !halt
      }
      else {
        !writeini vcmp.cars.ini OWNERS $vcmp.hgetcarid(%id) $vcmp.hgetname(%id)
        vcmp.adminmsg %id Bought Car!
        var %cars = $hget(myCars, $vcmp.hgetname(%id))
        !hadd -m myCars $vcmp.hgetname(%id) $calc(%cars +1)
        vcmp.setmon %id $calc($vcmp.hgetmoney(%id) - $vcmp.carsprices($vcmp.hgetcarid(%id)))
      }
    }

Commands !Sellcar:
Code: [Select]
    elseif ($2 == !sellcar) {
      var %money = $calc($vcmp.carsprices($vcmp.hgetcarid(%id)) /2 )
      var %cars = $hget(mycars, $vcmp.hgetname(%id))
      if ( $vcmp.hgetcarid(%id) = 0 ) {
        vcmp.adminmsg %id You are Currently on Foot
        !halt
      }
      if (Sunshine-Autos-Viceport-Vice-City-Mainland !isin $vcmp.playerarea(%id)) {
        vcmp.adminmsg %id Error - You Must Be in Sunshine-Autos To Sell a Car!
        !halt
      }
      elseif ( $vcmp.carsowners($vcmp.hgetcarid(%id)) != $vcmp.hgetname(%id) ) {
        vcmp.adminmsg %id Error - This is not your Vehicle.
        !halt
      }
      else {
        !writeini vcmp.cars.ini OWNERS $vcmp.hgetcarid(%id) Sunshine-Autos
        !hadd -m mycars $vcmp.hgetname(%id) $calc(%cars -1)
        if ($hget(mycars, $vcmp.hgetname(%id)) == 0 ) !hdel mycars $vcmp.hgetname(%id)
        vcmp.adminmsg %id Sold Car!
        vcmp.setmon %id $calc($vcmp.hgetmoney(%id) + %money)
      }
    }

Command !Getcar:

Code: [Select]
    elseif ($2 == !getcar) {
      if ($vcmp.hgetcarid(%id) != 0) vcmp.adminmsg %id You must be on foot to use the <!Getcar> Command.
      elseif (!$3) vcmp.adminmsg %id Error - Missing Information, $2 <ID>
      elseif ($3 !isnum) vcmp.adminmsg %id $2 $+ , Invalid Vehicle ID.
      elseif (. isin $3) vcmp.adminmsg %id $2 $+ , Invalid Vehicle ID.
      elseif ($3 > 140) || ($3 < 0) vcmp.adminmsg %id Error: Invalid Vehicle ID.
      elseif (+ isin $3) || (- isin $3) vcmp.adminmsg %id $2 $+ , Invalid Vehicle ID.
      elseif ( $vcmp.carsowners($3) != $vcmp.hgetname(%id)) vcmp.adminmsg %id Error - You Dont have Keys To this Vehicle.
      else {
        vcmp.setcarloc $3 $calc($vcmp.hgetpos.x(%id) + 2) $calc($vcmp.hgetpos.y(%id) + 2) $calc($vcmp.hgetpos.z(%id) - 1) 
        vcmp.adminmsg %id Spawning Car:[ $3 $+ ]
      }
      if ($vcmp.hgetcarid(%id) != 0) vcmp.adminmsg %id You must be on foot to use the <!Getcar> Command.
      elseif (!$3) vcmp.adminmsg %id Error - Missing Information, $2 <ID>
      elseif ($3 !isnum) vcmp.adminmsg %id $2 $+ , Invalid Vehicle ID.
      elseif (. isin $3) vcmp.adminmsg %id $2 $+ , Invalid Vehicle ID.
      elseif ($3 > 140) || ($3 < 0) vcmp.adminmsg %id Error: Invalid Vehicle ID.
      elseif (+ isin $3) || (- isin $3) vcmp.adminmsg %id $2 $+ , Invalid Vehicle ID.
      elseif ( $vcmp.carsshares($3) != $vcmp.hgetname(%id)) vcmp.adminmsg %id Error - You Dont have Keys To this Vehicle.
      else {
        vcmp.setcarloc $3 $calc($vcmp.hgetpos.x(%id) + 2) $calc($vcmp.hgetpos.y(%id) + 2) $calc($vcmp.hgetpos.z(%id) - 1) 
        vcmp.adminmsg %id Spawning Car:[ $3 $+ ]
      }
    }

Command !Sharecar:
Code: [Select]
    elseif ($2 == !sharedcars) {
      var %a = 0,%b = 0,%c = 0,%d
      while (%a < $ini(vcmp.cars.ini,SHARE,0)) {
        %b = $readini(vcmp.cars.ini,SHARE,$ini(vcmp.cars.ini,SHARE,%a))
        %c = %b
        %d = $ini(vcmp.cars.ini,SHARE,%a)
        !inc %a
        if (%c == $vcmp.hgetname(%id)) vcmp.adminmsg %id Sharedcars:[ $vcmp.carsnames(%d) ( %d ) ]
      }
    }
    elseif ($2 == !sharecar) {
      if ( $vcmp.hgetcarid(%id) = 0 ) {
        vcmp.adminmsg %id You are Currently on Foot
        !halt
      }
      elseif ( $vcmp.carsshares($vcmp.hgetcarid(%id)) != None ) {
        vcmp.adminmsg %id Error - This Vehicle is Already Shared.
        !halt
      }
      elseif ( $vcmp.carsowners($vcmp.hgetcarid(%id)) != $vcmp.hgetname(%id) ) {
        vcmp.adminmsg %id Error - This is not your Vehicle.
        !halt
      }
      else {
        !writeini vcmp.cars.ini SHARE $vcmp.hgetcarid(%id) $vcmp.hgetname($vcmp.nameid($3))
        vcmp.adminmsg %id Shared Car!
      }
    }

Command !DelSharecar:
Code: [Select]
    elseif ($2 == !delsharecar) {
      if ( $vcmp.hgetcarid(%id) = 0 ) {
        vcmp.adminmsg %id You are Currently on Foot
        !halt
      }
      elseif ( $vcmp.carsowners($vcmp.hgetcarid(%id)) != $vcmp.hgetname(%id) ) {
        vcmp.adminmsg %id Error - This is not your Vehicle.
        !halt
      }
      else {
        !writeini vcmp.cars.ini SHARE $vcmp.hgetcarid(%id) $vcmp.hgetname($vcmp.nameid($3)) None
        vcmp.adminmsg %id Deleted Share Car!
      }
    }

Please Create New File In Script Name:

1.- vcmp.owners in vcmp.owner:
Code: [Select]
[OWNERS]
13=Sunshine Autos
10=Sunshine Autos
145=Sunshine Autos
148=Sunhine Autos
146=Sunshine Autos
45=Sunshine Autos
25=Sunshine Autos
2=Sunshine Autos
149=Sunshine Autos
126=Sunshine Autos
110=Sunshine Autos
97=Sunshine=Autos
52=Sunshine Autos
27=Sunshine Autos
151=Sunshine Autos
44=Sunshine Autos
100=Sunshine Autos
101=Sunshine Autos
15=Sunshine Autos
73=Sunshine Autos
152=Sunshine Autos

2.- New File Name: vcmp.myCars

3.- New File Name: vcmp.cars in vcmp.cars

Code: [Select]
[PRICES]
1=75000
2=75000
3=75000
4=75000
5=75000
6=75000
7=75000
8=75000
9=1500000
10=300000
11=1200000
12= etc etc
[ID] ( is id you cars )
1=1
2=2
3=3
4=4
5=5
6=6
7=7
8=8
9=9
10=10
11=11
[OWNERS] ( owner id 1= etc is empy no modific )
1=
2=
3=
4=
5=
6=
7=
8=
9=
10=
11=
12=
[NAMES] ( and all name car's )
1=Washington
2=Angel
3=Angel
4=Angel
5=Angel

 ;)

Please no more fight  >:(
« Last Edit: July 24, 2008, 11:39:36 pm by TanaX01 »

Offline Nemesis2500

  • Wiseguy
  • **
  • Posts: 63
  • The Joker
    • View Profile
    • Grand VCMP Server
Re: Buycar Scriptin Sasan
« Reply #1 on: July 22, 2008, 11:36:41 pm »
rofl  :-X  ;)


Offline K.I.S.S

  • Street Thug
  • *
  • Posts: 16
    • View Profile
Re: Buycar Scriptin Sasan
« Reply #2 on: July 22, 2008, 11:49:43 pm »
good work friend.

Offline TanaX01

  • Made Man
  • ***
  • Posts: 214
  • BlackList! <3
    • View Profile
Re: Buycar Scriptin Sasan
« Reply #3 on: July 23, 2008, 12:06:56 am »

Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Re: Buycar Scriptin Sasan
« Reply #4 on: July 23, 2008, 03:31:44 am »
I puted 3 files into my mirc folder:
vcmp.cars.ini , vcmp.myCars.ini , vcmp.owners.ini

vcmp.owners.ini:
[OWNERS]
108=Sunshine Autos

vcmp.cars.ini
[PRICES]
108=850000
[OWNERS] ( owner id 1= etc is empy no modific )
1=
[NAMES] ( and all name car's )
108=Police

I did something wrong? Because if i enter to the police vehicle ID: 108, it says that owner: Price:  and not show the price and owner...
The elseif commands are work i puted tham all to the script. How can i fix it?
And i need to change something more in the script file? I also putted there the elseif commands.

I would be grateful for a example file :)

Offline ReVilo

  • Wiseguy
  • **
  • Posts: 64
  • Master of All that is Holy
    • View Profile
Re: Buycar Scriptin Sasan
« Reply #5 on: July 23, 2008, 05:08:04 am »
Quote
Credits: Is My Script Sasan V3 Release Modific By TanaX01 & Nemesis_24 and Revilo  Cool
Moe pretty much did this for you :-\
Give him some credit...

Offline TanaX01

  • Made Man
  • ***
  • Posts: 214
  • BlackList! <3
    • View Profile
Re: Buycar Scriptin Sasan
« Reply #6 on: July 23, 2008, 05:12:12 am »
Quote
Credits: Is My Script Sasan V3 Release Modific By TanaX01 & Nemesis_24 and Revilo  Cool
Moe pretty much did this for you :-\
Give him some credit...

nope you and nemesis  ;) i reset my pc and nemesis help my in script car buycar etc 

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Buycar Scriptin Sasan
« Reply #7 on: July 23, 2008, 10:38:49 am »
can you post the alias to?

Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Re: Buycar Scriptin Sasan
« Reply #8 on: July 23, 2008, 03:24:38 pm »
So what i did wrong? :(

Offline ReVilo

  • Wiseguy
  • **
  • Posts: 64
  • Master of All that is Holy
    • View Profile
Re: Buycar Scriptin Sasan
« Reply #9 on: July 23, 2008, 04:18:05 pm »
So what i did wrong? :(
It's probably becauseTanax didn't post the entire code :P

Offline Tamas

  • Made Man
  • ***
  • Posts: 127
    • View Profile
    • http://www.tamasnet.eu/
Re: Buycar Scriptin Sasan
« Reply #10 on: July 23, 2008, 04:23:42 pm »
Please Tanax can you give out the alias codes too? :D

Offline Nemesis2500

  • Wiseguy
  • **
  • Posts: 63
  • The Joker
    • View Profile
    • Grand VCMP Server
Re: Buycar Scriptin Sasan
« Reply #11 on: July 23, 2008, 07:29:48 pm »
So what i did wrong? :(
It's probably becauseTanax didn't post the entire code :P
is the full code  :-\ i think the problem is with the .ini files  ::)


Offline Nemesis2500

  • Wiseguy
  • **
  • Posts: 63
  • The Joker
    • View Profile
    • Grand VCMP Server
Re: Buycar Scriptin Sasan
« Reply #12 on: July 23, 2008, 07:52:07 pm »
sorry for double posting but  ::)...
in vcmp.cars.ini firistly you have to know how many cars you have in your server
for example i have 150 cars  :P
in vcmp.cars firstly goes the [PRICES]
write:
the ids
1=(price)
2=(price) etc etc as i said u hvae to know how many cars u have ingame

with [ID] is the same
1=1
2=2
3=3 etc etc

with [OWNERS] the ids
1=
2=
but only ID's  ;)

with [NAMES] is kinda boring xD
1=(car's name)
2=(car's name) etc etc

now with [SHARE] is the same as [OWNERS] only IDs


I DONT KNOW IF YOU'VE ALREADY DID THIS  :-\ BUT IM TRYING TO HELP

PS:YOU CAN ASK IF YOU DIDNT GET THIS  ;)


Offline TanaX01

  • Made Man
  • ***
  • Posts: 214
  • BlackList! <3
    • View Profile
Re: Buycar Scriptin Sasan
« Reply #13 on: July 23, 2008, 08:32:31 pm »
sorry add in

on *:START:{

Code: [Select]

  $iif($hget(myCars) != $null,, !hmake myCars)
  if ($isfile(vcmp.myCars.txt)) !hload myCars vcmp.myCars.txt


  vcmp.SaveMyCars

  vcmp.SaveAutoSpawn
}


on 1:EXIT:{
  /hsave -os myCars vcmp.myCars.txt
  /hsave -os AutoSpawn vcmp.AutoSpawn.txt
}
  ;)

Offline TanaX01

  • Made Man
  • ***
  • Posts: 214
  • BlackList! <3
    • View Profile
Re: Buycar Scriptin Sasan
« Reply #14 on: July 23, 2008, 10:23:44 pm »
Yea  :D Nice Example  8)