Need assistance. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need assistance. (
/showthread.php?tid=395880)
Need assistance. -
Laure - 28.11.2012
Alright in this below command i want is if there is any leader already in a faction we get a client message than there is already a leader in this faction and cant make other leader i tried but couldnt can i get some assistance.
Код:
CMD:makeleader(playerid, params[])
{
new playerb, faction, string[128], idx;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1337 && !PlayerInfo[playerid][pFacMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "ui", playerb, faction))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /makeleader [playerid] [factionid]");
SendClientMessage(playerid, COLOR_GREY, "Available Factions: 0) Civilian | 1) LSPD | 2) Government | 3) Hitman Agency | 4) News Agency | 5) LSFMD | 6) FBI | 7) SAR");
return 1;
}
if(FacInfo[idx][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "There is already one leading this Faction.");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected.");
if(faction < 0 || faction > 7) return SendClientMessage(playerid, COLOR_GREY, "Factions are between 0 and 7");
// Setting Player's Stats
if(faction == 0)
{
PlayerInfo[playerb][pFac] = 0;
PlayerInfo[playerb][pFacRank] = 0;
PlayerInfo[playerb][pFacLeader] = 0;
}
else
{
PlayerInfo[playerb][pFac] = faction;
PlayerInfo[playerb][pFacRank] = 6;
PlayerInfo[playerb][pFacLeader] = 1;
PlayerInfo[playerb][pFacDiv] = 0;
PlayerInfo[playerb][pFacDivLeader] = 0;
}
// Admin & Player messages
format(string, sizeof(string), "AdmInfo: %s has given %s the {33AA33}%s{FF6347} Faction leadership.", RPN(playerid), RPN(playerb), RPFNEx(playerb));
SendAdminMessage(COLOR_DARKRED, 1, string);
format(string, sizeof(string), " %s has given you the Leadership over {33AA33}%s{33CCFF}.", RPN(playerid), RPFNEx(playerb));
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "AdmInfo: %s has given %s the %s faction leadership.", RPN(playerid), RPN(playerb), RPFNEx(playerb));
Log("logs/factions.log", string);
return 1;
}
Re: Need assistance. -
Laure - 29.11.2012
BUMP
Re: Need assistance. -
maramizo - 29.11.2012
pawn Код:
CMD:makeleader(playerid, params[])
{
new playerb, faction, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 1337 && !PlayerInfo[playerid][pFacMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "ui", playerb, faction))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /makeleader [playerid] [factionid]");
SendClientMessage(playerid, COLOR_GREY, "Available Factions: 0) Civilian | 1) LSPD | 2) Government | 3) Hitman Agency | 4) News Agency | 5) LSFMD | 6) FBI | 7) SAR");
return 1;
}
if(FacInfo[faction][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "There is already one leading this Faction.");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected.");
if(faction < 0 || faction > 7) return SendClientMessage(playerid, COLOR_GREY, "Factions are between 0 and 7");
// Setting Player's Stats
if(faction == 0)
{
PlayerInfo[playerb][pFac] = 0;
PlayerInfo[playerb][pFacRank] = 0;
PlayerInfo[playerb][pFacLeader] = 0;
}
else
{
PlayerInfo[playerb][pFac] = faction;
PlayerInfo[playerb][pFacRank] = 6;
PlayerInfo[playerb][pFacLeader] = 1;
PlayerInfo[playerb][pFacDiv] = 0;
PlayerInfo[playerb][pFacDivLeader] = 0;
}
// Admin & Player messages
format(string, sizeof(string), "AdmInfo: %s has given %s the {33AA33}%s{FF6347} Faction leadership.", RPN(playerid), RPN(playerb), RPFNEx(playerb));
SendAdminMessage(COLOR_DARKRED, 1, string);
format(string, sizeof(string), " %s has given you the Leadership over {33AA33}%s{33CCFF}.", RPN(playerid), RPFNEx(playerb));
SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "AdmInfo: %s has given %s the %s faction leadership.", RPN(playerid), RPN(playerb), RPFNEx(playerb));
Log("logs/factions.log", string);
return 1;
}
Quite unsure why you even had an idx in the first place.
edit:
If "FacInfo[faction][pFacLeader]" is a string then this will not work.
Re: Need assistance. -
Laure - 29.11.2012
Didnt work./:
Re: Need assistance. -
Laure - 29.11.2012
Help yo!