SA-MP Forums Archive
Problem command /fwarn i give rep who helps me ! - 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: Problem command /fwarn i give rep who helps me ! (/showthread.php?tid=540963)



Problem command /fwarn i give rep who helps me ! - buburuzu19 - 08.10.2014

I have a problem with command /fwarn , the leaders can give faction warns to CIVILIANS and members from another factions that they don't lead.
The command is:
pawn Код:
CMD:fwarn(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new userID;
        new string[256];
        new giveplayer[MAX_PLAYER_NAME];
        new sendername[MAX_PLAYER_NAME];
        if(sscanf(params, "u", userID)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/fwarn [playerid]");
        {
            if(playerVariables[playerid][pGroupRank] >= 6)
            {
                GetPlayerName(userID, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                playerVariables[userID][pFWarns] += 1;
                format(string, sizeof(string), "You have give a faction warn to %s!", giveplayer);
                SendClientMessage(playerid, COLOR_LIGHTRED, string);
                format(string, sizeof(string), "%s has give you a faction warn!", sendername);
                SendClientMessage(userID, COLOR_LIGHTRED, string);
            }
        }
    }
    return 1;
}
So i want that leaders can't give FW's to civilians and to other peoples that are in other factions , i want that they can give fw's only to the faction they lead.
The variables for civilians are
pawn Код:
if(playerVariables[playerid][pGroup] == 0)
        {
            SetPlayerColor(playerid, COLOR_WHITE);
        }
        if(playerVariables[playerid][pGroup] == 1)
        {
            SetPlayerColor(playerid, COLOR_PD);
        }
        if(playerVariables[playerid][pGroup] == 2)
        {
            SetPlayerColor(playerid, COLOR_FBI);
        }
        if(playerVariables[playerid][pGroup] == 3)
        {
            SetPlayerColor(playerid,COLOR_NG);
        }
        if(playerVariables[playerid][pGroup] == 4)
        {
            SetPlayerColor(playerid,COLOR_MEDIC);
        }
        if(playerVariables[playerid][pGroup] == 5)
        {
            SetPlayerColor(playerid, COLOR_PD);
        }
        if(playerVariables[playerid][pGroup] == 6)
        {
            SetPlayerColor(playerid,COLOR_RussianMafia);
        }
        if(playerVariables[playerid][pGroup] == 7)
        {
            SetPlayerColor(playerid,COLOR_Grove);
        }
        if(playerVariables[playerid][pGroup] == 8)
        {
            SetPlayerColor(playerid,COLOR_Aztecas);
        }
        if(playerVariables[playerid][pGroup] == 9)
        {
            SetPlayerColor(playerid,COLOR_Riffa);
        }
        if(playerVariables[playerid][pGroup] == 10)
        {
            SetPlayerColor(playerid,COLOR_SFBikers);
        }
        if(playerVariables[playerid][pGroup] == 11)
        {
            SetPlayerColor(playerid,COLOR_Vagos);
        }
        if(playerVariables[playerid][pGroup] == 12)
        {
            SetPlayerColor(playerid,COLOR_HITMAN);
        }
        if(playerVariables[playerid][pGroup] == 13)
        {
            SetPlayerColor(playerid,COLOR_SI);
        }
        if(playerVariables[playerid][pGroup] == 14)
        {
            SetPlayerColor(playerid,COLOR_YELLOW);
        }
        if(playerVariables[playerid][pGroup] == 15)
        {
            SetPlayerColor(playerid,COLOR_NEWS);
        }



Re: Problem command /fwarn i give rep who helps me ! - MattTucker - 08.10.2014

pawn Код:
CMD:fwarn(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new userID;
        new string[256];
        new giveplayer[MAX_PLAYER_NAME];
        new sendername[MAX_PLAYER_NAME];
        if(sscanf(params, "u", userID)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/fwarn [playerid]");
        {
            if(playerVariables[playerid][pGroupRank] >= 6 && PlayerVariables[userID][pGroup] == PlayerVariables[playerid][pGroup])
            {
                GetPlayerName(userID, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                playerVariables[userID][pFWarns] += 1;
                format(string, sizeof(string), "You have give a faction warn to %s!", giveplayer);
                SendClientMessage(playerid, COLOR_LIGHTRED, string);
                format(string, sizeof(string), "%s has give you a faction warn!", sendername);
                SendClientMessage(userID, COLOR_LIGHTRED, string);
            }
        }
    }
    return 1;
}
Try that one.


Re: Problem command /fwarn i give rep who helps me ! - Rudy_ - 08.10.2014

and the msg

pawn Код:
CMD:fwarn(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new userID;
        new string[256];
        new giveplayer[MAX_PLAYER_NAME];
        new sendername[MAX_PLAYER_NAME];
        if(sscanf(params, "u", userID)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/fwarn [playerid]");
        {
            if(playerVariables[playerid][pGroupRank] >= 6 && PlayerVariables[userID][pGroup] == PlayerVariables[playerid][pGroup])
            {
                GetPlayerName(userID, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));
                playerVariables[userID][pFWarns] += 1;
                format(string, sizeof(string), "You have give a faction warn to %s!", giveplayer);
                SendClientMessage(playerid, COLOR_LIGHTRED, string);
                format(string, sizeof(string), "%s has give you a faction warn!", sendername);
                SendClientMessage(userID, COLOR_LIGHTRED, string);
            }
            else SendClientMessage(playerid, COLOR_LIGHTRED, "Error: Player is not in your Faction!");
        }
    }
    return 1;
}



Re: Problem command /fwarn i give rep who helps me ! - buburuzu19 - 09.10.2014

Worked thanks Rudy and Matt , rep both.