Posts: 758
Threads: 7
Joined: Mar 2011
Reputation:
0
Aren't trailers by default invincible? Like bicycles and trains? I'm not sure though.
Posts: 2,799
Threads: 95
Joined: Jun 2006
Reputation:
0
Thanks! However for the LONGEST time I didnt realize something...started scripting in 2007 and only realized this in 2012 once it was pointed out:
Vechicle ID CAN be 0!!! I had to change everything in Everystuff from:
if(!GetPlayerVehicleID(playerid))
to
if(GetPlayerVehicleID(playerid) == INVALID_VEHICLE_ID)
The first one checks to see if vehicleid is 0...assuming that there is no 'vehicle 0'. That assumption was wrong...the best way to check if a vehicleid is valid is to use things like:
if(GetPlayerVehicleID(playerid) == INVALID_VEHICLE_ID) SendClientMessage(playerid,COLOR_WHATEVER,"Thats not a real car!");
if(GetPlayerVehicleID(playerid) != INVALID_VEHICLE_ID) SendClientMessage(playerid,COLOR_WHATEVER,"That IS a real car!");
Posts: 2,938
Threads: 162
Joined: May 2010
Say what?
kaisersouse I think your wrong there, but
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID does not return INVALID_VEHICLE_ID, none of the sa-mp functions actually return INVALID_VEHICLE_ID, I only use it to initialize and reset variables.
That code you have there
pawn Код:
if(GetPlayerVehicleID(playerid) == INVALID_VEHICLE_ID)
actually shouldn't work, it should return false all the time. GetPlayerVehicleID returns 0 if the player doesn't have a vehicle id assigned.