Jump to content

Moving gates with team or clan


Recommended Posts

Posted

Hello guys, I'm new here, so i'm trying to do the following;

Open the gate only for a specified team called "Army"

Open the gate and close it with the same command. but i failed i have no idea what's wrong

   gate1 = createObject ( 980, -579.5, -189.7, 80, 0, 0, 90 ) 
  
function openMainGate(thePlayer) 
if getTeamName(getPlayerTeam(thePlayer)) == "Army" then 
    if getElementPosition(gate1, -579.5, -189.7, 80 ) then 
        moveObject (gate1, 3000, -579.5, -179.7, 80 ) 
    else 
        moveObject (gate1, 3000, -579.5, -189.7, 80 ) 
    end 
end 
end 
addCommandHandler("main", openMainGate) 

Screw putin

Posted

Instead of checking a specific location you should use a variable to define when the gate is totally open and totally closed and if in the middle then either go for the closest route or cancel the action.

Checking object coordinates is not always accurate as it may depend on several things.

If I helped you, please click the like button on the right ;) Thanks!

Posted (edited)

gate1 = createObject ( 980, -579.5, -189.7, 80, 0, 0, 90 ) 
open = false 
addCommandHandler('main', 
function ( max ) 
 if getPlayerTeam ( max ) and getPlayerTeam ( max ) == getTeamFromName ( "Army" ) then 
 if ( open == false ) then 
  moveObject (gate1, 3000, -579.5, -179.7, 80 ) 
  open = true 
 elseif ( open == true ) then 
 moveObject (gate1, 3000, -579.5, -189.7, 80 ) 
     open = false 
         end 
      end 
   end 
) 
Edited by Guest

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted

You are never updating the "open" variable, which means it'll always be 'false'.

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
You are never updating the "open" variable, which means it'll always be 'false'.

Fixed ,

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

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...