[Help]Guys i need help plz with jail command
#3

Quote:
Originally Posted by zack3021
Посмотреть сообщение
I made a jail command. But when i type it, it jails me and not the player.

Код:
	if (strcmp("/jail", cmdtext, true, 10) == 0)
	{
		SetPlayerPos(playerid,2042.7137,988.9628,10.6719);
		return 1;
	}
  	return 0;
}
Don't use the code above; it has missing things that you need in order to use that.

Yes, thats because you put "playerid" which means you are telling the script to jail the person typing the cmd.

You need to use strtok; or sscanf.

Under OnPlayerCommandText:
pawn Код:
new
        cmd[256],
        tmp[256],
        idx
    ;
    cmd = strtok(cmdtext, idx);
    if(!strcmp(cmd, "/jail", true))
    {
        new id;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /jail <id>");
       
        id = strval(tmp);
       
        SetPlayerPos(id, 2042.7137,988.9628,10.6719);
        return 1;
    }
Your welcome
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)