Question..
#1

Alright, With my vehicle ownership, if they want their car they have to do /mycar (which spawns their vehicle - After they purchased one) and /despawnmycar (Despawns their vehicle) but they can do /despawnmycar in ANY vehicle and it deletes the car untill I do /rac(respawn all cars)

How can I check if they're in THERE car and not a some one elses?
Reply
#2

hm... i would do that like:
before spawning the car, its stored in a Variable, i assume. when the car spawns, remark its ID:
pawn Код:
new Car=CreateVehicle();//if you got 1900 cars on your map already, then this vehicle will get ID 1901 assigned. this 1901 will get stored in Car. like Car=1901;
after the vehicle spawned, and its ID is "written down" in Car, its time to set a PVar.which stores that vehicle id:
pawn Код:
SetPVarInt(playerid,"VehicleIDOwned",Car);
from now on you can use that
pawn Код:
GetPVarInt(playerid,"VehicleIDOwned")
when you destroy that vehicle now, you need to delete the pvar aswell, coz its referring to a not existing vehicle (or even worse, a wrong one).
pawn Код:
//despawnmycar
DestroyVehicle(GetPVarInt(playerid,"VehicleIDOwned");
DeletePVar(playerid,"VehicleIDOwned");
..if this all aucceds and works like mentioned, its easy to enhance the whole script to work like that. its a good idea to search for "vehicle" in the entire script, and look if some changes are required.

edit: just noticed: when you /despawnmycar, then the car will be lost. you need to ad one more variable which tells the vehicle model id, so you can spawn it again...
Reply
#3

Alright, I guess my other post didnt get posted.. How could I make it so I could save the bought cars to like.. A file, like an include or a .ini where I could load all the houses on gamemodeinit like, LoadOwnedVehicles(); or somthing? Becuase I want owned cars just to stay on the map.. Instead of needing to be spawned.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)