SA-MP Forums Archive
SetPlayerTeam - 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: SetPlayerTeam (/showthread.php?tid=447435)



SetPlayerTeam - exclide1 - 30.06.2013

Hello. I'm scripting an event-system and I want it so, when player joins the event, it will save his team to the variable and then, when event ends/he leaves it will set it back. Is this the correct way to do it?

pawn Код:
new teamcrap[MAX_PLAYERS];

CMD:join(playerid,params[])
{
    teamcrap[playerid] = GetPlayerTeam(playerid);
    joined[playerid] = 1;
    return 1;
}

CMD:endevent(playerid,params[])
{
    foreach (new i : Player)
    {
        if(joined[i] == 1)
        {
            joined[i] = 0;
            SetPlayerTeam(i, teamcrap[i]);
        }
    }
    return 1;
}
I want to make sure I got it right.


Respuesta: SetPlayerTeam - JustBored - 30.06.2013

You did it right.


Re: SetPlayerTeam - ScRipTeRi - 30.06.2013

pawn Код:
CMD:join(playerid,params[])
{
    SetPlayerTeam(playerid, ..); //put here your team id
    return 1;
}

CMD:endevent(playerid,params[])
{
   SetPlayerTeam(playerid, NO_TEAM);
    return 1;
}



Re: SetPlayerTeam - Sellize - 30.06.2013

Quote:
Originally Posted by ScRipTeRi
Посмотреть сообщение
pawn Код:
CMD:join(playerid,params[])
{
    SetPlayerTeam(playerid, ..); //put here your team id
    return 1;
}

CMD:endevent(playerid,params[])
{
   SetPlayerTeam(playerid, NO_TEAM);
    return 1;
}
Did you even read what the OP posted?!

OP you are doing it right.