Need help with a Command in 0Admin [+Rep]
#1

I have a server, and i always used on it LuxAdmin and my Gamemode.
Some time ago i discovered 0Admin and it's really cool script. I just need help to make a command.
I arleady made lots of commands for it but i just have no idea how to make this one.
I'd like a "/offsetlevel Admin/Vip Level"
So will set the level of the Player when he is offline.
Max Admin level is 5
And max VIP is 3
0Admin uses mysql.
Command should be in zcmd but no prob if it's in any other, i will convert it to zcmd
Thanks
Reply
#2

pawn Код:
CMD:offsetlevel(PARAMS)
{
    LoginCheck(playerid);
    LevelCheck(playerid, 5);
   
    new Account[50], Level;
    if(sscanf(params, "s[50]i", Account, Level)) return SendUsage(playerid, "/offsetlevel [name] [level]", "Will change a player's level position!");
    else
    {
        new DBResult:Result, Query[129];
        format(Query, 129, "SELECT `Level` FROM `Accounts` WHERE `Name` = '%s'", Account);
        Result = DB::Query(_DB, Query);
       
        if(Result)
        {
            if(DB::Valid(Result))
            {
                format(Query, 129, "UPDATE `Accounts` SET `Level` = '%d' WHERE `Name` = '%s'", Level, Account);
                DB::Query(_DB, Query);
                FormatMSG(playerid, Color:GREY,"You promoved "ORAN"%s"GREY" as "ORAN"%s"GREY" of the server", Account, LevelName(Level));
            }
            else
            {
                DB::Free(Result);
                SendError(playerid, "Account not found in the Database!");
                return 1;
            }
        }
       
    }
    return 1;
}
Is only for admins, you can do another for vips...
Reply
#3

Ok thanks a lot i'm gonna try it tonight
And for Vips it should be like that?
Sorry i am not so good yet with account saving and editing
Код:
CMD:offsetviplevel(PARAMS)
{
    LoginCheck(playerid);
    LevelCheck(playerid, 5);
    
    new Account[50], Level;
    if(sscanf(params, "s[50]i", Account, Level)) return SendUsage(playerid, "/offsetviplevel [name] [level]", "Will change a player's level position!");
    else 
    {
        new DBResult:Result, Query[129];
        format(Query, 129, "SELECT `VIP` FROM `Accounts` WHERE `Name` = '%s'", Account);
        Result = DB::Query(_DB, Query);
        
        if(Result)
        {
            if(DB::Valid(Result))
            {
                format(Query, 129, "UPDATE `Accounts` SET `VIP` = '%d' WHERE `Name` = '%s'", Level, Account);
                DB::Query(_DB, Query);
                FormatMSG(playerid, Color:GREY,"You promoved "ORAN"%s"GREY" as "ORAN"%s"GREY" of the server", Account, LevelName(Level));
            }
            else
            {
                DB::Free(Result);
                SendError(playerid, "Account not found in the Database!");
                return 1;
            }
        }
        
    }
    return 1;
}
Reply
#4

Yes, you're right
Reply
#5

Quote:
Originally Posted by aRoach
Посмотреть сообщение
Yes, you're right
Thanks +Rep to you.
Thanks for being fast and for helping, i will try tonight and i'll make you know here or trough a PM.
Thanks again!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)