doors buttons
#1

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?
Reply
#2

yoms button include is what they use.
Reply
#3

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.
Reply
#4

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.
Reply
#5

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..
Reply
#6

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?
Reply
#7

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

Show the code for OnPlayerPressButton.
Reply
#9

Код:
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.");
	}
Reply
#10

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)