• Welcome to Vice City Multiplayer.
 

Buycar Scriptin Sasan

Started by TanaX01, July 22, 2008, 10:34:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TanaX01

Commands Car, Buycar, Sellcar, Mycars, Sharecar, Delsharecar  ;)

Command !Car:

    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:

    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:
   
    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:

    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:


    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:

    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:

    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:

[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


[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  >:(

Nemesis2500



K.I.S.S


TanaX01


Tamas

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 :)

ReVilo

QuoteCredits: 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...

TanaX01

Quote from: ReVilo on July 23, 2008, 04:08:04 AM
QuoteCredits: 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 

thijn



Tamas


ReVilo

Quote from: [SRS]Tomi on July 23, 2008, 02:24:38 PM
So what i did wrong? :(
It's probably becauseTanax didn't post the entire code :P

Tamas

Please Tanax can you give out the alias codes too? :D

Nemesis2500

Quote from: ReVilo on July 23, 2008, 03:18:05 PM
Quote from: [SRS]Tomi on July 23, 2008, 02:24:38 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  ::)


Nemesis2500

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  ;)


TanaX01

sorry add in

on *:START:{



  $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
}
  ;)

TanaX01