05.12.2009, 21:39
Try this command instead. Your command had a few problems with it.
EDIT:
Sorry, just realized you are using dcmd. Also, I think your command problem is that you are making the "admlevel" variable carry the selected playerid amount. (which if you are testing by yourself, would always be zero).
pawn Код:
if(strcmp(cmd, "/giveadmin", true) == 0)
{
new tmp[256], tmpp[256];
if(IsPlayerAdmin(playerid) || level[playerid] >= 4)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, color, "Usage: /giveadmin <id> <level (1-4)>");
new targetid = strval(tmp); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, color, "Invalid Player ID");
tmpp = strtok(cmdtext, idx);
if(!strlen(tmpp)) return SendClientMessage(playerid, color, "Usage: /giveadmin <id> <level (1-4)>");
new admlevel = strval(tmpp);
new str[128], name[24];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "\\Users\\%s.ini", name);
dini_IntSet(str, admlevel);
return 1;
}
else return SendClientMessage(playerid, color, "You're not allowed to use this command!");
}
Sorry, just realized you are using dcmd. Also, I think your command problem is that you are making the "admlevel" variable carry the selected playerid amount. (which if you are testing by yourself, would always be zero).