14.03.2012, 03:21
GetVehicleID gets the ID in order from the script. So you would use GetVehicleModel instead.
Also, your bool. You are never setting it to true if a player enters a vehicle so it will never work.
Read the comments! I hope I helped.
Also, your bool. You are never setting it to true if a player enters a vehicle so it will never work.
Read the comments! I hope I helped.
pawn Код:
new bool:pilot[MAX_PLAYERS]; // How a bool is setup, automatically false.
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
if(ispassenger == 0) // If they are not a passenger.
{
if(GetVehicleModel(playerid) == 476) // If they enter a Rustler
{
pilot[playerid] = true; // Then they are a pilot
return 1;
}
}
return 1;
}
public OnPlayerExitVehicle(playerid,vehicleid)
{
// If they exit any vehicle
pilot[playerid] = false; // Then they are no longer a pilot
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
// You added a lot of uneccesary paranthesis here. I fixed it.
if(GetPlayerVehicleModel(issuerid) == 476 && pilot[playerid] == true) // If they are in a Rustler
{
// Floats for health and armour are not needed since you are just killing the player.
SetPlayerArmour(playerid, 0);
SetPlayerHealth(playerid, 0);
}
return 1;
}

