02.09.2013, 22:59
Whenever a player dies, it's like randomly happens the player gets stuck and he won't respawn, only if someone else will shot him once again.
Here's my OnPlayerDeath function:
Here's my OnPlayerDeath function:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid != playerid)
{
new str[128];
WepLevel[ killerid ] ++;
Kills[ killerid ] ++;
Kills[ playerid ] = 0;
SetPlayerHealth( killerid, 100.0 );
if(Kills[ killerid ] == 5 || Kills[ killerid ] == 10 || Kills[ killerid ] == 15)
{
SendClientMessage( killerid, COLOR_LIGHTGREEN, "You've gained some extra health and armour!");
SetPlayerHealth( killerid, 100.0 );
SetPlayerArmour( killerid, 100.0 );
}
TextDrawShowForPlayer(playerid, KillDieDraw[playerid]);
TextDrawShowForPlayer(killerid, KillDieDraw[killerid]);
format(str, sizeof(str), "~p~You have been killed by ~y~%s", GetNameEx(killerid));
TextDrawSetString(KillDieDraw[playerid], str);
format(str, sizeof(str), "~p~You have just killed ~y~%s", GetNameEx(playerid));
TextDrawSetString(KillDieDraw[killerid], str);
SetPVarInt(playerid, "KillDieDraw", 5);
SetPVarInt(killerid, "KillDieDraw", 5);
if( GetPlayerWeapon( killerid ) == 4 )
{
if( WepLevel[ playerid ] != 1)
{
SendClientMessage( playerid, COLOR_LIGHTBLUE, "*** You have leveled down! you've died by a knife ***" );
WepLevel[ playerid ] --;
}
}
GiveWeaponByLevel( killerid );
}
SetPVarInt(playerid, "HasDied", 1);
return 1;
}