SA-MP Forums Archive
Command Problem ! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command Problem ! (/showthread.php?tid=446031)



Command Problem ! - Champ - 24.06.2013

I have a problem in /setlevel cmd. When i log in to rcon and writes /setlevel 0(my id) 5(level) it says player is not connected.
here is the command↓

pawn Код:
CMD:setlevel(playerid, params[])
{
    new targetid, level, string[100];
    if(pInfo[playerid][pAdmin] < 5 && !IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_RED, "[ERROR] You are not authorised to use this command");
    if(sscanf(params, "ud", targetid, level)) return SCM(playerid, COLOR_RED, "[USAGE] /setlevel <playerid/part of name> <level>");
    if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected");
    pInfo[targetid][pAdmin] = level;
    format(string, sizeof(string), "Admin %s has set your admin level to %d", GetName(playerid), level);
    SCM(targetid, COLOR_GREEN, string);
    format(string, sizeof(string), "You have successfully set %s's level to %d", GetName(targetid), level);
    SCM(playerid, COLOR_GREEN, string);
    return 1;
}
help me plz..


Re: Command Problem ! - San1 - 24.06.2013

pawn Код:
CMD:setlevel(playerid, params[])
{
    new targetid, level, string[100];
    if(pInfo[playerid][pAdmin] < 5 && !IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_RED, "[ERROR] You are not authorised to use this command");
    if(sscanf(params, "ud", targetid, level)) return SCM(playerid, COLOR_RED, "[USAGE] /setlevel <playerid/part of name> <level>");
    if(IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected");
    pInfo[targetid][pAdmin] = level;
    format(string, sizeof(string), "Admin %s has set your admin level to %d", GetName(playerid), level);
    SCM(targetid, COLOR_GREEN, string);
    format(string, sizeof(string), "You have successfully set %s's level to %d", GetName(targetid), level);
    SCM(playerid, COLOR_GREEN, string);
    return 1;
}
Try this


Re: Command Problem ! - dEcooR - 24.06.2013

must work dude

Код:
CMD:setlevel(playerid, params[])
{
    new targetid, level, string[100];
    if(pInfo[playerid][pAdmin] < 5) return SCM(playerid, COLOR_RED, "[ERROR] You are not authorised to use this command");
    if(sscanf(params, "ud", targetid, level)) return SCM(playerid, COLOR_RED, "[USAGE] /setlevel <playerid/part of name> <level>");
    if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected");
if(level < 1 || level > 5) return SCM(playerid, COLOR_RED, "The range of levels is 1 - 5");
else
{
    pInfo[targetid][pAdmin] = level;
    format(string, sizeof(string), "Admin %s has set your admin level to %d", GetName(playerid), level);
    SCM(targetid, COLOR_GREEN, string);
    format(string, sizeof(string), "You have successfully set %s's level to %d", GetName(targetid), level);
    SCM(playerid, COLOR_GREEN, string);
}
    return 1;
}