/makeadmin Command! help = +1
#1

Hello i am in need of help within the administration section!
I need the /makeadmin command for my NON-MYSQL Gamemode!

Quote:

enum PlayerInfo
{
Pass[129],
pAdmin,
pMoney,
pLevels
}
new pInfo[MAX_PLAYERS][PlayerInfo];

My enums ^
Please help +1 for helping me!
Reply
#2

pawn Код:
CMD:makeadmin(playerid,params[])
{
new targetid,level,string[120];
if(sscanf(params,"ui",targetid,level)) return SendClientMessage(playerid,-1,"[ERROR] /makeadmin [targetid][level]");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"[ERROR] You are not an admin.");
if(level < 0 || level > 5) return SendClientMessage(playerid,-1,"[ERROR] Only level 0-5");
pInfo[targetid][pAdmin] = level;
format(string,sizeof(string),"[ADMIN] %s[%d] has set your level to:%d",GetName(playerid),playerid,level);
SendClientMessage(targetid,-1,string);
return 1;
}
Getname function:
pawn Код:
stock GetName(playerid)
{
    new pName[68];
    GetPlayerName(playerid, (pName), sizeof(pName));
    return pName;
}
make sure you have zcmd and sscanf.
Reply
#3

Thanks man you are a true boss!

Could anyone make me a /makemod please, i have added a pMod to my enums!
Reply
#4

This isn't actually a thread where you need help with, it's more like a request thread. If you're going to request commands you should probably post a thread in the proper section.
Reply
#5

for pMod just change pAdmin to pMod change command name and text that you want
Reply
#6

pawn Код:
CMD:makemod(playerid,params[])
{
new target,
        level,
        name[MAX_PLAYER_NAME],
        string[120]; //Assigning variables
       GetPlayerName(playerid, name, sizeof(name));
       if(sscanf(params, "ui" ,target,level)) return                                                        SendClientMessage(playerid,-1, "[Usage] : /makemod [playerid] [level]");
       if(!IsPlayerAdmin(playerid)) return    SendClientMessage(playerid,-1, "[ERROR] You are not an admin." );
       pInfo[target][pMod] = level;
      format (string, sizeof(string), "[ADMIN] %s has set your level to:%d", name, level);
       SendClientMessage(target,-1,string);
       return true;
}
Here is the /makemod command. Hope you learned.
Reply
#7

Quote:
Originally Posted by SanAndreasMP
Посмотреть сообщение
pawn Код:
CMD:makemod(playerid,params[])
{
new target,
        level,
        name[MAX_PLAYER_NAME],
        string[120]; //Assigning variables
       GetPlayerName(playerid, name, sizeof(name));
       if(sscanf(params, "ui" ,target,level)) return                                                        SendClientMessage(playerid,-1, "[Usage] : /makemod [playerid] [level]");
       if(!IsPlayerAdmin(playerid)) return    SendClientMessage(playerid,-1, "[ERROR] You are not an admin." );
       pInfo[target][pMod] = level;
      format (string, sizeof(string), "[ADMIN] %s has set your level to:%d", name, level);
       SendClientMessage(target,-1,string);
       return true;
}
Here is the /makemod command. Hope you learned.
Why did you do this :

Quote:

if(sscanf(params, "ui" ,target,level)) return
if you haven't returned anything? You could've just done this:

pawn Код:
sscanf(params, "ui", target, level);

EDIT: Oops, cuz of this bugged shit I didn't see you've returned a client message..
It was all the way to the right and I didn't notice it, completely ignore this comment now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)