/setadmin problem
#1

Hello, i have recently made a command which makes a person admin is you /setadmin [ID] [ LEVEL ]

But when im in game and type /setadmin 0 1

It says " That user is not connected " but ID 0 is me


Im really confused here is the command


If you need any other part of the code just reply

If i have included

Код:
#include <zcmd>
#include <sscanf2>
Код:
CMD:setadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))return 0; //This command only works for rcon
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setadmin [ID] [Level 1-4]");//it will show this if you dont use the format properly
    if(levels > 5) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-5!");//Available levels
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_PURPLE,"That user is not connected.");//Detect if the id/partofname is connected
    if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has your Admin level to %d on the server. *cry *cry",Nam,levels);
        SendClientMessage(ID,0xFF9900AA,str);
        format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
        SendClientMessage(playerid,0xFF9900AA,str);
        PlayerData[ID][AdminLevel] = levels;//this sets the player level
        return 1;
    }
    format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
    SendClientMessage(ID,0xFF9900AA,str);
    format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
    SendClientMessage(playerid,0xFF9900AA,str);
    PlayerData[ID][AdminLevel] = levels;
    return 1;
}
Reply
#2

Well...How do you want to set yourself as an admin if you're not admin yet :S.And try setting yourself as admin from database
Reply
#3

Do you have the latest sscanf?
There was a bug with the 'u' specifier which ****** fixed yesterday.
Reply
#4

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
Well...How do you want to set yourself as an admin if you're not admin yet :S.And try setting yourself as admin from database
I have not set up a MySQL database, is that required ?
Reply
#5

Quote:
Originally Posted by blank.
Посмотреть сообщение
Do you have the latest sscanf?
There was a bug with the 'u' specifier which ****** fixed yesterday.
I have that

#include <sscanf2>
Reply
#6

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
Well...How do you want to set yourself as an admin if you're not admin yet :S.And try setting yourself as admin from database
The command works on RCon admins as seen, how is that even related?
@OP
Verify you have the latest sscanf please.
EDIT:
The plugin, I meant.
Reply
#7

:S MySQL database is quite hard,you should start with dini if you're a beginner
Reply
#8

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
:S MySQL database is quite hard,you should start with dini if you're a beginner
I am starting with dini


These are my server includes


Код:
#include <a_samp>
#include <streamer>
#include <zcmd>
#include <foreach>
#include <sscanf2>
#include <YSI\y_ini>
Reply
#9

Please Help
Reply
#10

Download dini(just type in ****** SAMP dini include) place it in the include folder and on top of your gamemode #include <dini>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)