Set vehicle health help
#1

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
Reply
#2

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);
}
Reply
#3

Ah, thank you very much
Reply
#4

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
Reply
#5

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
Reply
#6

It keeps crashing my pawno.exe
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)