When player died problem. -
PaulDinam - 02.09.2013
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:
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;
}
Re: When player died problem. -
Borg - 02.09.2013
do you use OnPlayerStateChange with PLAYER_STATE_WASTED?
Re: When player died problem. -
PaulDinam - 03.09.2013
No, I do not.
Re: When player died problem. -
Skribblez - 03.09.2013
Weird. Try adding
SetPlayerHealth(playerid, 0.0); on top just to make sure that the player dies.
Re: When player died problem. -
PaulDinam - 03.09.2013
Ive tried. doesn't work..
Re: When player died problem. -
Skribblez - 03.09.2013
What's suppose to happen when a player dies?
Re: When player died problem. -
PaulDinam - 03.09.2013
Nothing special, he must respawn.
Re: When player died problem. -
Skribblez - 03.09.2013
Have you tried using
SetSpawnInfo then
SpawnPlayer at the last part?
Re: When player died problem. -
PaulDinam - 03.09.2013
Ill try when I get home, Hope its gonna work.
Re: When player died problem. -
Skribblez - 03.09.2013
It should. Actually, just use
SetSpawnInfo since
OnPlayerSpawn is being called by
OnPlayerDeath.