for (new i = 0; i < MAX_PLAYERS; i++)
{
if (GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
{
GetPlayerHealth(i, health), SetPlayerHealth(i, health - 7);
////
GetPlayerHealth(playerid, health), SetPlayerHealth(playerid, health - 7);
}
}
for (new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerInVehicle(i, GetPlayerVehicleID(playerid))) { // playerid will be in the vehicle aswell: GetPlayerHealth(i, health); SetPlayerHealth(i, health - 7); } }
Your code will take 7 hp from anyone who's in the same vehicle of playerid.
And will take 14 hp from playerid. You should use IsPlayerInVehicle. So players that aren't in vehicles won't be affected if you check someone who is not in a vehicle. Код:
for (new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerInVehicle(i, GetPlayerVehicleID(playerid))) { // playerid will be in the vehicle aswell: GetPlayerHealth(i, health); SetPlayerHealth(i, health - 7); } } |
if (IsPlayerInVehicle(i, vehicleid))
{
if(CintoPlayerid[i] == 1) return 1;
GetPlayerHealth(i, health);
SetPlayerHealth(i, health - 7);
}
return 1;
if(CintoPlayerid[i] == 1) continue;