ViRuZGamiing Posted January 31, 2014 Posted January 31, 2014 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
Castillo Posted January 31, 2014 Posted January 31, 2014 You forgot to define 'thePlayer'. addCommandHandler ( "door", function ( thePlayer ) -- Here
ViRuZGamiing Posted January 31, 2014 Author Posted January 31, 2014 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
Castillo Posted January 31, 2014 Posted January 31, 2014 getPlayerTeam returns a team element, you must get the team name using getTeamName.
ViRuZGamiing Posted January 31, 2014 Author Posted January 31, 2014 I changed this and it works, local police = getPlayerTeam(thePlayer) policeTeam = createTeam ("Police", 255, 100, 0) if ( police == policeTeam ) then
Castillo Posted January 31, 2014 Posted January 31, 2014 Well, yes, but that's not a really good solution. All you had to do is this: if ( getTeamName ( police ) == "Police" ) then
ViRuZGamiing Posted January 31, 2014 Author Posted January 31, 2014 BTW can I add that the command can only be used in range of the gate? not all over the world
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now