24.01.2013, 20:12
(
Last edited by Roach_; 24/01/2013 at 09:02 PM.
)
For first, why do you want to change that, ZCMD is more faster than strcmp..
Whatever..
You need this function:
Add this to the OnPlayerCommandText callback(at the beginning of the callback):
The command would be like this:
Use this: https://sampforum.blast.hk/showthread.php?tid=143977
Whatever..
You need this function:
pawn Code:
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;
}
pawn Code:
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
pawn Code:
if(!strcmp(cmd, "/givemoney", true))
{
new tmp[128], targetid, type, string[128];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: {FFFFFF}/givemoney [playerid] [amount]");
targetid = strval( tmp );
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: {FFFFFF}/givemoney [playerid] [amount]");
type = strtok(cmdtext, idx);
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "* This player is not in server..");
if(type < 0 || type > 99999999) return SendClientMessage(playerid, COLOR_GREY, "* Cannot go under 0 or above 99999999.");
if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GRAD1, "You are not ADMIN!");
GivePlayerCash(targetid, type);
format(string, sizeof(string),"AdmCmd: %s give player %s %d SAK", RPName( playerid ), RPName( targetid ), type);
SendAdminMessage(COLOR_YELLOW,string);
return 1;
}