SA-MP Forums Archive
Set vehicle health help - 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: Set vehicle health help (/showthread.php?tid=437517)



Set vehicle health help - aznpro12345 - 15.05.2013

Im trying to set a certain vehicle id at a certain amount of health.

i got some working but this one just wont work

Код:
if(GetVehicleModel(vehicleid) == 411) // 411 is the infernus model
 	SetVehicleHealth(vehicleid, 2000.0);
if gives unidentified symbols after i compile this


AW: Set vehicle health help - HurtLocker - 16.05.2013

You have to understand the difference between the model id and the vehicle id. model id is the number that represents the model of the car like 411 means infernus. Vehicle id is the number that each vehicle has as identity inside the server. Two infernus in the same server have different vehicle ids.
This is how you should do it:
pawn Код:
if(GetVehicleModel(vehicleid) == 411)
{
      SetVehicleHealth(GetPlayerVehicleID(playerid), 2000.0);
}



Re: Set vehicle health help - aznpro12345 - 16.05.2013

Ah, thank you very much


Re: AW: Set vehicle health help - CJay9209 - 16.05.2013

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
You have to understand the difference between the model id and the vehicle id. model id is the number that represents the model of the car like 411 means infernus. Vehicle id is the number that each vehicle has as identity inside the server. Two infernus in the same server have different vehicle ids.
This is how you should do it:
pawn Код:
if(GetVehicleModel(vehicleid) == 411)
{
      SetVehicleHealth(GetPlayerVehicleID(playerid), 2000.0);
}
Thats exactly the same thing really. if he already knows the vehicleid he's checking it won't make any difference checking his vehicleid there because if he has misdefined vehicleid up higher then it'll always compare the wrong vehicleid to his vehicleid... should be this:

pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 411)
{
      SetVehicleHealth(vehicleid, 2000.0);
}
like i said if u dont do that then the argument is probably gonna give u some weird results lol


AW: Re: AW: Set vehicle health help - HurtLocker - 17.05.2013

Quote:
Originally Posted by CJay9209
Посмотреть сообщение
Thats exactly the same thing really. if he already knows the vehicleid he's checking it won't make any difference checking his vehicleid there because if he has misdefined vehicleid up higher then it'll always compare the wrong vehicleid to his vehicleid... should be this:

pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 411)
{
      SetVehicleHealth(vehicleid, 2000.0);
}
I can't understand what you are trying to say. And in the end you just add in my code a variable which is completely unnecessary.

EDIT: oh nevermind i see your point, i think i need to go to bed to refill my mind batteries haha


Re: Set vehicle health help - aznpro12345 - 17.05.2013

It keeps crashing my pawno.exe