OnPlayerDeath problem
#1

Hello. I have a simple event system script that on join saves players team to a variable, and sets it back when event is over, they leave or die.

Код:
new teamcrap[MAX_PLAYERS];

CMD:enter(playerid, params[])
{
teamcrap[playerid] = GetPlayerTeam(playerid);
return 1;
}
It works fine when they leave with a cmd or when I end the event and sets their team correctly. But it's somehow bugged on the player death. I have this command to check what team I'm in:

Код:
CMD:showteam(playerid,params[])
{
new shitt[50];
new asd = GetPlayerTeam(playerid);
format(shitt, sizeof(shitt), "team is %i", asd);
SendClientMessage(playerid, -1, shitt);
return 1;
}
And after I /kill myself in the event it actually sets me to the correct team, but after I spawn it's set to 255 (NO_TEAM). When I /kill myself again, it sets me to correct team. And this is the OnPlayerDeath code:

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid != INVALID_PLAYER_ID)
    {
	SendClientMessage(playerid, -1, "you die");
    }
    SetPlayerTeam(playerid, teamcrap[playerid]);
    return 1;
}
I'd be really glad if someone could help me with this, been trying to fix this for a few hours now...
Reply


Messages In This Thread
OnPlayerDeath problem - by exclide1 - 02.07.2013, 13:11
Re: OnPlayerDeath problem - by Cjgogo - 02.07.2013, 13:22
Re: OnPlayerDeath problem - by Anak - 02.07.2013, 13:24
Re: OnPlayerDeath problem - by exclide1 - 02.07.2013, 13:27

Forum Jump:


Users browsing this thread: 1 Guest(s)