/setadmin help!
#1

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.
Reply
#2

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 ^^.
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)