[Help] Vehicle Buying System
#1

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

thanks.
Reply
#2

..click..
Reply
#3

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

Reply
#4

You need this: GetPlayerVehicleID.
Reply
#5

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?

Reply
#6

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.
Reply
#7

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

Reply
#8

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.
Reply
#9

First vehicle is id 0 I believe.
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)