Buttons not working
#2

You are complicating stuff too much.

PHP Code:
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new 
GateStatus;
    
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if (
PRESSED(KEY_SECONDARY_ATTACK)) { //If button is F or Enter
        
if(IsPlayerInRangeOfPoint(playerid,3,247.2763671875,72.536186218262,1002.640625)) { //if they are near PD
            
if(GateStatus == 0) { //if gate wasnt moved so far aka its on its default values
                
SetTimer("DoorOpen"35000); //or whatever you use to open your gates/doors
                
SendClientMessage(playerid,COLOR_RED,"You have opened PD gates");
                
GateStatus 1;
            }
            else if(
GateStatus == 1) { //If the gate was moved previously, aka someone used F near it to open it
                
SetTimer("DoorClose"35000); //or whatever you use to close your gates/doors
                
SendClientMessage(playerid,COLOR_RED,"You have closed PD gates");
                
GateStatus 0;
            }
        }
    }
    return 
1;

Dont use yom_buttons, better make a textdraw instead and control it like that, or use the code above that Ive given you to have it simply with F or Enter button to open/close.
Reply


Messages In This Thread
Buttons not working - by Alpha000 - 01.12.2015, 09:54
Re: Buttons not working - by TwinkiDaBoss - 01.12.2015, 15:36

Forum Jump:


Users browsing this thread: 1 Guest(s)