PDA

View Full Version : /makeadmin cmd using ZCMD


StevenLV
10/05/2019, 03:48 AM
I am using this cmd so it says you must create admin account, once i create one it says u mmust be admin to create aadmmin account.. lolz. I want you to change this cmd to RCON Loginned guy so someone who logs in with rcon can use this cmd. thanks yoou, the variables functions are used plz use the same way so it dont affect game. thanks :)

COMMAND:makeadmin(playerid, params[])
{
new targetid,type,string[128],sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
if(sscanf(params, "ui", targetid, type)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [playerid] [level 0-11]");
else
{
if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
if(!AdminUser(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to create a admin user, /admincreate.");
if(GetPVarInt(playerid, "AdminLogged") == 0) return SendClientMessage(playerid, COLOR_GREY, "You need to login into your admin account, /adminlogin.");
if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "This player is not connected !");
if(type < 0 || type > 11) return SendClientMessage(playerid, COLOR_GREY, "Cannot go under 0 or above 11.");
if(GetPVarInt(playerid, "Admin") >= 10 || IsPlayerAdmin(playerid))
{
format(sendername, sizeof(sendername), "%s", PlayerName(playerid));
format(giveplayer, sizeof(giveplayer), "%s", PlayerName(targetid));
GiveNameSpace(sendername);
GiveNameSpace(giveplayer);
new pdtxt[50];
if(type > GetPVarInt(targetid, "Admin")) pdtxt="promoted";
if(type < GetPVarInt(targetid, "Admin")) pdtxt="demoted";
if(GetPVarInt(playerid, "Admin") >= 11) sendername = "Hidden";
SetPVarInt(targetid, "Admin", type);
format(string, sizeof(string),"AdmCmd: %s has %s %s to Admin-Level %d.", sendername, pdtxt, giveplayer, type);
SendAdminMessage(COLOR_YELLOW,string);
if(type <= 0)
{
format(string, sizeof(string), "users/admins/%s.ini", PlayerName(targetid));
DOF2_RemoveFile(string);
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You do not have access to this command !");
}
}
return 1;
}

SiaReyes
10/05/2019, 07:27 AM
if(!AdminUser(playerid) && !IsPlayerAdmin(playerid))
return SendClientMessage(playerid, COLOR_GREY, "You need to login into RCON or your admin account /adminlogin!");

Use this at top of the command and remove the line if(!AdminUser(playerid)) return....