06.12.2009, 15:19
OnPlayerCommandText()
But i hope you learn pawn, and not requesting every time when you dont know something.
pawn Код:
OnPlayerCommandText(playerid, cmdtext)
{
new cmd[64], idx;
new tmp[128];
cmd = strtok(cmdtext, idx); // This is the command (e.g /help)
if(strcmp(cmd, "/givecash", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
return SendClientMessage(playerid, COLOR_RED, "Usage: /givecash [playerid] [amount]");
new player = strval(tmp);
if(!IsPlayerConnected(player))
return SendClientMessage(playerid, COLOR_RED, "Wrong id, or not connected");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
return SendClientMessage(playerid, COLOR_RED, "Usage: /givecash [playerid] [amount]");
new amount = strval(tmp);
GivePlayerMoney(playerid, amount);
return 1;
}
}