Whats the id of the first created vehicle? - 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: Whats the id of the first created vehicle? (
/showthread.php?tid=291993)
Whats the id of the first created vehicle? -
Audiophr3ak - 22.10.2011
Whats the id of the first created vehicle on the server? Is that 0 or 1? I guess its 1 because 0 - is an invalid vehicleid.
Re: Whats the id of the first created vehicle? -
[NoV]LaZ - 22.10.2011
It's 1.
Re: Whats the id of the first created vehicle? -
Audiophr3ak - 22.10.2011
That was i expected. Hm. OK. I have some weird problem with saving the first created vehicle...
Re: Whats the id of the first created vehicle? -
XGh0stz - 22.10.2011
Vehicles, Pickups, Text Draws, 3D Text Labels, Objects...
I'm not sure which start at 0 or 1, so what I do is after creating them, bump the Int Varible up by +1, then bump it down -1 whenever I might need to access that information. This helps me determine if a certain varible actually exist also since default of any checked varible is always 0 etc.
Not sure exactly if this would help with your problem or not, but thought it was still worth mentioning
Example though: A vehicle is created which returns its vehicleid, so I add +1 to that (Varible) right after its been created. In most cases, you might need to check if that varible matches up to a certain vehicle id, so I first do a check if the varible is not 0, then -1 to that varible & perform the check. Restoring the +1 after all those actions if nessecary (Not Destroyed or something).
Re: Whats the id of the first created vehicle? -
Audiophr3ak - 22.10.2011
Im trying to use native SA-MP features but yeah, sometimes they are too fucked up for proper work... I dunno how, but when im buying vehicles at dealership - everything works allright, the id, the owner, the slot (0,1,2), everything marked nicely. But when im saving em at disconnect, the first slot vehicle is not saving and vehicle 1 saves to slot 0 also vehicle 2 saves to slot 1... Some stupid mismatch.