Buttons not working
#1

When i go near LSPD button and press F nothing happens....here are my codes.

PHP Code:
public OnPlayerPressButton(playeridbuttonid)
{
    
// LSPD
       
if(buttonid == lspdcopsonly)
    {
        if(
PlayerInfo[playerid][pLeader] == || PlayerInfo[playerid][pLeader] == || PlayerInfo[playerid][pFaction] == || PlayerInfo[playerid][pFaction] == || PlayerInfo[playerid][pFaction] == 5)
        {
                
DoorOpen(playerid);
                
SetTimer("DoorClose"40000);
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY"   You're not a Cop / FBI!");
        }
    }
       if(
buttonid == lspdeveryone)
    {
        
DoorOpen(playerid);
        
SetTimer("DoorClose"35000);
    } 
DoorOpen:
PHP Code:
forward DoorOpen(playerid);
public 
DoorOpen(playerid)
{
    
MoveDynamicObject(lspddoor1247.2763671875,72.536186218262,1002.6406253.5000);
     
MoveDynamicObject(lspddoor2244.0330657959,72.580932617188,1002.6406253.5000);
      return 
1;

LSPD Buttons:
PHP Code:
//LSPD Button
    
lspdcopsonly CreateButton(244.9068603515672.3281251003.96093753.0); // ONLYS ONLY
    
lspdeveryone CreateButton(244.9273.421004.2792.0); // People, ^^==LSPD
    
CreateDynamicObject(2886244.9068603515672.3281251003.9609375,0,0,3.020002); //lspdcopsonly button
    
CreateDynamicObject(2886244.9273.421004.27,0,0,92.020002); //lspdeveryone button
    
lspddoor1 CreateDynamicObject(1569246.3515014648472.5477142333981002.6406250.0000000.0000000.000000); //
    
lspddoor2 CreateDynamicObject(1569245.0330047607472.5685119628911002.6406250.0000000.0000000.000000); // 
It don't even show me this error:
Code:
You're not a Cop / FBI
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)