/makeadmin Command! help = +1 -
MrCallum - 12.09.2014
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!
Re: /makeadmin Command! help = +1 -
Eth - 12.09.2014
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.
Re: /makeadmin Command! help = +1 -
MrCallum - 12.09.2014
Thanks man you are a true boss!
Could anyone make me a /makemod please, i have added a pMod to my enums!
Re: /makeadmin Command! help = +1 -
SickAttack - 12.09.2014
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.
Re: /makeadmin Command! help = +1 -
AroseKhanNiazi - 13.09.2014
for pMod just change pAdmin to pMod change command name and text that you want
Re: /makeadmin Command! help = +1 -
SanAndreasMP - 13.09.2014
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.
Re: /makeadmin Command! help = +1 -
Ox1gEN - 13.09.2014
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.