Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:settemplevel(playerid, params[])
- {
- new lookupid, str[128], level,days;
- if(pData[playerid][Admin] >= 9 || IsPlayerAdmin(playerid))
- {
- if(sscanf(params,"ud",lookupid,level,days)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /setlevel (UserID | UserName) (level) (days)");
- if(pData[lookupid][Admin] > pData[playerid][Admin]) return SendClientMessage(playerid, -1, "Sorry you cant setlevel becoz his level is higher then you");
- if(level == 2 || level > 10 || level == 0) return SendClientMessage(playerid, red, "ERROR: Invalid Level [Levels 3 to 10]"); // you can change this to any level you want
- if(!IsPlayerConnected(lookupid)) return SendClientMessage(playerid,0xFF0000FF, "Sorry this player isnt connected ");
- if(level < pData[lookupid][Admin])
- {
- new irc[130];
- format(irc,sizeof(str),"8,3* Admin %s (ID: %d) Demoted %s (ID: %d) to level %d for %d days",GetName(playerid), playerid,GetName(lookupid),lookupid,level,days);
- IRC_GroupSay(groupID, IRC_CHANNEL, irc);
- format(str, sizeof(str), "Admin %s (ID:%d) has temp demoted you to level %d for %d days",GetName(playerid), playerid, level, days);
- SendClientMessage(lookupid, 0xFF0000FF, str);
- format(str, sizeof(str),"You have demoted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
- SendClientMessage(playerid, -1, str);
- ta = gettime() = days*24*60*60;
- pData[lookupid][Admin] = level;
- if(pData[lookupid][Admin] == 1)
- {
- onlineadmins--;
- new strings[100+1000];
- format(strings, sizeof(strings), "Online Admins: %d",onlineadmins);
- TextDrawSetString(oa, strings);
- TextDrawShowForPlayer(playerid, oa);
- }
- }
- if(level > pData[lookupid][Admin])
- {
- new irc[130];
- format(irc,sizeof(str),"8,3* Admin %s (ID: %d) granted level %d to %s (ID: %d)",GetName(playerid), playerid, level,GetName(lookupid),lookupid);
- IRC_GroupSay(groupID, IRC_CHANNEL, irc);
- format(str, sizeof(str), "* You have been granted permanent Admin Level %d by %s (ID: %d)",level, GetName(playerid), playerid);
- SendClientMessage(lookupid, COLOR_GREEN, str);
- ta = gettime() = days*24*60*60;
- ForEach(i, MAX_PLAYERS)
- {
- if(pData[i][Admin] >= 3)
- {
- format(str,sizeof(str),"* Admin %s (ID: %d) granted permanent Admin level %d to %s (ID: %d)",GetName(playerid),playerid,level,GetName(lookupid),lookupid);
- SendClientMessage(i, 0x00FFC1FF, str);
- }
- }
- format(str, sizeof(str),"You have setted %s (ID:%d) to level %d",GetName(lookupid),lookupid,level);
- SendClientMessage(playerid, COLOR_YELLOW, str);
- if(level >= 3)
- {
- if(pData[lookupid][Admin] < 3){onlineadmins++;}//If not already an admin count ++
- pData[lookupid][Admin] = level;//now set the level
- new strings[100+1000];
- format(strings, sizeof(strings), "Online Admins: %d",onlineadmins);
- TextDrawSetString(oa, strings);
- TextDrawShowForPlayer(playerid, oa);
- }
- }
- printf("Setted level %d",level);
- SavePlayerData(playerid);
- }
- else return SendClientMessage(playerid, COLOR_YELLOW, "Only +level 9 can use this command");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment