Jump to content

whats wrong with this gate script?


5150

Recommended Posts

the debug says LUA 14 bad argument @ getTeamName [expected team at argument 1, got boolean

not sure what that means could someone help?

 

function createTheGate2 ()
   
         myGate2 = createObject (10184, -1631.6999511719,688.20001220703,8.6999998092651, 0,0,90)
   
      end
   
      addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate2 )
   
       
   
       
   
      function openMyGate2 ( )
	     local team = getTeamName(getPlayerTeam(thePlayer))
		 if (team == "#000000Psycho Ma#990000ns Gang") then
   
         moveObject ( myGate2, 10184, -1631.6999511719,688.20001220703,13)
   
             setTimer ( movingMyGateBack2, 5000, 1 )
  
      end
	  end
  
      addCommandHandler("polgarage",openMyGate2)
  
       
  
      function movingMyGateBack2 ()
  
         moveObject ( myGate2,   10184, -1631.6999511719,688.20001220703,8.6999998092651, 0,0,90)
  
      end

 

Link to comment

That's because thePlayer is not defined in your code

function openMyGate2 ( thePlayer, cmd )
	local playerTeam = getPlayerTeam(thePlayer)
	local teamElement = getTeamFromName("#000000Psycho Ma#990000ns Gang")
	
	if playerTeam and playerTeam == teamElement then
        moveObject ( myGate2, 10184, -1631.6999511719,688.20001220703,13)
		setTimer ( movingMyGateBack2, 5000, 1 )
	else
		outputChatBox("You are not on the right team")
	end
end
addCommandHandler("polgarage",openMyGate2)

 

Link to comment

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