Making the command only for a group
#1

I got a moving gate command working, But now i want to lock them to groups, Basically. Either the leader can /lockgate and /unlock gate, and anyone can access the gates, or it only works for the members in the faction. Heres my cmd
Код:
CMD:gate(playerid,params[])
{
    if(IsPlayerInRangeOfPoint(playerid,10,1428.6456, 242.0033, 20.3020))
    {
        switch(Open)//Check whether the gate opened or closed
        {
            case true://If the gate opened
            {
                MoveObject(Gate,1428.6456, 242.0033, 20.3020,4);//Close the gate
                Open = false;//false for closed
            }
            case false://If the gate closed
            {
                MoveObject(Gate,1426.5259, 237.4716, 20.3020,4);//Open the gate
                Open = true;//true for opened
            }
        }
        return 1;
    }
    SendClientMessage(playerid,ORANGE,"You're not close enough to the gate.");//Send error message if player isn't near any gate
    return 1;
}
Will rep if someone can help, thanks.
Reply
#2

pawn Код:
CMD:gate(playerid,params[])
{
    if(gTeam[playerid] == TEAM) // your faction that you want to open your gate
    {
    if(IsPlayerInRangeOfPoint(playerid,10,1428.6456, 242.0033, 20.3020))
    {
        switch(Open)//Check whether the gate opened or closed
        {
            case true://If the gate opened
            {
                MoveObject(Gate,1428.6456, 242.0033, 20.3020,4);//Close the gate
                Open = false;//false for closed
            }
            case false://If the gate closed
            {
                MoveObject(Gate,1426.5259, 237.4716, 20.3020,4);//Open the gate
                Open = true;//true for opened
            }
        }
        return 1;
    }
    SendClientMessage(playerid,ORANGE,"You're not close enough to the gate.");//Send error message if player isn't near any gate
    return 1;
}
Reply
#3

******, Can you rewrite my filterscript with me? I've tried heaps of things that you both suggested + more, And i still get errors.
heres my filterscript.
Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>

#if defined FILTERSCRIPT

#define ORANGE 			0xF97804FF

#endif

new Gate,
    bool:Open;
    
//Single gate
public OnFilterScriptInit()
{
    Gate = CreateObject(989,1428.6284, 241.9930, 20.3020,359.2969, 0.7000, 172.9962, 0.0);
    return 1;
}

CMD:gate(playerid,params[])
{
	if (group[playerid] == 9)
	{
    if(IsPlayerInRangeOfPoint(playerid,10,1428.6456, 242.0033, 20.3020))
    {
        switch(Open)//Check whether the gate opened or closed
        {
            case true://If the gate opened
            {
                MoveObject(Gate,1428.6456, 242.0033, 20.3020,4);//Close the gate
                Open = false;//false for closed
            }
            case false://If the gate closed
            {
                MoveObject(Gate,1426.5259, 237.4716, 20.3020,4);//Open the gate
                Open = true;//true for opened
            }
        }
        return 1;
    }
    SendClientMessage(playerid,ORANGE,"You're not close enough to the gate.");//Send error message if player isn't near any gate
    return 1;
}
Reply
#4

Did you mean something like this.
Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>

#if defined FILTERSCRIPT

#define ORANGE 			0xF97804FF

#endif

new Gate,
    bool:Open;
    
//Single gate
public OnFilterScriptInit()
{
    Gate = CreateObject(989,1428.6284, 241.9930, 20.3020,359.2969, 0.7000, 172.9962, 0.0);
    return 1;
}
GROUP_ADD<9>
{
@YCMD:gate;
}


CMD:gate(playerid,params[])
{
	if (group[playerid] == 9)
	{
    if(IsPlayerInRangeOfPoint(playerid,10,1428.6456, 242.0033, 20.3020))
    {
        switch(Open)//Check whether the gate opened or closed
        {
            case true://If the gate opened
            {
                MoveObject(Gate,1428.6456, 242.0033, 20.3020,4);//Close the gate
                Open = false;//false for closed
            }
            case false://If the gate closed
            {
                MoveObject(Gate,1426.5259, 237.4716, 20.3020,4);//Open the gate
                Open = true;//true for opened
            }
        }
        return 1;
    }
    SendClientMessage(playerid,ORANGE,"You're not close enough to the gate.");//Send error message if player isn't near any gate
    return 1;
}
Sorry i'm not a very advanced scripter
Reply
#5

Make a variable for teams,example:

PHP код:
#define TEAM_VAGOS 0
new Faction[128]; 
Team Check:

PHP код:
if(Faction[playerid] != TEAM_VAGOS) return SendClientMessage(playerid, -1"You're not vagos member!"); 
Reply
#6

Quote:

C:\Users\Josh\Desktop\FCSLRP\pawno\include\YSI\y_i terate.inc(197) : fatal error 111: user error: "Old foreach.inc files are no longer compatible with YSI."


Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

This is the error i get with the YSI script
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)