SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 16/04/2018, 04:05 PM   #1
Zeus666
Huge Clucker
 
Join Date: Mar 2015
Posts: 440
Reputation: 41
Default Faction commands help

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 Code:
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 Code:
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)
Zeus666 is offline   Reply With Quote
Old 16/04/2018, 06:26 PM   #2
jasperschellekens
Gangsta
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Gehenna
Posts: 567
Reputation: 31
Default Re: Faction commands help

Just check if they have the same faction id.

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

__________________
Offering php and pawn scripts against payment. PM me.

[Filterscripts] SQLlite - Jaspers Pin Code Script - Additional security.
[Filterscripts] Jasper's Woodcutting job/skill with levels and XP. Custom map
[Filterscripts] Simple trucking filterscript
jasperschellekens is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
guys i wanna know how to create faction commands with sscanf and zcmd. Gangster-rocks Scripting Help 3 18/07/2012 03:56 PM
How To create faction commands. Gangster-rocks Scripting Help 4 07/06/2012 07:46 PM
[HELP]Change faction's spawn (members in the faction, urban rp mod) KfirRP Help Archive 0 27/11/2009 09:39 AM


All times are GMT. The time now is 01:27 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.