21.08.2010, 20:36
pawn Code:
dcmd_setdrugs(playerid,params[]) {
new str[128];
if(IsPlayerAdmin(playerid)) {
new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /givedrugs [playerid] [amount]");
new player1 = strval(tmp), amount = strval(tmp2);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
format(str,sizeof(str),"You have given %s %d amount of drugs", player1, amount);
SendClientMessage(playerid,green,str);
if(player1 != playerid) {
format(str,sizeof(str),"Admin %s has Set your Drugs to '%d'", playerid, amount);
SendClientMessage(player1,green,str);
}
ResetPlayerDrugs(player1);
GivePlayerDrugs(player1, amount);
} else SendClientMessage(playerid,red,"ERROR: Player is not connected");
} else SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
return 1;
}
//commandtext
dcmd(setdrugs,8,cmdtext);