SetLevel command | Problem [+REPP]
#1

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!
Reply
#2

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".
Reply
#3

Still gives me the same error.
Reply
#4

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

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

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

Again the same thing! :/
Reply
#8

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.
Reply
#9

You mean at the end of the script?
Reply
#10

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


Forum Jump:


Users browsing this thread: 3 Guest(s)