04.08.2014, 05:25
(
Последний раз редактировалось codectile; 04.08.2014 в 05:56.
)
pawn Код:
stock Float:GetEveryoneHP(vehicle)
{
if(IsValidVehicle(vehicleid) == 0) return -1;
new Float:hP = 0.0; //This should be "0.0" instead of "-1.0"
for(new p = 0; p < MAX_PLAYERS; p++)
{
if(IsPlayerConnected(p) != 1 || IsPlayerInAnyVehicle(p) != 1) continue;
if(GetPlayerVehicleID(p) != vehicleid) continue;
if(GetPlayerState(p) != PLAYER_STATE_DRIVER) continue;
new Float:pHP;
GetPlayerHealth(p, pHP);
hP = (hP + pHP); //If hP is equal to "-1.0" it will deduct "1.0" from the first instance.
}
return hP;
}
pawn Код:
stock GetVehiclePassenger(vehicleid)
{
if(IsValidVehicle(vehicleid) == 0) return -1;
for(new p = 0; p < MAX_PLAYERS; p++)
{
if(IsPlayerConnected(p) != 1 || IsPlayerInAnyVehicle(p) != 1) continue;
if(GetPlayerVehicleID(p) != vehicleid) continue;
if(GetPlayerVehicleSeat(p) != 1) continue;
return p;
}
return -1;
}