SA-MP Forums Archive
/setadmin help! - 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: /setadmin help! (/showthread.php?tid=338234)



/setadmin help! - NewerthRoleplay - 29.04.2012

Hi im now creating a RP script from scratch after fiddling around with some base scripts and i decided that i was kind of ready but i am getting some warnings, here is the /setadmin command:
pawn Код:
CMD:setadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))return 0;
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,COLOR_RED, "USAGE: /setadmin [ID] [Level 1-1338]");//it will show this if you dont use the format properly
    if(levels > 1338) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-1338!");
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_RED,"That user is not connected.");
    if(PlayerInfo[ID][pAdmin] == levels) return SendClientMessage(playerid,COLOR_RED, "ERROR: That person is already this admin level!");
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has your Admin level to %d on the server.,Nam,levels);
        SendClientMessage(ID,COLOR_GREEN,str);
        format(str, sizeof(str),"
You had set %s Admin level to %d!",pname,levels);
        SendClientMessage(playerid,COLOR_GREEN,str);
        PlayerInfo[ID][pAdmin] = levels;
        return 1;
    }
    format(str, sizeof(str),"
%s has your Admin level to %d on the server.",Nam,levels);
    SendClientMessage(ID,0xFF9900AA,str);
    format(str, sizeof(str),"
You had set %s Admin level to %d!",pname,levels);
    SendClientMessage(playerid,COLOR_GREEN,str);
    PlayerInfo[ID][pAdmin] = levels;
    return 1;
}

And the errors i am getting are:
pawn Код:
C:\Users\Rob\Documents\PAWNO\pawno\include\YSI\y_utils.inc(160) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Rob\Documents\PAWNO\pawno\include\YSI\y_utils.inc(263) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Rob\Documents\PAWNO\pawno\include\YSI\y_utils.inc(289) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Rob\Documents\PAWNO\pawno\include\YSI\y_debug.inc(231) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Rob\Documents\PAWNO\pawno\include\YSI\y_debug.inc(291) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Rob\Documents\PAWNO\pawno\include\YSI\y_debug.inc(296) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Rob\Documents\PAWNO\pawno\include\YSI\y_ini.inc(804) : warning 219: local variable "str" shadows a variable at a preceding level
Pawn compiler 3.2.3664 * * Copyright (c) 1997-2006, ITB CompuPhase


7 Warnings.



Re: /setadmin help! - Cjgogo - 29.04.2012

pawn Код:
CMD:setadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))return 0;
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,COLOR_RED, "USAGE: /setadmin [ID] [Level 1-1338]");//it will show this if you dont use the format properly
    if(levels > 1338) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-1338!");
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_RED,"That user is not connected.");
    if(PlayerInfo[ID][pAdmin] == levels) return SendClientMessage(playerid,COLOR_RED, "ERROR: That person is already this admin level!");
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
        SendClientMessage(ID,COLOR_GREEN,str);
        format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
        SendClientMessage(playerid,COLOR_GREEN,str);
        PlayerInfo[ID][pAdmin] = levels;
        return 1;
    }
    format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
    SendClientMessage(ID,0xFF9900AA,str);
    format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
    SendClientMessage(playerid,COLOR_GREEN,str);
    PlayerInfo[ID][pAdmin] = levels;
    return 1;
}
Try that ^^.


Re: /setadmin help! - NewerthRoleplay - 29.04.2012

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
pawn Код:
CMD:setadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))return 0;
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,COLOR_RED, "USAGE: /setadmin [ID] [Level 1-1338]");//it will show this if you dont use the format properly
    if(levels > 1338) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-1338!");
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_RED,"That user is not connected.");
    if(PlayerInfo[ID][pAdmin] == levels) return SendClientMessage(playerid,COLOR_RED, "ERROR: That person is already this admin level!");
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
        SendClientMessage(ID,COLOR_GREEN,str);
        format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
        SendClientMessage(playerid,COLOR_GREEN,str);
        PlayerInfo[ID][pAdmin] = levels;
        return 1;
    }
    format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
    SendClientMessage(ID,0xFF9900AA,str);
    format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
    SendClientMessage(playerid,COLOR_GREEN,str);
    PlayerInfo[ID][pAdmin] = levels;
    return 1;
}
Try that ^^.
still getting the exact same warnings