03.09.2010, 01:04
Quote:
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; } |
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;
}