SA-MP Forums Archive
[Help] Vehicle Buying System - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Vehicle Buying System (/showthread.php?tid=79560)



[Help] Vehicle Buying System - borisblat - 29.05.2009

I'm trying to do a vehicle buying system but how can i number of the vehicles?

thanks.


Re: [Help] Vehicle Buying System - v0nz - 29.05.2009

..click..


Re: [Help] Vehicle Buying System - borisblat - 29.05.2009

I don't mean this, i know that is the ID of them...
i mean like this:

Код:
AddStaticVehicle(458,1731.3745,1981.2572,10.6907,91.7291,36,5); // 
AddStaticVehicle(559,1731.0280,1924.9923,10.4767,266.4165,14,2); // 
AddStaticVehicle(437,1754.6205,1995.7476,10.9536,1.2363,3,0); // 
AddStaticVehicle(556,1743.3206,1856.1873,11.1952,0.4248,0,0); // 
AddStaticVehicle(599,2299.0615,2460.2834,3.4579,270.6640,0,1); //
the first one will get the ID : 1
the second one will get the ID : 2
the third: 3
etc..

and the when i will do /buycar it will do under the key "CAR" it will show 1 or 2 ... etc..




Re: [Help] Vehicle Buying System - lol2112 - 29.05.2009

You need this: GetPlayerVehicleID.


Re: [Help] Vehicle Buying System - borisblat - 29.05.2009

and that thing:
Код:
new vehicle;
vehicle = GetPlayerVehicleID(playerid);
if (vehicle = 1)
{
  AddVehicleComponent(vehicle, 1010);
}
and that thing will give only to my first vehicle in the script a nitro?




Re: [Help] Vehicle Buying System - NeRoSiS - 29.05.2009

Yes, but there is a slight error in your code.

If you use only one "=" then it writes a number to the variable, you need two "=" to read it, like this

if(vehicle == 1)

Hope I helped.


Re: [Help] Vehicle Buying System - borisblat - 29.05.2009

it doesnt work
Код:
if (car == vehicle[100])
    {
     AddVehicleComponent(car, 1010);
     format(string, sizeof(string), "You Are in car number %s", car);
  	 SendClientMessage(playerid,0xFF0000AA,string);
    }
it doesn't work good, it don't show the number of the car

and if i do car == 100 it doesnt do anything..




Re: [Help] Vehicle Buying System - miokie - 29.05.2009

pawn Код:
if (car == vehicle[100])
{
AddVehicleComponent(Vehicle, 1010);
format(string, sizeof(string), "You Are in car number %d", car);
SendClientMessage(playerid,0xFF0000AA,string);
}
For starters
%s = Text.
%d = Whole Number.

So when returning a vehicleid, the id is a whole number so you need to use %d.


Re: [Help] Vehicle Buying System - lol2112 - 29.05.2009

First vehicle is id 0 I believe.


Re: [Help] Vehicle Buying System - borisblat - 29.05.2009

ok thx, works but why when i do this :

dini_Set(dinipath, "car", "%d" , i-100);

under the key car it doing %d and not the number?