Admin Help [+REP]
#1

Hey all i want do make /makeadmin command
but i useing this tutorial: https://sampforum.blast.hk/showthread.php?tid=253481

i useing
pawn Код:
DCMD
AND SSCANF
Someone?
Reply
#2

I think it would be like this i dont know dcmd but i tried.

pawn Код:
dcmd_makeadmin(playerid, params)
{
new giveid, level;
if(IsPlayerAdmin))
{
if(!sscanf(params,"ui", giveid, level))
{
if(IsPlayerConnected(giveid))
{
PlayerInfo[giveid][pAdminlevel] = level;
}
else SendClientMessage(playerid, -1,"NO connected.");
}
else SendClientMessage(playerid, -1,"/makeadmin [id] [level]");
}
else SendClientMessage(playerid, -1,"You are not an RCON Admin!);
return 1;
}
This is a simple command and i prefer you to use ZCMD its eazy and very powerful and best.
And if you want advanced makeadmin command then tell me i will make it for you.
Reply
#3

His code is a little all over the place, I made it simple and quick.

pawn Код:
//Add admin using variables
dcmd_makeadmin(playerid,params[]);
{
    if(playerInfo[playerid][pAdmin] < 2) return 0;
    new id,lvl,string[100],name[24][2];
    if(sscanf(params,"ii",id,lvl)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /makeadmin (playerid) (level)");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"Invalid playerid.");
    if(lvl >= playerInfo[playerid][pAdmin]) return SendClientMessage(playerid,COLOR_RED,"You cannot set someone to your admin level or higher.");
    if(playerInfo[id][pAdmin] >= playerInfo[playerid][pAdmin]) return SendClientMessage(playerid,COLOR_RED,"You cannot set equal or higher level admins.");
    playerInfo[id][pAdmin] = lvl;
    GetPlayerName(playerid,name[0],sizeof(name[0]));
    GetPlayerName(id,name[1],sizeof(name[1]));
    format(string,sizeof(string),"%s has made you level %d admin.",name[0],lvl);
    SendClientMessage(id,COLOR_WHITE,string);
    format(string,sizeof(string),"You have made %s level %d admin.",name[1],lvl);
    SendClientMessage(playerid,COLOR_WHITE,string);
    return 1;
}
//Add admin as RCON
dcmd_setadmin(playerid,params[]);
{
    if(!IsPlayerAdmin(playerid)) return 0;
    new id,lvl,string[100],name[24][2];
    if(sscanf(params,"ii",id,lvl)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /setadmin (playerid) (level)");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"Invalid playerid.");
    playerInfo[id][pAdmin] = lvl;
    GetPlayerName(playerid,name[0],sizeof(name[0]));
    GetPlayerName(id,name[1],sizeof(name[1]));
    format(string,sizeof(string),"%s has made you level %d admin.",name[0],lvl);
    SendClientMessage(id,COLOR_WHITE,string);
    format(string,sizeof(string),"You have made %s level %d admin.",name[1],lvl);
    SendClientMessage(playerid,COLOR_WHITE,string);
    return 1;
}
Untested, reply if any errors & rep if I helped
Reply
#4

Dude !!! I dont use Level1 i use

pawn Код:
gPlayerInfo[playerid][PLAYER_LEVEL] > 4
I use : https://sampforum.blast.hk/showthread.php?tid=253481
System!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)