This is last thread about DM
#7

It's all about variables, and saving them. You make a variable called something like new pTeam[MAX_PLAYERS]; and then change it to the team number on OnPlayerSpawn. If you want to save the Team ID, so the player automatically gets the same Team when he connects in again, you have to save the Team ID on OnPlayerDisconnect in his userfiles. And then just load it on OnPlayerConnect.

pawn Код:
if(strcmp(string, "/team", true) == 0 || strcmp(string, "/t", true) == 0)
{
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOR_GREY, "USAGE: /(t)eam [chat]");
        return 1;
    }    
    length = strlen(cmdtext);
    while((idx < object) && (cmdtext[idx] <= ' '))
    {
        idx++;
    }
    new offset = idx;
    new result[64];
    while((idx < object) && ((idx - offset) < (sizeof(result) - 1)))
    {
        result[idx - offset] = cmdtext[idx];
        idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
        SendClientMessage(playerid, COLOR_GREY, "USAGE: /(t)eam [chat]");
         return 1;
    }
    GetPlayerName(playerid, string, sizeof(string));
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(pTeam[playerid] == pTeam[i])
        {
            format(string, sizeof(string), "%s says: %s", string, reason);
            if(pTeam[playerid] == 1)
            {
                SendClientMessage(i, COLOR_BLUE, string);
            }
            else if(pTeam[playerid] == 2)
            {
                SendClientMessage(i, COLOR_RED, string);
            }
        }
    }
}
Reply


Messages In This Thread
This is last thread about DM - by lyrics - 17.08.2011, 09:57
Re: This is last thread about DM - by lyrics - 17.08.2011, 10:23
Re: This is last thread about DM - by [MG]Dimi - 17.08.2011, 10:45
Re: This is last thread about DM - by Riddick94 - 17.08.2011, 10:45
Re: This is last thread about DM - by Basicz - 17.08.2011, 10:46
Re: This is last thread about DM - by lyrics - 17.08.2011, 10:50
Re: This is last thread about DM - by Adil - 17.08.2011, 11:08
Re: This is last thread about DM - by lyrics - 17.08.2011, 11:22
Re: This is last thread about DM - by Basicz - 17.08.2011, 11:43
Re: This is last thread about DM - by lyrics - 17.08.2011, 12:00

Forum Jump:


Users browsing this thread: 2 Guest(s)