SA-MP Forums Archive
setlevel command :S - 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: setlevel command :S (/showthread.php?tid=414893)



setlevel command :S - MiGu3X - 10.02.2013

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.



Re: setlevel command :S - |Xenon|Mapper| - 10.02.2013

Have you tried, trying it IG?


Respuesta: setlevel command :S - MiGu3X - 10.02.2013

unknown command


Re: setlevel command :S - LeBoyce - 10.02.2013

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.


Respuesta: setlevel command :S - MiGu3X - 10.02.2013

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


Re: setlevel command :S - LeBoyce - 10.02.2013

Код:
// 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..


Respuesta: setlevel command :S - MiGu3X - 10.02.2013

nope, now im getting 4 errors


Re: setlevel command :S - LeBoyce - 10.02.2013

Those are?..


Re: setlevel command :S - blackdragon1 - 10.02.2013

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


Respuesta: setlevel command :S - MiGu3X - 10.02.2013

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