/*============================================================================== 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; }
#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;
}
Put this at the top of your script:
pawn Код:
https://sampforum.blast.hk/showthread.php?tid=282178 good luck |
/*============================================================================== 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; }
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. |