heavy air Posted March 17, 2009 Share Posted March 17, 2009 hi all having problems getting this to work i get no errors from debug but i only get the output to chatbox "tester" from upperdoorkey and i get "your on heavys team" from joinateam here is the script local upperdoorlock = createColSphere ( -1156, 43, 0, 15 ) local upperdoor = createObject ( 3113, -1156.52, 43.1175, 0, 0, 15.88000, 316.330 ) local heavysteam = { } function upperdoorkey ( player, cmd ) local whatteam = getPlayerTeam ( player ) outputChatBox ( "tester" ) if whatteam == "heavysteam" then outputChatBox ( "open sesame" ) moveObject ( upperdoor, 5000, -1156.52, 43.1175, -10 ) setTimer ( moveObject, 8000, 1, upperdoor, 5000, -1156.52, 43.1175, 0 ) setTimer ( outputChatBox, 8000, 1, "close sesame" ) else end end addCommandHandler ( "openupper", upperdoorkey ) function joinateam( source, cmd ) createTeam ( "heavysteam" ) setPlayerTeam ( source, heavysteam ) outputChatBox ( "your on Heavys Team" ) end addCommandHandler ( "heavysside", joinateam ) i have tried a few different ways of checking what team the player is on but everything else i have tried has given me either bad player pointer errors or bad argument errors. not sure where ive gone wrong so any advice would be helpful. the colsphere i was using to with getElementsWithinColShape and then getElementsByType "player" but i got really confused that way so i have tried this now Thanx for l king Link to comment
darkdreamingdan Posted March 18, 2009 Share Posted March 18, 2009 getPlayerTeam only returns the team element. If you want to compare the team name, you need to use getTeamName. So performing a getTeamName check on the player's team should make your if statement work. Also your setPlayerTeam function is flawed. You need to pass the team element. createTeam returns a team element that you can pass into it, however. Link to comment
heavy air Posted March 18, 2009 Author Share Posted March 18, 2009 AWESOME thanks for the help working fine now Link to comment
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