Jump to content

My gate doesn't work


ViRuZGamiing

Recommended Posts

Posted

Hi,

here's the code;

insideDoor = createObject(10150, 239.6, 117.6, 1004.3, 0, 0, 0) 
setElementInterior(insideDoor, 10) 
nottrue = false 
  
addCommandHandler("door", 
function () 
    local police = getPlayerTeam(thePlayer) 
    if ( police == "Police" ) then 
        if (nottrue == false) then 
            moveObject( insideDoor, 2000, 239.6, 117.6, 1004.3, 0, 0, 0 ) 
            nottrue = true 
        elseif (nottrue == true) then 
            moveObject( insideDoor, 2000, 239.6, 117.6, 1006.8, 0, 0, 0 ) 
            nottrue = false 
        else 
        outputChatBox("Access Denied, employees only!", thePlayer, 255, 100, 0) 
        end 
    end 
end) 

Bad Agument @ getPlayerTeam

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

You forgot to define 'thePlayer'.

addCommandHandler ( "door", 
function ( thePlayer ) -- Here 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

No Errors, No debugs anymore;

insideDoor = createObject(10150, 239.6, 117.6, 1004.3, 0, 0, 0) 
setElementInterior(insideDoor, 10) 
nottrue = false 
  
addCommandHandler("door", 
function (thePlayer) 
    local police = getPlayerTeam(thePlayer) 
    if ( police == "Police" ) then 
        if (nottrue == false) then 
            moveObject( insideDoor, 2000, 239.6, 117.6, 1006.8, 0, 0, 0 ) 
            nottrue = true 
        elseif (nottrue == true) then 
            moveObject( insideDoor, 2000, 239.6, 117.6, 1004.3, 0, 0, 0 ) 
            nottrue = false 
        else 
            outputChatBox("Access Denied, employees only!", thePlayer, 255, 100, 0) 
        end 
    end 
end) 

No output when not in Police Team and doesn't move when in team

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

getPlayerTeam returns a team element, you must get the team name using getTeamName.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I changed this and it works,

    local police = getPlayerTeam(thePlayer) 
    policeTeam = createTeam ("Police", 255, 100, 0) 
    if ( police == policeTeam ) then 

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

Well, yes, but that's not a really good solution.

All you had to do is this:

if ( getTeamName ( police ) == "Police" ) then 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

BTW can I add that the command can only be used in range of the gate? not all over the world

"If debugging is the process of removing software bugs, then programming must be the process of putting them in."

Posted

You can use

getDistanceBetweenPoints3D 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...