undefined symbol "cmd_setadmin"
#1

I tried to make setadmin command but i have these errors.

Код:
C:\Documents and Settings\user\Desktop\server samp\gamemodes\testserver.pwn(1611) : error 029: invalid expression, assumed zero
C:\Documents and Settings\user\Desktop\server samp\gamemodes\testserver.pwn(1611) : error 017: undefined symbol "cmd_setadmin"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\testserver.pwn(1611) : error 029: invalid expression, assumed zero
C:\Documents and Settings\user\Desktop\server samp\gamemodes\testserver.pwn(1611) : fatal error 107: too many error messages on one line

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


4 Errors.
Here is the code:

Код:
CMD:setadmin(playerid, params[])
    {
        if(!IsPlayerAdmin(playerid))return 0;
        if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid, COLOR, ""RED"USAGE:/setadmin [ID] [Level 1-5]");
        if(levels > 5) return SendClientMessage(playerid, COLOR_SEAGREEN,"LEVELS AVAILABLE 1-4!");
        if(!IsPlayerConnected(ID))return SendClientMessage(playerid, COLOR,""RED"That user is not connected.");
        if(PlayerInfo[ID][pAdmin] == levels) return SendClientMessage(playerid, COLOR, ""RED"[Warning]:That person is already admin!");
        GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
        GetPlayerName(ID,tname,MAX_PLAYER_NAME);
        if(levels == 0)
        {
            format(string, sizeof(string),""GREEN"%s has given you Admin level %d.",Nam,levels);
            SendClientMessage(ID, COLOR,string);
            format(str, sizeof(str),""GREEN"You have given %s Admin level %d!",tname,levels);
            SendClientMessage(playerid, COLOR,string);
            PlayerInfo[ID][pAdmin] = levels;
            return 1;
        }
        format(string, sizeof(string),""GREEN"%s has given you Admin level %d.",Nam,levels);
        SendClientMessage(ID, COLOR,string);
        format(string, sizeof(string),""GREEN"You have given %s Admin level %d!",tname,levels);
        SendClientMessage(playerid, COLOR,string);
        PlayerInfo[ID][pAdmin] = levels;
        return 1;
    }
I have include zcmd but still these errors.
Reply
#2

Someonee /
Reply
#3

Okay i made it.Sorry for the double post but i have a new question how to make the commadn for admins not for Rcon admin??
Reply
#4

your writing that command in zcmd format, so check if you got #include<zcmd> in your script.
Reply
#5

Quote:
Originally Posted by IvancheBG
Посмотреть сообщение
Okay i made it.Sorry for the double post but i have a new question how to make the commadn for admins not for Rcon admin??
Hi!
Well, that's pretty easy, but I don't know how your admin-level is defined in your enum!
Here is the command:

PHP код:
CMD:setadmin(playeridparams[])
    {
        if(
PlayerInfo[playerid][pAdmin] >= 5//As I said, idk how your adminlevel is defined in your enum, mine is "pAdmin"
        
if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playeridCOLOR""RED"USAGE:/setadmin [ID] [Level 1-5]");
        if(
levels 5) return SendClientMessage(playeridCOLOR_SEAGREEN,"LEVELS AVAILABLE 1-4!");
        if(!
IsPlayerConnected(ID))return SendClientMessage(playeridCOLOR,""RED"That user is not connected.");
        if(
PlayerInfo[ID][pAdmin] == levels) return SendClientMessage(playeridCOLOR""RED"[Warning]:That person is already admin!");
        
GetPlayerName(playerid,NamMAX_PLAYER_NAME);
        
GetPlayerName(ID,tname,MAX_PLAYER_NAME);
        if(
levels == 0)
        {
            
format(stringsizeof(string),""GREEN"%s has given you Admin level %d.",Nam,levels);
            
SendClientMessage(IDCOLOR,string);
            
format(strsizeof(str),""GREEN"You have given %s Admin level %d!",tname,levels);
            
SendClientMessage(playeridCOLOR,string);
            
PlayerInfo[ID][pAdmin] = levels;
            return 
1;
        }
        
format(stringsizeof(string),""GREEN"%s has given you Admin level %d.",Nam,levels);
        
SendClientMessage(IDCOLOR,string);
        
format(stringsizeof(string),""GREEN"You have given %s Admin level %d!",tname,levels);
        
SendClientMessage(playeridCOLOR,string);
        
PlayerInfo[ID][pAdmin] = levels;
        else return 
SendClientMessage(playeridCOLOR_RED,"You have to be level 5 to use that command!");
        return 
1;
    } 
Hope I could help!
Reply
#6

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
Hi!
Well, that's pretty easy, but I don't know how your admin-level is defined in your enum!
Here is the command:

PHP код:
CMD:setadmin(playeridparams[])
    {
        if(
PlayerInfo[playerid][pAdmin] >= 5//As I said, idk how your adminlevel is defined in your enum, mine is "pAdmin"
        
if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playeridCOLOR""RED"USAGE:/setadmin [ID] [Level 1-5]");
        if(
levels 5) return SendClientMessage(playeridCOLOR_SEAGREEN,"LEVELS AVAILABLE 1-4!");
        if(!
IsPlayerConnected(ID))return SendClientMessage(playeridCOLOR,""RED"That user is not connected.");
        if(
PlayerInfo[ID][pAdmin] == levels) return SendClientMessage(playeridCOLOR""RED"[Warning]:That person is already admin!");
        
GetPlayerName(playerid,NamMAX_PLAYER_NAME);
        
GetPlayerName(ID,tname,MAX_PLAYER_NAME);
        if(
levels == 0)
        {
            
format(stringsizeof(string),""GREEN"%s has given you Admin level %d.",Nam,levels);
            
SendClientMessage(IDCOLOR,string);
            
format(strsizeof(str),""GREEN"You have given %s Admin level %d!",tname,levels);
            
SendClientMessage(playeridCOLOR,string);
            
PlayerInfo[ID][pAdmin] = levels;
            return 
1;
        }
        
format(stringsizeof(string),""GREEN"%s has given you Admin level %d.",Nam,levels);
        
SendClientMessage(IDCOLOR,string);
        
format(stringsizeof(string),""GREEN"You have given %s Admin level %d!",tname,levels);
        
SendClientMessage(playeridCOLOR,string);
        
PlayerInfo[ID][pAdmin] = levels;
        else return 
SendClientMessage(playeridCOLOR_RED,"You have to be level 5 to use that command!");
        return 
1;
    } 
Hope I could help!
The problem wasn't if the command worked or if not. It's clearly that he haven't include the zcmd at his script.
pawn Код:
#include < a_samp >
#include < zcmd >
// Rest
Reply
#7

Like they said, include the zcmd on your gamemode, in case you don't have it, here you go;
https://sampforum.blast.hk/showthread.php?tid=91354
Reply
#8

@Dwane & Toreno

Quote:
Originally Posted by IvancheBG
Посмотреть сообщение
Okay i made it.Sorry for the double post but i have a new question how to make the commadn for admins not for Rcon admin??
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

First read, then talk!
Reply
#9

@Twisted_Insane, they didn't see it.

@IvancheBG to make a admin not for rcon first create a enum for adminlevel
it will be something like

pawn Код:
enum pInfo
{
     adminlevel,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
then you can now use this

pawn Код:
if(PlayerInfo[playerid][adminlevel] > /* Putthelevelyouwant*/) //checks if you are admin
{
       //codes
}
else return //codes - this will block the player that are not admin
i'm not good at explaining you can find more information about this in a Register/Login tutorial
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)