SA-MP Forums Archive
doors buttons - 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: doors buttons (/showthread.php?tid=634657)



doors buttons[FIXED] - JasonRiggs - 23.05.2017

Okay this is a request of a quick help, i totally forgot how to make a button which is responsible for opening and closing doors related to a specific faction.. The script which i'm using got some of these buttons, but i xoulsnt figure out how is it scripted, can someone tell me how?


Re: doors buttons - Sew_Sumi - 23.05.2017

yoms button include is what they use.


Re: doors buttons - aoky - 23.05.2017

Use OnPlayerKeyStateChange (https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange)
Then use such param like If(playerfaction = 1) or whatever you use, set it to if he presses the button (https://sampwiki.blast.hk/wiki/Keys) he will open the door using objects.


Re: doors buttons - Sew_Sumi - 23.05.2017

That's not the buttons he's talking about... He's talking about the ones where you press the action key, and the character pushes a wall mounted button, to open the door.


Re: doors buttons - JasonRiggs - 23.05.2017

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
That's not the buttons he's talking about... He's talking about the ones where you press the action key, and the character pushes a wall mounted button, to open the door.
Yes, I've just added these buttons under "OnPlayerPressButton" and waiting for the compiler..


Re: doors buttons - Sew_Sumi - 24.05.2017

Yea, I don't even remember how to use the include.

What's the errors being returned, or what's it doing/not doing?

Have you tried using a bare script with the buttons in alone to see that the setup you've made, works by itself?


Re: doors buttons - JasonRiggs - 24.05.2017

No errors, and the button is created but it doesnt work, it doesnt move the gate beside it..


Re: doors buttons - Sew_Sumi - 24.05.2017

Show the code for OnPlayerPressButton.


Re: doors buttons - JasonRiggs - 24.05.2017

Код:
if (buttonid == PrisonButtons[0])
	{
 		if (IsACop(playerid))
   		{
            MoveDynamicObject(prisonbutton0,2578.28296, -1496.61218, -47.34000,0);
            SetTimer("ClosePrisonDoor0", 3000, 0);
		}
		else return SendClientMessageEx(playerid, COLOR_WHITE, "Access Denied.");
	}
	if(buttonid == PrisonButtons[1])
	{
	    if(IsACop(playerid))
	    {
     		MoveDynamicObject(prisonbutton1,2595.95532, -1487.13977, -49.92000, 0);
			SetTimer("ClosePrisonDoor1", 3000, 0);
	    }
	    else return SendClientMessageEx(playerid, COLOR_GREY, "Access Denied.");
	}
	if(buttonid == PrisonButtons[2])
	{
	    if(IsACop(playerid))
	    {
     		MoveDynamicObject(prisonbutton2,2595.95532, -1487.13977, -49.92000, 0);
			SetTimer("ClosePrisonDoor2", 3000, 0);
	    }
	    else return SendClientMessageEx(playerid, COLOR_GREY, "Access Denied.");
	}
	if(buttonid == PrisonButtons[3])
	{
	    if(IsACop(playerid))
	    {
     		MoveDynamicObject(prisonbutton3,2587.85669, -1496.61206, -47.34000, 0);
			SetTimer("ClosePrisonDoor3", 3000, 0);
	    }
	    else return SendClientMessageEx(playerid, COLOR_GREY, "Access Denied.");
	}
	if(buttonid == PrisonButtons[4])
	{
	    if(IsACop(playerid))
	    {
     		MoveDynamicObject(prisonbutton4,2571.82983, -1532.14771, -47.34000, 0);
			SetTimer("ClosePrisonDoor4", 3000, 0);
	    }
	    else return SendClientMessageEx(playerid, COLOR_GREY, "Access Denied.");
	}
		if(buttonid == PrisonButtons[5])
	{
	    if(IsACop(playerid))
	    {
     		MoveDynamicObject(prisonbutton5,2571.82983, -1532.14771, -47.34000, 0);
			SetTimer("ClosePrisonDoor5", 3000, 0);
	    }
	    else return SendClientMessageEx(playerid, COLOR_GREY, "Access Denied.");
	}
		if(buttonid == PrisonButtons[6])
	{
	    if(IsACop(playerid))
	    {
     		MoveDynamicObject(prisonbutton6,2593.54297, -1497.40930, -47.34000, 0);
			SetTimer("ClosePrisonDoor6", 3000, 0);
	    }
	    else return SendClientMessageEx(playerid, COLOR_GREY, "Access Denied.");
	}
		if(buttonid == PrisonButtons[7])
	{
	    if(IsACop(playerid))
	    {
     		MoveDynamicObject(prisonbutton7,2593.54297, -1497.40930, -47.34000, 0);
			SetTimer("ClosePrisonDoor7", 3000, 0);
	    }
	    else return SendClientMessageEx(playerid, COLOR_GREY, "Access Denied.");
	}
		if(buttonid == PrisonButtons[8])
	{
	    if(IsACop(playerid))
	    {
     		MoveDynamicObject(prisonbutton8,2577.50000, -1484.82642, -49.92000, 0);
			SetTimer("ClosePrisonDoor8", 3000, 0);
	    }
	    else return SendClientMessageEx(playerid, COLOR_GREY, "Access Denied.");
	}
		if(buttonid == PrisonButtons[9])
	{
	    if(IsACop(playerid))
	    {
     		MoveDynamicObject(prisonbutton9,2577.50000, -1484.82642, -49.92000, 0);
			SetTimer("ClosePrisonDoor9", 3000, 0);
	    }
	    else return SendClientMessageEx(playerid, COLOR_GREY, "Access Denied.");
	}



Re: doors buttons - Sew_Sumi - 24.05.2017

You're referencing the buttons instead of the door objects. Unless you named all the door objects, button... Which is confusing yourself anyway, so you should likely change all those to something referencing door.

You're also not using MoveDynamicObject correctly...

Код:
MoveDynamicObject(objectid, Float:x, Float:y, Float:z, Float:speed, Float:rx = -1000.0, Float:ry = -1000.0, Float:rz = -1000.0)