AddStaticVehicleEx - 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)
+--- Thread: AddStaticVehicleEx (
/showthread.php?tid=313656)
AddStaticVehicleEx -
Gerira Gaijin - 26.01.2012
Does the vehicle keeps the same ID when it's respawned/destroyed or it changes?
Re: AddStaticVehicleEx -
MP2 - 26.01.2012
Test it with print()?
When vehicles are created, they take the lowest available ID.
Re: AddStaticVehicleEx -
Gerira Gaijin - 26.01.2012
It's hard to test it on a test server all by myself, because on a real server there is so many unknown variables and combinations that can take place. If they don't keep the same id, how can I set a new id of the car?
Re: AddStaticVehicleEx -
[ABK]Antonio - 26.01.2012
pawn Код:
new myCar1;
public OnGameModeInit()
{
myCar1 = AddStaticVehicle(therestofthestuff) //or with Ex
}
Re: AddStaticVehicleEx -
Gerira Gaijin - 26.01.2012
I've done that, just wondering if the ID changes on respawn or not. I know that with CreateVehicle, on respawn it conflicted with some ID's
Re: AddStaticVehicleEx -
MP2 - 26.01.2012
Try this:
pawn Код:
new vehicle[3];
public OnGameModeInit()
{
vehicle[0] = CreateVehicle(...);
vehicle[1] = CreateVehicle(...);
vehicle[2] = CreateVehicle(...);
return 1;
}
// In a command:
DestroyVehicle(vehicle[1]);
public OnVehicleRespawn(vehicleid)
{
new string[32];
format(string, sizeof(string), "Vehicle %i respawned.", vehicleid);
SendClientMessageToAll(-1, string);
}
Get in to vehicle[2] and destroy it, making it respawn. It should say 'vehicle 3 respawned' if the ID stayed the same. If it takes the place of vehicle[1], it will say 'vehicle 2 respawned'. Then see the client message.
NOTE: This needs to be a BLANK gamemode, with no other vehicles.