help me please
#1

I have a problem with a command
Tells me that the maximum level is 0

CMDetlevel(playerid,params[])
{
if(IsPlayerAdmin(playerid)) {
new id,level,Jfile[100],year,month,day,hour,minute,second;
if(sscanf(params, "ui", id, level)) return
SendClientMessage(playerid, 0xFFFF00C8, "Usage: /setlevel <PlayerID> <Level>") ;
if(level < 0) return SendClientMessage(playerid,red,"Invalid level(level must be greater than -1)");
if(IsPlayerConnected(id))
{
if(level == pInfo[id][pLevel])
return SendClientMessage(playerid,red,"Player is already in this level!");
if(level > MaxAdminLevel)
{
format(Jstring,sizeof(Jstring),"Error: Maximum admin level is %d",MaxAdminLevel); return SendClientMessage(playerid,red,Jstring);
}
if(pInfo[id][Logged] == 0) return SendClientMessage(playerid,red,"Error: This player is not loggedIn or not registered!");

getdate(year, month, day);
gettime(hour,minute,second);
switch(level)
{
case 0: LevelName = "Player Status";
case 1: LevelName = ADMIN_LEVEL_1;
case 2: LevelName = ADMIN_LEVEL_2;
case 3: LevelName = ADMIN_LEVEL_4;
case 4: LevelName = ADMIN_LEVEL_3;
case 5: LevelName = ADMIN_LEVEL_5;
default: LevelName = ADMIN_LEVEL_6;
}
format(Jstring,sizeof(Jstring),"You have given %s level: %d (%s) , Date: %d/%d/%d at %d:%d:%d",GetName(id), level, LevelName, day, month, year ,hour, minute, second);
SendClientMessage(playerid,blue,Jstring);
if(level> pInfo[id][pLevel])
{
format(Jstring,sizeof(Jstring),"Administrator %s has given you administrator level: %d (%s) <Promoted on %d/%d/%d at %d:%d:%d>",GetName(playerid), level, LevelName ,day, month, year,hour, minute, second),GameTextForPlayerEx(id,"~B~congratulations !~N~~G~Promoted", 2000, 3);
SendClientMessage(id,lighterblue,Jstring);
format(Jstring,sizeof(Jstring),"[PROMOTED] %s has changed %s's level from %d to %d (%s)",GetName(playerid),GetName(id),pInfo[id][pLevel], level, LevelName);
WriteToLog(Jstring,"LevelChanges");
}
else
{
format(Jstring,sizeof(Jstring),"Administrator %s has set you level: %d <Demoted on %d/%d/%d at %d:%d:%d>",GetName(playerid), level,day, month, year,hour, minute, second),GameTextForPlayerEx(id,"~R~Demoted", 2000, 3);
SendClientMessage(id,red,Jstring);
format(Jstring,sizeof(Jstring),"[DEMOTED] %s has changed %s's level from %d to %d (%s)",GetName(playerid),GetName(id),pInfo[id][pLevel], level, LevelName);
WriteToLog(Jstring,"LevelChanges");
}
pInfo[id][pLevel] = level;
format(Jfile, 100, ACCOUNTS_PATH, GetName(id));
new INI:ACCOUNT = INI_Open(Jfile);
INI_WriteInt(ACCOUNT, "Level", pInfo[id][pLevel]);
INI_Close(ACCOUNT);
return 1;
}
else return ShowMessage(playerid, red, 2);
}
else return ShowMessage(playerid, red, 1);
}
Reply
#2

please put your code into [CODE.]Paste the code here[/CODE.]
Reply
#3

is this

enum PlayerInfo
{
Registered,
Logged,
pLevel,
Banned,
Kills,
Deaths,
Jailed,
Muted,
GodMode,
VGod,
Frozen,
Donator,
Spawned,
Password[130],
Score,
Cash,
Skin,
pAutoLogin,
LoginAttempts,
PingExceeds,
Spec,
#if MoveSystem == true
Move,
#endif
Locked,
Warns,
Hidden,
AHide,
VWorld,
NameTagHidden,
Clicked,
SpamWarns,
AntiCheatWarns,
TempBan,
TotalSecs,
ConnectedTime,
Cars[MAX_CAR_SPAWNS],
SpawnedCars,
LastSpawnedCar,
IP[16],
};

new
AutoLogin,
MustRegister,
DetectPausers,
MaxPing,
AntiSpam,
AntiWeaponHack,
AntiCheatBans,
MaxAdminLevel,
ForbiddenNamesKick,
KickPartNicks,
AntiForbiddenWords,
AntiAdv,
AntiBanEvade,
AdminImmunity,
AllowChangeNick,
PmDialog,
ShowPmstoAdmins,
ReadCommands,
IsDisabledChat,
LTimer,
IllegalWeaponsCount,
IllegalWeapons[MAX_ILLEGAL_WEAPONS],
ForbiddeNicksCount,
ForbiddeNicks[MAX_FORBIDDEN_NAMES][20],
BadPartNicksCount,BadPartID,
BadNickParts[MAX_BADNICKS_PARTS][20],
BadWordsCount,WordSt,WordEn,
ForbiddenWords[MAX_BAD_WORDS][20],
ChatMessages[MAX_CHAT_MSGS_STORE][128],
Reports[MAX_REPORTS_STORE][128],
reconnect[MAX_PLAYERS],
Ftimer[MAX_PLAYERS], //Unfreeze timmer
Jtimer[MAX_PLAYERS], //Unjail timmer
JPlayer[MAX_PLAYERS], //Jail timmer
Mtimer[MAX_PLAYERS], //Unmute timmer
pHideTimer[MAX_PLAYERS]; //This timmer start when an admin use /hideme (raderhide) or /hidename to keep him hide

new pInfo[MAX_PLAYERS][PlayerInfo],
Jstring[128],JLstring[500],
LevelName[30],LevelColor[20],
Specid[MAX_PLAYERS],playerIP[16],
aka[256],Cmdstr[128],CTMSG[128],
AdmName[24],VLstring[850];


/*---------------Account Editor -----------------*/
new RegisteredDate[50],RegisteredIP[16],
LastLoggedIP[16],AdminLevel,
DonatorLevel,AccBanned,AccMuted,
AccScore,AccCash,AccKills,AccDeaths,
AccSkin,AccAutologin,AccTotalSecs,LastSeen[50],AccPlayedTime[50];



if(dialogid == JDIALOGS+26)
{
if(response)
{
if(!IsNumeric(inputtext) || strlen(inputtext) == 0)
{
GetPVarString(playerid, "AccountName", NickName, 24);
format(Jstring, 128, "%s: Change level", NickName);
return ShowPlayerDialog(playerid,JDIALOGS+26,DIALOG_STYLE _INPUT,Jstring,"Enter new Level:\n{FF0000}*Level must be a nemeric value","Save","Back");
}
format(Jstring, 128, "%s: Change level", NickName);
format(string, 128, "Enter new Level:\n{FF0000}*Error: Server maximum admin level is %d", MaxAdminLevel);
if(strval(inputtext) > MaxAdminLevel) return ShowPlayerDialog(playerid,JDIALOGS+26,DIALOG_STYLE _INPUT,Jstring,string,"Save","Back");
GetPVarString(playerid, "AccountName", NickName, 24);
format(Jfile, 100, ACCOUNTS_PATH, NickName);
new INI:ACCOUNT = INI_Open(Jfile);
INI_WriteInt(ACCOUNT, "Level", strval(inputtext));
INI_Close(ACCOUNT);
return AccountEditor(playerid);
}
else return AccountEditor(playerid);
}
Reply
#4

Quote:
Originally Posted by elpana27
Посмотреть сообщение
if(level > MaxAdminLevel)
Find the MaxAdminLevel in your script and define it to the highest level you want.
Reply
#5

#define MaxAdminLevel 10

I defined And this came out



C:\Users\lol\Desktop\zombie\gamemodes\zombie1.pwn( 226) : error 020: invalid symbol name ""
C:\Users\lol\Desktop\zombie\gamemodes\zombie1.pwn( 3285) : error 022: must be lvalue (non-constant)
C:\Users\lol\Desktop\zombie\gamemodes\zombie1.pwn( 4461) : error 022: must be lvalue (non-constant)
C:\Users\lol\Desktop\zombie\gamemodes\zombie1.pwn( 10726) : warning 203: symbol is never used: ""
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


is this

public LoadServerSetttings(name[], value[])
{
INI_Int("AutoLogin", AutoLogin);
INI_Int("DetectPausers", DetectPausers);
INI_Int("MustRegister", MustRegister);
INI_Int("MaxPing", MaxPing);
INI_Int("AntiSpam", AntiSpam);
INI_Int("PmDialog", PmDialog);
INI_Int("AntiWeaponHack", AntiWeaponHack);
INI_Int("MaxLevels", MaxAdminLevel);
INI_Int("ForbiddenNamesKick", ForbiddenNamesKick);
INI_Int("PartNamesKick", KickPartNicks);
INI_Int("AntiBadWords", AntiForbiddenWords);
INI_Int("AntiAdvertisements", AntiAdv);
INI_Int("AntiBanEvade", AntiBanEvade);
INI_Int("AdminImmunity", AdminImmunity);
INI_Int("AdminReadPms", ShowPmstoAdmins);
INI_Int("AdminReadCmds", ReadCommands);
INI_Int("AntiCheatbans", AntiCheatBans);
INI_Int("AllowChangeName", AllowChangeNick);
return 1;
}


stock PrintConfiguration()
{
printf(" [LADMIN] Auto login %d",AutoLogin);
printf(" [Admin] Must register %d",MustRegister);
printf(" [Admin] Detect pausers %d",DetectPausers);
printf(" [Admin] MaxPing %d",MaxPing);
printf(" [Admin] AntiSpam %d",AntiSpam);
printf(" [Admin] PM Dialog %d",PmDialog);
printf(" [Admin] AntiWeaponHack %d",AntiWeaponHack);
printf(" [Admin] MaxAdminLevel %d",MaxAdminLevel);
printf(" [Admin] Anti Bad Words %d",AntiForbiddenWords);
printf(" [Admin] AntiBanEvade %d",AntiBanEvade);
printf(" [Admin] Anti Advertise %d",AntiAdv);
printf(" [Admin] AdminImmunity %d",AdminImmunity);
printf(" [Admin] ShowPmstoAdmins %d",ShowPmstoAdmins);
printf(" [Admin] ReadCommands %d",ReadCommands);
printf(" [Admin] AntiCheatBans %d",AntiCheatBans);
printf(" [Admin] Allow changename %d",AllowChangeNick);
printf(" [Admin] ForbiddenNamesKick %d",ForbiddenNamesKick);
printf(" [Admin] PartNamesKick %d",KickPartNicks);
return 1;
}



stock ServSettings(playerid)
{
new temp[140],Jfile[100];
format(Jfile,sizeof(Jfile),"JLadmin/Settings/settings.cfg");
if(!fexist(Jfile)) return SendClientMessage( playerid, red, "No file/Path found!" );
strdel(VLstring,0,850);
format(temp,sizeof(temp),"Server AutoLogin: %d\nDetect pausers: %d\nMust register: %d\nServer Max Ping: %d\nAnti spam: %d\nAnti weapon hack: %d\n",AutoLogin,DetectPausers,MustRegister,MaxPing ,AntiSpam,AntiWeaponHack);
strcat(VLstring, temp, sizeof(VLstring));
format(temp,sizeof(temp),"Anti bad words: %d\nForbidden names kick: %d\nPart names Kick: %d\nAnti Advertisements: %d\nAnti ban evade: %d\n",AntiForbiddenWords,ForbiddenNamesKick,KickPa rtNicks,AntiAdv,AntiBanEvade);
strcat(VLstring, temp, sizeof(VLstring));
format(temp,sizeof(temp),"Max Admin Levels: %d\nAdmin Immunity: %d\nAdmin Read PMs: %d\nAdmin Read cmds: %d\nPM dialog: %d\nAnti Cheat Bans: %d\nAllow Change Nick: %d\n",MaxAdminLevel,AdminImmunity,ShowPmstoAdmins, ReadCommands,PmDialog,AntiCheatBans,AllowChangeNic k);
strcat(VLstring, temp, sizeof(VLstring));
format(temp,sizeof(temp),"Forbidden Weapons\nForbidden Names\nForbidden Part Nicks\nBad words\nReload Settings");
strcat(VLstring, temp, sizeof(VLstring));
ShowPlayerDialog(playerid,JDIALOGS+52,DIALOG_STYLE _LIST,"Server Settings",VLstring,"Select","Cancel");
strdel(VLstring,0,850);
return 1;
}
Reply
#6

Show us snippets of those lines please, we have never been able to smell your codes

(they weren't here when i asked, you edited your post smh)
Reply
#7

they are there
Reply
#8

Код:
IP[16],
};
This could be your invalid symbol name...
Reply
#9

yes problem solved thank you very much
Reply
#10

Your code is hurting my eyes.

Kindly use [ Pawn ] [ /PAWN ] tag next time and then put your code inside it, makes it a lot easier to understand it.

Cheers and good day.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)