[Help] With Movable gates and Factions.
#1

Hello ppls, i am not Eng so i try to explain all problems what i have and i hope u understand it.

1.st How i can create Movable gates with cmd /go or /opengate for only Faction members? i tryed a lot of codes from this nicely forum, but it didnt work if i change TeamID's, so someone can please show me Code for movable gates for factions, and... i know only how to create movable gates for all players, just anyone can type cmd and gates are opened, but it is a Filterscript. Here is Filterscript code, but that gates can open anyone, just need to type cmd, please someone who are smarter than me on scripting things, change this code a bit, so only Yamaguchi can open thoose gates. I rly appreaciate it.
Код:
#include <a_samp>

#define FILTERSCRIPT
new yamaguchigates1;

public OnFilterScriptInit()
{
    print("\n******************************************************");
    print("*                                                    *");
    print("* Simple Movable Gates Filterscript                  *");
    print("*                                                    *");
    print("******************************************************\n");
    
    yamaguchigates1 = CreateObject(980, 785.09997558594, -1152.4000244141, 25.299999237061, 0, 0, 270, 100.0);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/go", true)){
          if(IsPlayerInRangeOfPoint(playerid, 15, 785.09997558594, -1152.4000244141, 25.299999237061)){
            MoveObject(yamaguchigates1, 785.40002441406, -1162.9000244141, 25.39999961853, 3.0, 0.0, 0.0, 270);
            return 1;
        }
    }
    else if(strcmp(cmdtext, "/close", true)){
        if(IsPlayerInRangeOfPoint(playerid, 15, 785.09997558594, -1152.4000244141, 25.299999237061)){
            MoveObject(yamaguchigates1, 785.09997558594, -1152.4000244141, 25.299999237061, 3.0, 0.0, 0.0, 270);
            return 1;
        }
    }
    return 0;
}
public OnFilterScriptExit()
{
    return 1;
}
I also tryed to use this filterscript, that gates are located in Ganton, i just changed faction id, and tryed open gates , but it didnt work
Код:
//===============================Include Files==================================

 #define TEAM_14 14
 #include <a_samp>
 #define Team_14
 #include <a_players>
 #define FILTERSCRIPT
 #define GREY 0xc8bebeAA
 #define COLOR_GREY 0xc8bebeAA
 #define COLOR_LIME 0x99FF00AA
 #define COLOR_RED 0xAA3333AA
 #define COLOR_ORANGE 0xFF9900AA
 #define COLOR_GRAD1 0xB4B5B7AA
 #define COLOR_RED 0xAA3333AA
 #define COLOR_LIGHTBLUE 0x33CCFFAA
 #define COLOR_GREEN 0x33AA33AA
 #define COLOR_WHITE 0xFFFFFFAA
 #define COLOR_BLUE 0x0000FFAA
 #define COLOR_YELLOW 0xFFFF00AA
 #pragma tabsize 0
 new gate;


 #define FILTERSCRIPT

 #if defined FILTERSCRIPT

 public OnPlayerConnect(playerid)
 {
 SendClientMessage(playerid, COLOR_YELLOW, "");
 SendClientMessage(playerid, COLOR_YELLOW, "");
 return 1;
 }

 public OnFilterScriptInit()
 {
 AddStaticPickup(1318, 2, 1122.5795898438,-2037.013671875,69.892913818359); // HQ icon
 Create3DTextLabel("Yamaguchi Mafia",0xAA3333AA,1122.5795898438,-2037.013671875,69.892913818359+0.75,20.0,0,1);


 return 1;
 }

 public OnFilterScriptExit()
 {
 return 1;
 }

 #else

 main()
 {
 print("\n----------------------------------");
 print(" Gates");
 print("----------------------------------\n");
 }

 #endif

 public OnGameModeInit()
 {
 // Don't use these lines if it's a filterscript
 gate = CreateObject(2933, 2473.78808594, -1691.76757812, 14.23004055, 0.00000000, 0.00000000, 18, 0.00000000); // gate


 return 1;
 }


 public OnPlayerRequestClass(playerid, classid)
 {
 SetPlayerPos(playerid, 2473.8220214844, -1690.8035888672, 15.244583129883);
 SetPlayerCameraPos(playerid, 2473.8220214844, -1690.8035888672, 15.244583129883);
 SetPlayerCameraLookAt(playerid, 2473.8220214844, -1690.8035888672, 15.244583129883);
 return 1;
 }


 public OnPlayerCommandText(playerid, cmdtext[])
 {
 if (strcmp(cmdtext, "/open", true)==0) // Command
 if(GetPlayerTeam(playerid) !=14)
 {
 MoveObject (gate,2478.1059570313,-1695.9339599609,14.231301307678,2); // Gate (open)
 SendClientMessage(playerid, COLOR_GREEN, "Gate is open!");
 return 1;
 }
 if (strcmp(cmdtext, "/close", true)==0)
 {
 if(GetPlayerTeam(playerid) !=14)
 MoveObject (gate,2473.78808594,-1691.76757812,14.23004055,2); // Gate (close)
 SendClientMessage(playerid, COLOR_RED, "Gate is close!");
 return 1;
 }
 if(!strcmp(cmdtext, "/gate", true)) // commands
 {
 SendClientMessage(playerid, COLOR_YELLOW, "/open - open");
 SendClientMessage(playerid, COLOR_YELLOW, "/close - close");
 return 1;
 }

 return 0;
 }
Huh.. I tryed change that codes in all ways how i can think, But still didnt worked for Factions..all can open
I use Raven's rp gamemode v4.2
Cya ppls, again soory for bad Eng.
Reply
#2

Ravens RP is an excellent example of movable gates. I used that a while back. Had my own gate at my own house. Just make it like an LSPD gate or FBI gate. Look up pdgate1 or something like that. Ill try to get a code for you.
Reply
#3

Here is an example:


Код:
new pdgate1;

//Moving Object
public GateClose(playerid)
{
      MoveDynamicObject(pdgate1,1589.053344,-1638.123168,14.122960, 0.97);
      PlayerPlaySound(playerid, 1153, 1589.053344,-1638.123168,14.122960);
      lspdg = 0;
      return 1;
}


//Object
pdgate1 = CreateDynamicObject(971,1589.053344,-1638.123168,14.122960,0.000000,0.000000,180);


//Command
	if(!strcmp(cmdtext, "/go", true)) // By CuervO_NegrO
	{
	    if(IsAPDMember(playerid) || IsAFreecop(playerid))
		{
		   	if (IsPlayerInRangeOfPoint(playerid, 15,1589.053344,-1638.123168,14.122960))
			{
				if(lspdg == 1) { SendClientMessage(playerid, COLOR_GREY, "** Gate is Already Opened"); return 1; }
		  		MoveDynamicObject(pdgate1,1599.053344,-1638.123168,14.122960, 0.8);
		      	SetTimer("GateClose", 12000, 0);
		     	//SendClientMessage(playerid, COLOR_BLUE,"A garage is opened and will close in 7 seconds.");
		   		format(string, sizeof(string), "* %s takes his/her remote and opens a garage.", sendername);
		   		ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
		   		PlayerPlaySound(playerid, 1153, 1589.053344,-1638.123168,14.122960);
		     	lspdg = 1;
			}



	else if ( PRESSED(KEY_SUBMISSION) && PRESSED(KEY_ACTION) )
	{
	    if(IsAPDMember(playerid) || IsAFreecop(playerid))
		{
		   	if (IsPlayerInRangeOfPoint(playerid, 15,1589.053344,-1638.123168,14.122960))
			{
	  			if(lspdg == 1) { SendClientMessage(playerid, COLOR_GREY, "** Gate is Already Opened"); return 1; }
	   			MoveDynamicObject(pdgate1,1599.053344,-1638.123168,14.122960, 0.8);
		      	SetTimer("GateClose", 12000, 0);
		     	SendClientMessage(playerid, COLOR_BLUE,"A garage is opened and will close in 7 seconds.");
		     	GetPlayerName(playerid, sendername, sizeof(sendername));
		   		format(string, sizeof(string), "* %s takes his/her remote and opens a garage.", sendername);
		   		ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
		   		PlayerPlaySound(playerid, 1153, 1589.053344,-1638.123168,14.122960);
		     	lspdg = 1;
			}
Reply
#4

Hey Armando Ramiraz thx u man, i rly appreciate it, im newbie at script things for now, but u can explain me, where i need type Faction name? or id? example Yamaguchi.

EDIT: And if im right then all that code cant put just in one place, need some things wryte in different positions (sry bad eng)
Reply
#5

Yeah you are right lol they all go in different places. All you have to do for the name is just switch "pd" and "lspd" with "Yamachi" and just change the coordinates of the gate where it is open and closed. The public GateClose(playerid) doesnt really matter I dont think. The object just goes where all the other objects are in your script and the Command goes under OnPlayerCommandText.
Reply
#6

Thx u mate ill try it right now.
Reply
#7

Ermmm... i cant understand whats wrong with this
Код:
forward GateCloseYamaguchi)playerid);

new yamaguchigates1;

new yamaguchig;

public GateCloseYamaguchi(playerid)
{
      MoveDynamicObject(yamaguchigates1,1589.053344,-1638.123168,14.122960,0.000000,0.000000,180);
      PlayerPlaySound(playerid, 1153, 1589.053344,-1638.123168,14.122960,0.000000,0.000000,180);
      yamaguchig = 0;
      return 1;
}

yamaguchig = 0;

yamaguchigates1 = CreateDynamicObject(980, 785.09997558594, -1152.4000244141, 25.299999237061, 0, 0, 270, 100.0);

	if(!strcmp(cmdtext, "/go", true)) // By CuervO_NegrO-------------Gates system---------
	{
	    if(IsAYamaguchiMember(playerid) || IsAFreecop(playerid))
		{
		   	if (IsPlayerInRangeOfPoint(playerid, 15,1589.053344,-1638.123168,14.122960))
			{
				if(yamaguchig == 1) { SendClientMessage(playerid, COLOR_GREY, "** Gate is Already Opened"); return 1; }
		  		MoveDynamicObject(yamaguchigates1,1599.053344,-1638.123168,14.122960, 0.8);
		      	SetTimer("GateClose", 12000, 0);
		     	SendClientMessage(playerid, COLOR_BLUE,"A garage is opened and will close in 7 seconds.");
		   		format(string, sizeof(string), "* %s takes his/her remote and opens a garage.", sendername);
		   		ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
		   		PlayerPlaySound(playerid, 1153, 1589.053344,-1638.123168,14.122960);
		     	yamaguchig = 1;
			}
I get errors with theese ;( can u help?
Reply
#8

if the obeject is moving in diffrnt direction

remove dynamic and let be just

MoveObject = xxx xxx x blah blah stuffs

just remove dynamic and see it might work..
Reply
#9

No changes, still same errors. And for LSPD and other departments from original script works MoveDynamicObject. ;(
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)