spawning cars with id's
#1

Alright so i want to make a rental system but the cars will be spawned from dialog text for example a list dialog when they click the car that they want to rent it will spawn, But i want each car that is spawned to have an id so that i can make sure only the person that has rented that car can use it how would i go about doing something like this?
Reply
#2

Each time you spawn a car, it has a unique identifying number. It changes when the vehicle is destroyed though, is this what you're looking for?
Reply
#3

yes how do i get this number though im unsure how i would make the rental car only be usable by them.
Reply
#4

You can use GetPlayerVehicleID() to determine which vehicle the playerid is in.
Reply
#5

If you create the vehicle the return value of CreateVehicle is the unique vehicleid
Reply
#6

could you give a code example of how i could set that?
Reply
#7

i mean how can i get that id and give it to the player?
Reply
#8

I think that this could work

not sure because of the new native SetVehicleParamsEx

pawn Код:
//where you create the vehicle for the player
new
    vehicleid = CreateVehicle(...);
SetVehicleParamsEx(vehicleid, 1, 0, 0, 1, 0, 0, 0);
SetVehicleParamsForPlayer(vehicleid, playerid, 0, 0);
Additionally you should read the OnVehicleStreamIn part on the page SetVehicleParamsForPlayer
Reply
#9

lol
i think i got what did you say
here you can see vehicle's ids+names : https://sampwiki.blast.hk/wiki/Vehicle_Model_ID_List
CODE:
pawn Код:
CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay);
CreateVehicle(411, 0.000, 0.000, 10.1234,50,120,120,5);
//Explaning : CreateVehicle(Vehicle id(for example :: 411) ,X(look on the Picture),Y(look on the Picture),Z Hight(+Z = UP | -Z = Down) , FacingAngle(Look on the picture(with this you can rotate the vehicle), color1(vehicle Colour) ,color2(vehicle colour),Respawn time(how much time he will stay in the same place with out a driver)
Picture:[Image: xyz_axes.gif]

FacingAngle(the vehicle in the center) : [Image: asdasdasdasdasdasdcord.PNG]

i hope it will help you alittle


Scripters : fix me if i sayed somthing wrong >.<
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)