Player died 255 help please - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player died 255 help please (
/showthread.php?tid=443237)
Player died 255 help please -
KickInTheMick - 11.06.2013
Hello,
When I died in game it spawn me on my position or in blueberry and show me
Код:
[debug] Player died 255 // this is showing around 20 times and them my game crash
OnPlayerDeath
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SetProgressBarValue(hungry[playerid], 100);
SetSpawnInfo(playerid, -1, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPositionX], PlayerInfo[playerid][pPositionY], PlayerInfo[playerid][pPositionZ], PlayerInfo[playerid][pAngle], -1, -1, -1, -1, -1, -1);
SpawnPlayer(playerid);
return 1;
}
Re: Player died 255 help please -
greentarch - 11.06.2013
The problem occurs because you put "SpawnPlayer" there.
I've tested it in my server with this code :
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
SpawnPlayer(playerid);
return 1;
}
It spams "[debug]: abc has died 255" at the server console.
I think the solution is to remove SpawnPlayer from OnPlayerDeath
Re: Player died 255 help please -
random123 - 11.06.2013
Yeah OnPlayerDeath automatically calls OnPlayerSpawn do something like this instead.
pawn Код:
new bool:JustDied[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
JustDied[playerid] = false;
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
JustDied[playerid] = true;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(JustDied[playerid] == true)
{
SetPlayerPos(playerid,PlayerInfo[playerid][pPositionX], PlayerInfo[playerid][pPositionY], PlayerInfo[playerid][pPositionZ]);
SetPlayerFacingAngle(playerid,PlayerInfo[playerid][pAngle]);
SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
SetProgressBarValue(hungry[playerid], 100);
return 1;
}
return 1;
}