PDA

View Full Version : /makeadmin


ChristianIvann09
04/04/2014, 10:15 AM
When im a Level 99998 admin and i tried to make players 99999 admin. It will return SendClientMessage(playerid,COLOR_WHITE, "You cannot make players 99999 Admin. Only Server Owner can do that!");

But how can i do that?

Here is my /makeadmin code

CMD:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 99998)
{

new
iAdminValue,
iTargetID;

if(sscanf(params, "ui", iTargetID, iAdminValue)) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Moderator[1], Junior Admin[2], General Admin[3], Senior Admin[4], Head Admin[1337]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Manager[1338], Server Co-Owner[99998], Server Owner[99999]");
}
else if(IsPlayerConnected(iTargetID))
{
new
szMessage[47 + (MAX_PLAYER_NAME * 2)];

PlayerInfo[iTargetID][pAdmin] = iAdminValue;
format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 2);
format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
}
else SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}

Thanks in advance!

Mriss
04/04/2014, 10:18 AM
When im a Level 99998 admin and i tried to make players 99999 admin. It will return SendClientMessage(playerid,COLOR_WHITE, "You cannot make players 99999 Admin. Only Server Owner can do that!");

But how can i do that?

Here is my /makeadmin code

CMD:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 99998)
{

new
iAdminValue,
iTargetID;

if(sscanf(params, "ui", iTargetID, iAdminValue)) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Moderator[1], Junior Admin[2], General Admin[3], Senior Admin[4], Head Admin[1337]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Manager[1338], Server Co-Owner[99998], Server Owner[99999]");
}
else if(IsPlayerConnected(iTargetID))
{
new
szMessage[47 + (MAX_PLAYER_NAME * 2)];

PlayerInfo[iTargetID][pAdmin] = iAdminValue;
format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 2);
format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
}
else SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}

Thanks in advance!

Why would a Lower Level Admin be able to make Admins Higher level than themself?

ChristianIvann09
04/04/2014, 10:28 AM
Why would a Lower Level Admin be able to make Admins Higher level than themself?

Thats why i need your help when im the 99998 admin i cant make players 99999 admin even theirself cant make 99999 admin

biker122
04/04/2014, 11:05 AM
Simple mistake.

if(PlayerInfo[playerid][pAdmin] >= 99998)

It means if the player level is more than or equal to 99998, you cannot use it.
> - More. < - Less
Just change it to

if(PlayerInfo[playerid][pAdmin] <= 99998)

and you're done! :)
and also, if you want a 99998'th level admin to use this command, then use this

if(PlayerInfo[playerid][pAdmin] < 99998)

JUST CHANGE THAT LINE and you're done! ;)

Bingo
04/04/2014, 11:14 AM
Simple mistake.

if(PlayerInfo[playerid][pAdmin] >= 99998)

It means if the player level is more than or equal to 99998, you cannot use it.
> - More. < - Less
Just change it to

if(PlayerInfo[playerid][pAdmin] <= 99998)

and you're done! :)
and also, if you want a 99998'th level admin to use this command, then use this

if(PlayerInfo[playerid][pAdmin] < 99998)

JUST CHANGE THAT LINE and you're done! ;)

Yes, This same was explained by me in another thread of him, But i dont know how he is reading.


Firstly you need to set yourself as 99999 this can be done through scriptfiles/account whatever your directory is, You cant use if you are 99998 too.

Because in script we defined :-
if(PlayerInfo[playerid][pAdmin] >= 99998)

If player is having greater than 99998 can use this command, Even if you are 99998 you can't use this cmd even though you are logged in as RCON because you need to be greater than 99998 and ie; 99999.

And change > to < and you are done.

BigBrainAFK
04/04/2014, 11:16 AM
who need 99999 adminlevels?

ChandraLouis
04/04/2014, 11:19 AM
Show me your OnPlayerDisconnect Code

biker122
04/04/2014, 11:20 AM
who need 99999 adminlevels?

Why do you even care about it? It's his wish..

@ChandraLouis : I hope I've given him a solution to use that command.

Bingo
04/04/2014, 11:21 AM
who need 99999 adminlevels?

Haha!

Its not that as you thought.

Not:- /makeadmin [id] [1-99999]

Normaly levels maybe 5,6,10 but here we used 99999 to get full immunities.

ChuckyBabe
04/04/2014, 11:41 AM
Here's the code

CMD:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 99999)
{

new
iAdminValue,
iTargetID;

if(sscanf(params, "ui", iTargetID, iAdminValue)) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Moderator[1], Junior Admin[2], General Admin[3], Senior Admin[4], Head Admin[1337]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Manager[1338], Server Co-Owner[99998], Server Owner[99999]");
}
else if(IsPlayerConnected(iTargetID))
{
new
szMessage[47 + (MAX_PLAYER_NAME * 2)];

PlayerInfo[iTargetID][pAdmin] = iAdminValue;
format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 2);
format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
}
else SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "You are a fucker! You can't do this !");
return 1;
}

+rep if i help

ChristianIvann09
04/04/2014, 12:51 PM
Guys -_-

Thats not WHAT I MEAN

I mean if im actually have the 99998 Admin Rank. I cannot make players 99999 Admin. It will return SendClientMessage(playerid, COLOR_WHITE, "You can't set players admin level to 99999. Only Server Owner can do it!");

Like that

biker122
04/04/2014, 03:34 PM
Use this
CMD:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 99998) return SendClientMessage(playerid,COLOR_GRAD1, "You are not authorized to use that command!");
new
iAdminValue,
iTargetID;

if(!IsPlayerConnected(iTargetID)) return SendClientMessage(playerid,COLOR_GRAD2,"Invalid player specified.");
if(sscanf(params, "ui", iTargetID, iAdminValue)) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Moderator[1], Junior Admin[2], General Admin[3], Senior Admin[4], Head Admin[1337]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Manager[1338], Server Co-Owner[99998], Server Owner[99999]");
}

new
szMessage[47 + (MAX_PLAYER_NAME * 2)];
PlayerInfo[iTargetID][pAdmin] = iAdminValue;
format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 2);
format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
return 1;
}

Not tested, But it should work.

ChristianIvann09
05/04/2014, 03:30 AM
Use this
CMD:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 99998) return SendClientMessage(playerid,COLOR_GRAD1, "You are not authorized to use that command!");
new
iAdminValue,
iTargetID;

if(!IsPlayerConnected(iTargetID)) return SendClientMessage(playerid,COLOR_GRAD2,"Invalid player specified.");
if(sscanf(params, "ui", iTargetID, iAdminValue)) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Moderator[1], Junior Admin[2], General Admin[3], Senior Admin[4], Head Admin[1337]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Manager[1338], Server Co-Owner[99998], Server Owner[99999]");
}

new
szMessage[47 + (MAX_PLAYER_NAME * 2)];
PlayerInfo[iTargetID][pAdmin] = iAdminValue;
format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 2);
format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
return 1;
}

Not tested, But it should work.

NOOO!

Not like that!!

Like this:
When im the 99998 admin i cannot make players 99999 admin. In short only 99999 admin can make players 99999 admin

ChuckyBabe
05/04/2014, 03:40 AM
NOOO!

Not like that!!

Like this:
When im the 99998 admin i cannot make players 99999 admin. In short only 99999 admin can make players 99999 admin

LoL this is a simple problem and you are making this problem very big you can just simply make this command for only lvl 99999 and not for 99998 ...

SickAttack
05/04/2014, 03:49 AM
This is what you want right?


CMD:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 99998) return SendClientMessage(playerid,COLOR_GRAD1, "You are not authorized to use that command!");
new iAdminValue, iTargetID;
if(!IsPlayerConnected(iTargetID)) return SendClientMessage(playerid,COLOR_GRAD2,"Invalid player specified.");
if(sscanf(params, "ui", iTargetID, iAdminValue))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Moderator[1], Junior Admin[2], General Admin[3], Senior Admin[4], Head Admin[1337]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Manager[1338], Server Co-Owner[99998], Server Owner[99999]");
return 1;
}
if(PlayerInfo[playerid][pAdmin] == 99998 && iAdminValue > 99998)
{
SendClientMessage(playerid, COLOR_WHITE, "You can't set players admin level to 99999. Only Server Owner can do it!");
return 1;
}
new szMessage[47 + (MAX_PLAYER_NAME * 2)];
PlayerInfo[iTargetID][pAdmin] = iAdminValue;
format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 2);
format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
return 1;
}

Dignity
05/04/2014, 03:50 AM
EDIT: More useful reply above, edited my code out for the sake of you progressing and not using bad code.

ChristianIvann09
05/04/2014, 03:54 AM
Is this what you want?


CMD:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 99998) return SendClientMessage(playerid,COLOR_GRAD1, "You are not authorized to use that command!");
new iAdminValue, iTargetID;
if(!IsPlayerConnected(iTargetID)) return SendClientMessage(playerid,COLOR_GRAD2,"Invalid player specified.");
if(sscanf(params, "ui", iTargetID, iAdminValue))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Moderator[1], Junior Admin[2], General Admin[3], Senior Admin[4], Head Admin[1337]");
SendClientMessageEx(playerid, COLOR_GRAD1, "Server Manager[1338], Server Co-Owner[99998], Server Owner[99999]");
return 1;
}
if(PlayerInfo[playerid][pAdmin] == 99998 && iAdminValue > 99998)
{
SendClientMessage(playerid, COLOR_WHITE, "You can't set players admin level to 99999. Only Server Owner can do it!");
return 1;
}
new szMessage[47 + (MAX_PLAYER_NAME * 2)];
PlayerInfo[iTargetID][pAdmin] = iAdminValue;
format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 2);
format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
return 1;
}

YESSSSSSSSSSSSSSSSSSSS! EXATCLY
I will test it!! tahnk you