setlevel command :S
#1

http://pastebin.com/u4vZVRXu im using that on my script, but when i compile, this happens:

Код:
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_debug.inc(276) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_debug.inc(338) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_debug.inc(343) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_amx.inc(467) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_amx.inc(917) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_amx.inc(939) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_utils.inc(239) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_utils.inc(362) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_utils.inc(389) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_utils.inc(468) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_malloc.inc(487) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_malloc.inc(612) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\pawno\include\YSI\y_ini.inc(1071) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\gamemodes\new.pwn(370) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\gamemodes\new.pwn(419) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\gamemodes\new.pwn(447) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\gamemodes\new.pwn(479) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\user7\Desktop\Server\gamemodes\new.pwn(541) : warning 209: function "cmd_setadmin" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


18 Warnings.
Reply
#2

Have you tried, trying it IG?
Reply
#3

unknown command
Reply
#4

Well you only return the command when this is true - level == 0. In case it's not true you need to return something as well. Also you just need to change 'str' into something else. 'string' maybe or '_str' since it's already defined in your includes.
Reply
#5

can anyone send me a new version of it, cauz i rly wanna add it :S
Reply
#6

Код:
// Abajo de los Colores

enum pData
{
    AdminLevel
};
new PlayerData[MAX_PLAYERS][pData];
new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],_str[128],ID;

// =========================================================================================================

CMD:setadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))return 0;
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setadmin <id> <level 1-5>");
    if(levels > 5) return SendClientMessage(playerid,0xFF0000FF,"ERROR: Available levels 1-5!");
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid, RED,"ERROR: That player is not connected.");
    if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid, RED, "ERROR: That player 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 had set your Admin level to %d on the server.", Nam, levels);
        SendClientMessage(ID, ORANGE, _str);
        format(_str, sizeof(_str),"You had set %s Admin level to %d",pname,levels);
        SendClientMessage(playerid, ORANGE, _str);
        PlayerData[ID][AdminLevel] = levels;//this sets the player level
    }
    return 1;
}
Tell me if it works.

EDIT: An other point is that you only actually change the level when the level is 0. I may be wrong but I guess you want to change it when its between 0 and 5..
Reply
#7

nope, now im getting 4 errors
Reply
#8

Those are?..
Reply
#9

well, DO you know copying and pasting need a sense too? btw "mistake means you're trying."
Reply
#10

I fixed it. The new string had to be inside the stuff. Nevermind. Problem solved. Lock
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)