Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:setadmin(playerid, params[])
- {
- if(IsPlayerConnected(playerid))
- {
- if(PlayerInfo[playerid][pAdmin] >= 6)
- {
- new id,adminlevel,sendername[30],giveplayer[30],string[200];
- if(sscanf(params, "ui",id,adminlevel)) return SendClientMessage(playerid, 0xFFFFFFFF, "{AB0000}Syntax: {FFFFFF}/setadmin <Name/Playerid> <Admin Level>");
- if(IsPlayerConnected(id))
- {
- if(id != INVALID_PLAYER_ID)
- {
- GetPlayerName(id, giveplayer, sizeof(giveplayer));
- GetPlayerName(playerid, sendername, sizeof(sendername));
- if(PlayerInfo[id][pAdmin] < adminlevel)
- {
- format(string, sizeof(string), "You've been promoted to level %d admin, by %s.", adminlevel, sendername);
- SendClientMessage(id, COLOR_YELLOW, string);
- format(string, sizeof(string), "You've promoted %s to a level %d admin.", giveplayer, adminlevel);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- }
- else
- {
- format(string, sizeof(string), "You've been demoted to level %d admin, by %s.", adminlevel, sendername);
- SendClientMessage(id, COLOR_YELLOW, string);
- format(string, sizeof(string), "You've demoted %s to a level %d admin.", giveplayer, adminlevel);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- }
- format(string, sizeof(string), "* Admin %s set %s's admin level to %d.", sendername,giveplayer,adminlevel);
- AdmChat(COLOR_ADMCHAT,string,1);
- PlayerInfo[id][pAdmin] = adminlevel;
- Update(playerid, pAdmin);
- new str[256];
- mysql_format(handle,str,sizeof(str),"UPDATE users SET `Admin`='%d' WHERE `Name`='%s'",PlayerInfo[id][pAdmin], GetName(playerid));
- mysql_tquery(handle,str,"","");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_WHITE,"Error: Player not connected.");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement