15.09.2012, 15:55
Quote:
enum pInfo { pLeader, pRank, pMember }; new PlayerInfo[MAX_PLAYERS][pInfo]; Making somebody a leader. (Took from my script) CMD:makeleader(playerid, params[]) { if (PlayerInfo[playerid][pAdmin] >= 5) { new string[128], giveplayerid, faction; if(sscanf(params, "ud", giveplayerid, faction)) { SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeleader [playerid] [factionid]"); SendClientMessageEx(playerid, COLOR_LIGHTGREEN, "|1 LSPD |2 FBI |3 FDSA |4 SAAS"); return 1; } if(faction > 13 || faction < 0) { SendClientMessageEx(playerid, COLOR_YELLOW, "Don't go below number 0 or above number 4!"); return 1; } if(IsPlayerConnected(giveplayerid)) { new ftext[30]; PlayerInfo[giveplayerid][pLeader] = faction; PlayerInfo[giveplayerid][pRank] = 6; PlayerInfo[giveplayerid][pMember] = faction; if(PlayerInfo[giveplayerid][pLeader] == 1) { ftext = "LSPD"; } else if(PlayerInfo[giveplayerid][pLeader] == 2) { ftext = "FBI"; } else if(PlayerInfo[giveplayerid][pLeader] == 3) { ftext = "FSDA"; } else if(PlayerInfo[giveplayerid][pLeader] == 4) { ftext = "SAAS"; } else { return 1; } format(string, sizeof(string), "You have been made the leader of the %s by Administrator %s.",ftext, GetPlayerNameEx(playerid)); SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "You have made %s the leader of the %s.", GetPlayerNameEx(giveplayerid),ftext); SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string); } } else { SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!"); } return 1; } |