SA-MP Forums Archive
SetLevel command | Problem [+REPP] - 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 | Problem [+REPP] (/showthread.php?tid=563932)



SetLevel command | Problem [+REPP] - NoDi522 - 18.02.2015

Hello.

I have a problem with zcmd command "setlevel". I made it and it give me some errors:

Command:
PHP код:
COMMAND:setlevel(playerid,params[])
{
   new 
id,level,msg[128],name[MAX_PLAYER_NAME];
   if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"Error: Nemate dozvolu za tu komandu.");
   else
   {
       if(
sscanf(params,"ud",id,level)) return SendClientMessage(playerid0xFFFFFF,"Koristenje: /setlevel (Ime/ID) (Level)");
       else if(
level 5) return SendClientMessage(playerid0xFFFFFF,"Error: Maximalni level admin je 5.");
       else
       {
           
PlayerInfo[id][pAdministrator] = level;
           
format(msg,sizeof(msg),"Cestitamo! Sada ste admin na levelu %d",level);
           
SendClientMessage(id,0xFFFFFF,msg);
           
GetPlayerName(id,name,sizeof(name));
           
format(msg,sizeof(msg),"Postavili ste admina %s na levelu %d"name,level);
           
SendClientMessage(playerid,0xFFFFFF,msg);
       }
    }
    return 
1;

Error:
PHP код:
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(87) : error 017undefined symbol "PlayerInfo"
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(96) : warning 217loose indentation
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Error

My enum:
PHP код:
enum pInfo
{
    
pPassword,
    
pNovac,
    
pAdministrator,
    
pUbojstva,
    
pBankNovac,
    
pSmrti
}
new 
PlayerInfo[MAX_PLAYERS][pInfo]; 
Includes:
PHP код:
#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf2> 
If u can help me i would really like to +REPP you!


Re: SetLevel command | Problem [+REPP] - HazardouS - 18.02.2015

Here:
pawn Код:
enum pInfo
{
    pPassword,
    pNovac,
    pAdministrator,
    pUbojstva,
    pBankNovac,
    pSmrti
};
new PlayerInfo[MAX_PLAYERS][pInfo];
You forgot the ";" at the end of the enum, before "new PlayerInfo".


Re: SetLevel command | Problem [+REPP] - NoDi522 - 18.02.2015

Still gives me the same error.


Re: SetLevel command | Problem [+REPP] - HazardouS - 18.02.2015

Make sure you declared the "new PlayerInfo" and the enum BEFORE the command.


Re: SetLevel command | Problem [+REPP] - NoDi522 - 18.02.2015

Now helped but when i launch the game and try "setlevel" nothing shows up?


Re: SetLevel command | Problem [+REPP] - HazardouS - 18.02.2015

Remove OnPlayerCommandText callback and add the following instead:
pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
return 1;
}
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
return 1;
}



Re: SetLevel command | Problem [+REPP] - NoDi522 - 18.02.2015

Again the same thing! :/


Re: SetLevel command | Problem [+REPP] - HazardouS - 18.02.2015

Place the command(s) AFTER these 2 callbacks and try again. If it's still not working, read a tutorial on how to create zcmd commands.


Re: SetLevel command | Problem [+REPP] - NoDi522 - 18.02.2015

You mean at the end of the script?


Re: SetLevel command | Problem [+REPP] - Gammix - 18.02.2015

Make sure you are not using any 2nd party filterscript or any include which uses OnPlayerCommandText.
That basically stops zcmd to work.