Quote:
Originally Posted by knightice
Could you add an Army faction?
|
Yes, replace the original coding with this:
pawn Код:
stock GetFactionName(factionid)
{
new string[126];
switch(factionid)
{
case 14: string = "Bone County Army";
case 13: string = "Bone County News";
case 12: string = "Bone County Government";
case 11: string = "Bayside City Council";
case 10: string = "Bayside Fire and Rescue";
case 9: string = "Bayside Medical Department";
case 8: string = "Bayside Police Department";
case 7: string = "Las Payasadas Sheriff Department";
case 6: string = "El Quebrados Council";
case 5: string = "El Quebrados Sheriff Department";
case 4: string = "Las Barrancas Sheriff Department";
case 3: string = "Fort Carson Council";
case 2: string = "Fort Carson Medical Service";
case 1: string = "Fort Carson Sheriff Department";
case 0: string = "None";
default: string = "Unknown";
}
return string;
}
pawn Код:
YCMD:makeleader(playerid, params[])
{
if(gPlayerLoggedIn[playerid] == 0) return 1;
if(PlayerInfo[playerid][Admin] < 5) return 1;
new target, factionid, string[126];
if(sscanf(params, "ud", target, factionid))
{
SendClientMessage(playerid, COLOR_GREY, "YCMD: /makeleader [Part of Name/ID] [Faction ID]");
SendClientMessage(playerid, COLOR_GREY," Faction IDs: 1 - Fort Carson Sheriff Department");
SendClientMessage(playerid, COLOR_GREY," 2 - Fort Carson Medical Service, 3 - Fort Carson Council");
SendClientMessage(playerid, COLOR_GREY," 4 - Las Barrancas Sheriff Department, 5 - El Quebrados Sheriff Department");
SendClientMessage(playerid, COLOR_GREY," 6 - El Quebrados Council, 7 - Las Payasadas Sheriff Department");
SendClientMessage(playerid, COLOR_GREY," 8 - Bayside Police Department, 9 - Bayside Medical Department");
SendClientMessage(playerid, COLOR_GREY," 10 - Bayside Fire and Rescue, 11 - Bayside City Council");
SendClientMessage(playerid, COLOR_GREY," 12 - Bone County Government, 13 - Bone County News, 14 - Bone County Army");
return 1;
}
if(factionid < 0 || factionid > 14) return SendClientMessage(playerid, COLOR_GREY, "Factions go from 0 to 14.");
if(!IsPlayerConnected(target)) return SendClientMessage(playerid, COLOR_GREY ,"User is not connected.");
if(factionid == PlayerInfo[target][FLeader]) return SendClientMessage(playerid, COLOR_GREY, "That player is already the leader of this faction.");
if(factionid == 0)
{
PlayerInfo[target][Faction] = 0;
PlayerInfo[target][FLeader] = 0;
SendClientMessage(target, COLOR_LIGHTRED, "An admin has revoked your Faction Leadership rights.");
format(string, sizeof(string), "AdmWarning: You made revoked %s's Faction Leadership rights.", PlayerName(target));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
return 1;
}
PlayerInfo[target][Faction] = factionid;
PlayerInfo[target][FLeader] = factionid;
format(string, sizeof(string), "Admin %s has made you leader of the %s!", PlayerName(playerid), GetFactionName(factionid));
SendClientMessage(target, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "AdmWarning: %s made %s leader of %s.", PlayerName(playerid), PlayerName(target), GetFactionName(factionid));
AMessage(COLOR_LIGHTRED, string);
return 1;
}