28.05.2013, 05:23
Well I made a code to make you injured on death (mainly for RP) instead of going to hospital.. But.. it seems to be injuring all the server if only one dies
This is how i call it
pawn Код:
// THIS IS THE TIMER!
public AfterDeath()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
SetPlayerPos(i, DeathPosX[i], DeathPosY[i], DeathPosZ[i]);
ApplyAnimation(i,"CRACK","crckdeth1",4.1,1,1,1,1,1,1);
GameTextForPlayer(i, "~r~Injured~n~~w~Please Call the EMS /service EMS", 5000, 3);
new Float:HISCHP;
GetPlayerHealth(i, HISCHP);
SetPlayerHealth(i, HISCHP-5);
if(HISCHP < 12.0)
{
PlayerInfo[i][pHospital] = 1;
KillTimer(death_timer[i]);
SetPlayerSpawn(i);
}
}
return 1;
}
pawn Код:
if(newstate == PLAYER_STATE_WASTED) //PLAYER DIES
{
if(PlayerInfo[playerid][pJailed] == 0)
{
new Float:DX;
new Float:DY;
new Float:DZ;
GetPlayerPos(playerid, DX, DY, DZ);
DeathPosX[playerid] = DX;
DeathPosY[playerid] = DY;
DeathPosZ[playerid] = DZ;
death_timer[playerid] = SetTimer("AfterDeath", 7000, 1);
}
}