LSPD Gates
#1

I downloaded an automatic LSPD gate system.
When someone is in it's range the gate gets opened.
But I'm creating a RolePlay server so I can't allow everyone to open these gates.
Can anyone add to the filterscript something that'll create new cmds [ /givekey ] [ /takekey ]
and the only ones that has keys will be able to open it..
Or..
Everyone that is in the faction COPS ( police ) will have access to open this gate [ When they're in the range of the gate the gate will open, Civillians/Other factions got no access ]
I prefer the red option...
Thank you whoever is going to help me

Код:
/*==============================================================================
gate filterscript by Wade Martin :D
Dont remove the credits
*===============================================================================
*=============================================================================*/
#define FILTERSCRIPT
#define COLOR_YELLOW 0xFFFF00AA

#include <a_samp>
#include <zcmd>
new gate1;
new gate2;

#if defined FILTERSCRIPT

forward close();

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Gates by Sexc(Wade Martin):p");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" ITS A FILTERSCRIPT");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
     gate1 = CreateObject(980,1590.36975098,-1638.18310547,15.23138046,0.00000000,0.00000000,0.00000000);
     gate2 = CreateObject(968,1544.69677734,-1630.78649902,13.07031250,0.00000000,90.00000000,90.00000000);
     return 1;
}

CMD:gate(playerid, params[])
    {
    if(IsPlayerInRangeOfPoint(playerid, 5, 1590.36975098,-1638.18310547,15.23138046))
    MoveObject(gate1,1590.3804931641,-1637.9333496094,9.4813804626465, 2.00);
    SetTimer("close", 4000, 0);
    if(IsPlayerInRangeOfPoint(playerid, 8, 1544.69677734,-1630.78649902,13.07031250))
    MoveObject(gate2,1544.6962890625,-1630.7861328125,12.0703125, 2.00);
    SetTimer("close", 4000, 0);
    return 1;
    }

public close()
{
    MoveObject(gate1,1590.36975098,-1638.18310547,15.23138046, 3.00);
    MoveObject(gate2,1544.69677734,-1630.78649902,13.07031250, 3.00);
    return 1;
}
Reply
#2

Put this at the top of your script:

pawn Код:
#define LSPD 0  // we define the Teams now = lspd

new gTeam[MAX_PLAYERS]; //variable to store the team in

forward SetPlayerTeamFromClass(playerid, classid);
   public OnPlayerRequestClass(playerid, classid)
   {
   SetPlayerTeamFromClass(playerid, classid);
   return 1;
}
public SetPlayerTeamFromClass(playerid, classid)
{

public OnPlayerRequestClass(playerid)
{
if(classid == 0)
    {
        gTeam[playerid] = LSPD;
        GameTextForPlayer(playerid,"~w~LSPD",3000,5); // This will show up an Text , when you select your class
        SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
        SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
        SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
        SetPlayerFacingAngle(playerid,122.4500);
        SetPlayerColor(playerid,0xA000FFFF); // Teamcolor
    }
    return 1;
}

CMD:gate(playerid, params[])
    {
    if(gTeam[playerid] = LSPD);
    if(IsPlayerInRangeOfPoint(playerid, 5, 1590.36975098,-1638.18310547,15.23138046))
    MoveObject(gate1,1590.3804931641,-1637.9333496094,9.4813804626465, 2.00);
    SetTimer("close", 4000, 0);
    if(IsPlayerInRangeOfPoint(playerid, 8, 1544.69677734,-1630.78649902,13.07031250))
    MoveObject(gate2,1544.6962890625,-1630.7861328125,12.0703125, 2.00);
    SetTimer("close", 4000, 0);
    }
    else
    {
         SendClientMessage(playerid, COL_RED," Your not an LSPD member");
         return 1;
    }
not sure if dis works check:
https://sampforum.blast.hk/showthread.php?tid=282178

good luck
Reply
#3

Quote:
Originally Posted by Voxel
Посмотреть сообщение
Put this at the top of your script:

pawn Код:
#define LSPD 0  // we define the Teams now = lspd

new gTeam[MAX_PLAYERS]; //variable to store the team in

forward SetPlayerTeamFromClass(playerid, classid);
   public OnPlayerRequestClass(playerid, classid)
   {
   SetPlayerTeamFromClass(playerid, classid);
   return 1;
}
public SetPlayerTeamFromClass(playerid, classid)
{

public OnPlayerRequestClass(playerid)
{
if(classid == 0)
    {
        gTeam[playerid] = LSPD;
        GameTextForPlayer(playerid,"~w~LSPD",3000,5); // This will show up an Text , when you select your class
        SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
        SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
        SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
        SetPlayerFacingAngle(playerid,122.4500);
        SetPlayerColor(playerid,0xA000FFFF); // Teamcolor
    }
    return 1;
}

CMD:gate(playerid, params[])
    {
    if(gTeam[playerid] = LSPD);
    if(IsPlayerInRangeOfPoint(playerid, 5, 1590.36975098,-1638.18310547,15.23138046))
    MoveObject(gate1,1590.3804931641,-1637.9333496094,9.4813804626465, 2.00);
    SetTimer("close", 4000, 0);
    if(IsPlayerInRangeOfPoint(playerid, 8, 1544.69677734,-1630.78649902,13.07031250))
    MoveObject(gate2,1544.6962890625,-1630.7861328125,12.0703125, 2.00);
    SetTimer("close", 4000, 0);
    }
    else
    {
         SendClientMessage(playerid, COL_RED," Your not an LSPD member");
         return 1;
    }
not sure if dis works check:
https://sampforum.blast.hk/showthread.php?tid=282178

good luck

7 errors...
Код:
/*==============================================================================
gate filterscript by Wade Martin :D
Dont remove the credits
*===============================================================================
*=============================================================================*/
#define FILTERSCRIPT
#define COLOR_YELLOW 0xFFFF00AA
#define LSPD 0  // we define the Teams now = lspd


#include <a_samp>
#include <zcmd>
new gate1;
new gate2;

new gTeam[MAX_PLAYERS]; //variable to store the team in
#if defined FILTERSCRIPT

forward close();

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Gates by Sexc(Wade Martin):p");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" ITS A FILTERSCRIPT");
    print("----------------------------------\n");
}

#endif

/*==============================================================================
gate filterscript by Wade Martin :D
Dont remove the credits
*===============================================================================
*=============================================================================*/
#define FILTERSCRIPT
#define COLOR_YELLOW 0xFFFF00AA

#include <a_samp>
#include <zcmd>
new gate1;
new gate2;

#if defined FILTERSCRIPT

forward close();

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Gates by Sexc(Wade Martin):p");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" ITS A FILTERSCRIPT");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
     gate1 = CreateObject(980,1590.36975098,-1638.18310547,15.23138046,0.00000000,0.00000000,0.00000000);
     gate2 = CreateObject(968,1544.69677734,-1630.78649902,13.07031250,0.00000000,90.00000000,90.00000000);
     return 1;
}

CMD:gate(playerid, params[])
    {
    if(IsPlayerInRangeOfPoint(playerid, 5, 1590.36975098,-1638.18310547,15.23138046))
    MoveObject(gate1,1590.3804931641,-1637.9333496094,9.4813804626465, 2.00);
    SetTimer("close", 4000, 0);
    if(IsPlayerInRangeOfPoint(playerid, 8, 1544.69677734,-1630.78649902,13.07031250))
    MoveObject(gate2,1544.6962890625,-1630.7861328125,12.0703125, 2.00);
    SetTimer("close", 4000, 0);
    return 1;
    }

public close()
{
    MoveObject(gate1,1590.36975098,-1638.18310547,15.23138046, 3.00);
    MoveObject(gate2,1544.69677734,-1630.78649902,13.07031250, 3.00);
    return 1;
}
public OnGameModeInit()
{
     gate1 = CreateObject(980,1590.36975098,-1638.18310547,15.23138046,0.00000000,0.00000000,0.00000000);
     gate2 = CreateObject(968,1544.69677734,-1630.78649902,13.07031250,0.00000000,90.00000000,90.00000000);
     return 1;
}

CMD:gate(playerid, params[])
    {
    if(IsPlayerInRangeOfPoint(playerid, 5, 1590.36975098,-1638.18310547,15.23138046))
    MoveObject(gate1,1590.3804931641,-1637.9333496094,9.4813804626465, 2.00);
    SetTimer("close", 4000, 0);
    if(IsPlayerInRangeOfPoint(playerid, 8, 1544.69677734,-1630.78649902,13.07031250))
    MoveObject(gate2,1544.6962890625,-1630.7861328125,12.0703125, 2.00);
    SetTimer("close", 4000, 0);
    return 1;
    }

public close()
{
    MoveObject(gate1,1590.36975098,-1638.18310547,15.23138046, 3.00);
    MoveObject(gate2,1544.69677734,-1630.78649902,13.07031250, 3.00);
    return 1;
}
Thanks for trying though xd
Reply
#4

Anyone ?
Reply
#5

Give me an hour or so to make you an example script.
Reply
#6

Quote:
Originally Posted by zT KiNgKoNg
Посмотреть сообщение
Give me an hour or so to make you an example script.
Alright
Thanks.
Reply
#7

bump
Reply
#8

Why are you using a filterscript? You should have no filterscripts in a production gamemode at all otherwise your facing the kind of problems you are now with trying to interface your FS with gamemode it can work but is counter-intuitive. You should only use filterscripts when they make sense such as a mission gamemode where you need to load/unload missions dynamically and in some circumstances basic temporary enhancements such as a acceleration script.

The method you want to use is hooking callbacks there is a lot of different ways to do it the best in my opinion is to use y_hooks it will take away all associated overhead with hooking callbacks.

https://sampforum.blast.hk/showthread.php?tid=166016

Now you can convert your FS to an include which is very very easy to do then it is usually as simple as compiling it with your gamemode I recommend putting an include like this below all your global variables this will allow the include to reference your global variables if necessary this takes care of the problem of only letting certain players access the gate since you now have direct access to the players variables to make those checks.
Reply
#9

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Why are you using a filterscript? You should have no filterscripts in a production gamemode at all otherwise your facing the kind of problems you are now with trying to interface your FS with gamemode it can work but is counter-intuitive. You should only use filterscripts when they make sense such as a mission gamemode where you need to load/unload missions dynamically and in some circumstances basic temporary enhancements such as a acceleration script.

The method you want to use is hooking callbacks there is a lot of different ways to do it the best in my opinion is to use y_hooks it will take away all associated overhead with hooking callbacks.

https://sampforum.blast.hk/showthread.php?tid=166016

Now you can convert your FS to an include which is very very easy to do then it is usually as simple as compiling it with your gamemode I recommend putting an include like this below all your global variables this will allow the include to reference your global variables if necessary this takes care of the problem of only letting certain players access the gate since you now have direct access to the players variables to make those checks.
Thanks but hmm...
I'm not good in scripting so I didn't understand you xD.
Can you guide me or something ?
Reply
#10

Anyone else ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)