16.05.2012, 18:44
Here's a simple example (as far as I understood what you said):
Let's say you have your scripted /goto command which looks like:
Well, let's make a command which disable /goto for a certain player:
And if you'd like to make a command that enables /goto, you would simply do as I did with /gotoff. But change SetPVarInt(playerid, "NotAbleToGoto", 1); to SetPVarInt(playerid, "NotAbleToGoto", 0);
Let's say you have your scripted /goto command which looks like:
pawn Код:
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/goto", true) == 0)
{
new tragetplayer, tmp[128];
tmp = strtok(cmdtext, idx);
if(GetPVarInt(playerid, "NotAbleToGoto") == 1)
{
SendClientMessage(playerid, -1, "You are not allowed use this command!");
return 1;
}
else if(!strlen(tmp))
{
SendClientMessage(playerid, -1, "Usage: /goto <id>");
return 1;
}
targetplayer = strval(tmp);
if(targetplayer == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, -1, "ERROR: Player is not connected!");
return 1;
}
else
{
new Float:x, Float:y, Float:z;
GetPlayerPos(targetplayer, x, y, z);
SetPlayerPos(playerid, x, y, z);
}
return 1;
}
pawn Код:
if(strcmp(cmd, "/gotoff", true) == 0)
{
new targetplayer, tmp[128];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, -1, "Usage: /gotoff <id>");
return 1;
}
targetplayer = strval(tmp);
if(targetplayer == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, -1, "ERROR: Player is not connected");
return 1;
}
else
{
SetPVarInt(playerid, "NotAbleToGoto", 1);
}
}