CMD:setlevel(playerid,params[])
{
new level,id,file[256],n[MAX_PLAYER_NAME];
new tmp[256], tmp2[256], Index,str[50];
tmp = strtok(params,Index), tmp2 = strtok(params,Index),id = strval(tmp),level = strval(tmp2);
GetPlayerName(id,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"MyAdmin/Users/%s.txt",n);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GREY,"You are not an RCON admin!");
if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /setlevel <ID> <Level>");
if(!IsPlayerConnected(id))return SendClientMessage(playerid,GREY,"You have entered an incorrect ID");
if(level < 0 || level > 5) return SendClientMessage(playerid, ORANGE, "Level must be between 0 and 5!");
PInfo[id][Level] = level;
dini_IntSet(file,"Level",level);
format(str,sizeof(str),"You have set %s's level to %d",n,level);
SendClientMessage(playerid,LIGHTBLUE,str);
return 1;
}
CMD:setlevel(playerid,params[])
{
if(sscanf(params, "ui", target, level)) return SendClientMessage(playerid, red, "Correct usage: /setadmin [playerid/name] [level]");
new level,id,file[256],n[MAX_PLAYER_NAME];
new tmp[256], tmp2[256], Index,str[50];
tmp = strtok(params,Index), tmp2 = strtok(params,Index),id = strval(tmp),level = strval(tmp2);
GetPlayerName(id,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"MyAdmin/Users/%s.txt",n);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GREY,"You are not an RCON admin!");
if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /setlevel <ID> <Level>");
if(!IsPlayerConnected(id))return SendClientMessage(playerid,GREY,"You have entered an incorrect ID");
if(level < 0 || level > 5) return SendClientMessage(playerid, ORANGE, "Level must be between 0 and 5!");
PInfo[id][Level] = level;
dini_IntSet(file,"Level",level);
format(str,sizeof(str),"You have set %s's level to %d",n,level);
SendClientMessage(playerid,LIGHTBLUE,str);
return 1;
}
error 017: undefined symbol "target"
CMD:setlevel(playerid,params[])
{
new target;
if(sscanf(params, "ui", target, level)) return SendClientMessage(playerid, red, "Correct usage: /setadmin [playerid/name] [level]");
new level,id,file[256],n[MAX_PLAYER_NAME];
new tmp[256], tmp2[256], Index,str[50];
tmp = strtok(params,Index), tmp2 = strtok(params,Index),id = strval(tmp),level = strval(tmp2);
GetPlayerName(id,n,MAX_PLAYER_NAME);
format(file,sizeof(file),"MyAdmin/Users/%s.txt",n);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GREY,"You are not an RCON admin!");
if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /setlevel <ID> <Level>");
if(!IsPlayerConnected(id))return SendClientMessage(playerid,GREY,"You have entered an incorrect ID");
if(level < 0 || level > 5) return SendClientMessage(playerid, ORANGE, "Level must be between 0 and 5!");
PInfo[id][Level] = level;
dini_IntSet(file,"Level",level);
format(str,sizeof(str),"You have set %s's level to %d",n,level);
SendClientMessage(playerid,LIGHTBLUE,str);
return 1;
}
Or you could just have used "id".
EDIT: the whole command won't work. You'll need to either use "target" on everything or "id" on everything. |