Setlevel Command
#1

Hi,

Thanks for taking your time reading this. I'm currently attempting to start up my own server and I'm having some troubles with the following command. I've tried solving it, although I haven't managed to find out what the problem is, and therefore I came here hoping you lads' and gals' could help me out!

Код:
CMD:setlevel(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-4,"Only rcon admins can set admin levels!");//Checking if the player is rcon admin to set an admin level
    new id, level;//Creating the id variable to store the selected id and a level variable for the chosen admin level.
    if(sscanf(params,"ui",id,level)) return SendClientMessage(playerid,-1,"USAGE: /setlevel <id> <level>");//Check if the player inputted a username or id and a admin level.
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-4,"That player is not connected!");//Checking if the selected user is connected or not.
    new file[64],PlayerName[24];//Creating a variable to store the file path, and a variable to store the players name.
    GetPlayerName(id,PlayerName,sizeof PlayerName);//Retrieving the selected id's name,
    format(file,sizeof file,"Admin/%s.ini",PlayerName);
    if(!fexist(file)) return SendClientMessage(playerid,-4,"The specified player is currently not registered");//Checking if the player is not registered
    PlayerInfo[id][Level] = level;
    SendClientMessage(playerid,-1,"You have successfully changed the selected user's admin level");
    SendClientMessage(id,-1,"Your admin level has successfully been changed, congratulations!");
    return 1;
}
Cheers!
Reply
#2

Mid actually telling us what the problem is..?
Reply
#3

Haha, yeah. I went to take a piss and realized I forgot to tell you, . It gives me the following error, which is quite annoying really as I clearly am the only one online.

Код:
That player is not connected!
Cheers!

P.S: I get no errors whatsoever when I compile the script.
Reply
#4

Update both sscanf plugin and include to their latest version, re-compile, start the server and try again.
Reply
#5

Thanks.
Reply
#6

I got this

C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\gamemodes\New3.pwn(1183) : warning 217: loose indentation
C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\gamemodes\New3.pwn(1187) : error 017: undefined symbol "sscanf"
C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\gamemodes\New3.pwn(1193) : error 017: undefined symbol "PlayerInfo"
C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\gamemodes\New3.pwn(1193) : warning 215: expression has no effect
C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\gamemodes\New3.pwn(1193) : error 001: expected token: ";", but found "]"
C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\gamemodes\New3.pwn(1193) : error 029: invalid expression, assumed zero
C:\Users\ўггелпт\Desktop\samp037_svr_R2-1-1_win32\gamemodes\New3.pwn(1193) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)