02.07.2013, 13:11
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.
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:
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:
I'd be really glad if someone could help me with this, been trying to fix this for a few hours now...
Код:
new teamcrap[MAX_PLAYERS]; CMD:enter(playerid, params[]) { teamcrap[playerid] = GetPlayerTeam(playerid); return 1; }
Код:
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; }
Код:
public OnPlayerDeath(playerid, killerid, reason) { if(killerid != INVALID_PLAYER_ID) { SendClientMessage(playerid, -1, "you die"); } SetPlayerTeam(playerid, teamcrap[playerid]); return 1; }