How do I make a command that changes a player's team ?
#10

pawn Code:
if(strcmp(cmdtext, "/putzombie", 10) == true)
{
    new id = strval(cmdtext[11]); //this is the id of the player whos team your trying to change
    //just do everything with 'id', such as:
    team[id] = 2; //change your players team
    //change their color, etc
    return 1;
}
strval checks the value of the string. The string is cmdtext. We but the 11 there because we want strval to read the string after the 11th character.

On the command itself, we put 10 because "/putzombie" is 10 characters long. That means it won't say "SERVER: unknown command" because we put an id after it.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)