Faction commands help
#1

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(playeridparams[])
//Open bracket
    
new targetidtargetname[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(targetidtargetnamesizeof(targetname)); //Stores the targetid's name in the targetname variable
    
GetPlayerName(playeridplayernamesizeof(playername)); //Stores the playerid's name in the playername variable
    
format(stringsizeof(string), "Ai demis jucatorul %s din factiune!"targetname);//Formats the message that will be sent to you (the player)
    
SendClientMessage(playerid, -1string);//Sends the message that is formatted above to the playerid in a random color
    
format(stringsizeof(string), "Ai fost demis de catre %s!"playername);//Formats the message that will be sent to the targetid
    
SendClientMessage(targetid, -1string);//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(playeridparams[])
{
    new 
str[128], DUTY_STR[24], COLORcounter 0;
    
SendClientMessage(playerid, -1" - Members Online- ");
    for(new 
0MAX_PLAYERSi++)
    {
        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(strsizeof(str),"%s: %s - %s",  GetRankName(i), PlayerName(i), DUTY_STR);
                
SendClientMessage(playeridCOLORstr);
                
counter++;
            }
        }
    }
    return 
1;

Here, every player is shown on /factionon (its like its shown online players on the server)
Reply
#2

Just check if they have the same faction id.

PHP код:
if(pInfo[playerid][pFaction] != pInfo[targetid][pFaction])
{
// not in same faction

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)