SetPlayerTeam
#1

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.
Reply
#2

You did it right.
Reply
#3

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

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)