/makeadmin command usable for all players -
Zimon95 - 23.12.2009
Hello

, I have a problem, how can I make this command usable for all players? I'm using the LA-RP gamemode.
Код:
if(strcmp(cmd, "/makeadmin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level(1-3)]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s", level, sendername);
SendClientMessage(para1, COLOR_WHITE, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
return 1;
}
Thanks, Zimon95.
Re: /makeadmin command usable for all players -
JoeDaDude - 23.12.2009
Why would you want that for all players?
They could do anything
Re: /makeadmin command usable for all players -
Zimon95 - 23.12.2009
I need this command for emergency situations, and I will also change the /makeadmin with a complex command like /qwieq591kg (XD)
Re: /makeadmin command usable for all players -
Ironboy500 - 23.12.2009
I guess he mean only for admins, lol. If is like than use
Код:
if(PlayerInfo[playerid][AdminLevel] >= 1)
Just change this to your defines.
Re: /makeadmin command usable for all players -
Ironboy500 - 23.12.2009
For all players just change from 1 to 0.
Re: /makeadmin command usable for all players -
Zimon95 - 23.12.2009
I tryed to set 0 but it didin't worked.
Re: /makeadmin command usable for all players -
Ironboy500 - 23.12.2009
Errors in compiling?
Re: /makeadmin command usable for all players -
Zimon95 - 23.12.2009
No, no errors in compiling...
Re: /makeadmin command usable for all players -
Ironboy500 - 23.12.2009
Can I see cmd again, after you added If(PlayerInfo[playerid][AdminLevel] == 0)
Re: /makeadmin command usable for all players -
Zimon95 - 23.12.2009
Here's the cmd:
Код:
if(PlayerInfo[playerid][pAdmin] >= 0)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pAdmin] = level;
printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
format(string, sizeof(string), " You have been promoted to a level %d admin by %s", level, sendername);
SendClientMessage(para1, COLOR_WHITE, string);
format(string, sizeof(string), " You have promoted %s to a level %d admin.", giveplayer,level);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}
return 1;
}