Faction commands help - 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: Faction commands help (
/showthread.php?tid=652656)
Faction commands help -
Zeus666 - 16.04.2018
Hi.
1. How can I set /uninvite to be unique as leader's faction ID? (if leader is factionID 1, thentargetid factionID must be 1 too)
Ex
PHP код:
CMD:uninvite(playerid, params[])
{ //Open bracket
new targetid, targetname[24], playername[24], string[128]; //Create the variables
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /removefromfaction [playerid/partofname]"); //Sends message if they do not type something in for the targetid/name
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Invalid playerid!"); //Sends a message if the player isn't connected
if(pInfo[playerid][pRank] < 15) return SendClientMessage(playerid, -1, "You are not the leader of a faction!");
GetPlayerName(targetid, targetname, sizeof(targetname)); //Stores the targetid's name in the targetname variable
GetPlayerName(playerid, playername, sizeof(playername)); //Stores the playerid's name in the playername variable
format(string, sizeof(string), "Ai demis jucatorul %s din factiune!", targetname);//Formats the message that will be sent to you (the player)
SendClientMessage(playerid, -1, string);//Sends the message that is formatted above to the playerid in a random color
format(string, sizeof(string), "Ai fost demis de catre %s!", playername);//Formats the message that will be sent to the targetid
SendClientMessage(targetid, -1, string);//Sends the message that is formatted above to the targetid in a random color
pInfo[targetid][pFaction] = 0; //Sets their faction variable to 0 (civilian)
pInfo[targetid][pRank] = 0; //Sets their rank variable to 0 (no rank)
return 1; //Returns a value
} //Closed bracket
If player A is in faction ID 2, player B who is leader of faction ID 1 can uninvite him, I don't want to do this.
2)
PHP код:
CMD:factionon(playerid, params[])
{
new str[128], DUTY_STR[24], COLOR, counter = 0;
SendClientMessage(playerid, -1, " - Members Online- ");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(pInfo[i][pFaction] == pInfo[i][pFaction])
{
if(!pInfo[i][pPoliceDuty])
{
DUTY_STR = "Off Duty";
COLOR = COLOR_WHITE;
}
else
{
DUTY_STR = "ON DUTY";
COLOR = COLOR_RED;
}
format(str, sizeof(str),"%s: %s - %s", GetRankName(i), PlayerName(i), DUTY_STR);
SendClientMessage(playerid, COLOR, str);
counter++;
}
}
}
return 1;
}
Here, every player is shown on /factionon (its like its shown online players on the server)
Re: Faction commands help -
jasperschellekens - 16.04.2018
Just check if they have the same faction id.
PHP код:
if(pInfo[playerid][pFaction] != pInfo[targetid][pFaction])
{
// not in same faction
}