/changeteam <ID>
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], idx;
    cmd = strtok(cmdtext, idx);
    if(!strcmp(cmd, "/setteam", false))
    {
        new tmp[128], tmp2[128], id, teams;
        tmp = strtok(cmd, idx);
        id = strval(tmp);
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xF0F0F0AA, "Player not connected.");
        {
            tmp2 = strtok(tmp, idx);
            teams = strval(tmp2);
            if(teams > 7 || 1 < teams) return SendClientMessage(playerid, 0xF0F0F0AA, "Valid teams are from 1 to 7.");
            {
                team[id] = teams;
                SetPlayerTeam(id, teams);
                SpawnPlayer(id);
            }
        }
    }
    return 0;
}

stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Should work
Reply


Messages In This Thread
/changeteam <ID> - by marinov - 09.11.2010, 21:43
Re: /changeteam <ID> - by The_Moddler - 09.11.2010, 21:55
Re: /changeteam <ID> - by marinov - 09.11.2010, 22:22
Re: /changeteam <ID> - by The_Moddler - 09.11.2010, 22:46
Re: /changeteam <ID> - by marinov - 09.11.2010, 23:11
Re: /changeteam <ID> - by The_Moddler - 09.11.2010, 23:15
Re: /changeteam <ID> - by Steven82 - 09.11.2010, 23:17
Re: /changeteam <ID> - by marinov - 09.11.2010, 23:20
Re: /changeteam <ID> - by The_Moddler - 09.11.2010, 23:21
Re: /changeteam <ID> - by marinov - 09.11.2010, 23:34

Forum Jump:


Users browsing this thread: 4 Guest(s)