igthomas Posted February 16, 2013 Share Posted February 16, 2013 Hi, recently I was converting every of my gates script from getElementModel to getTeamName and I'm getting an error it's not really affecting the scripts but its annoying because more players are on the server more bigger the ouput in log file is gate1= createObject ( 2927, 215.878, 1875.722, 13.93899, 0, 0, 0 ) gate1_2 = createObject ( 2927, 211.7866, 1875.726, 13.93899, 0, 0, 0 ) marker_gate1 = createMarker(213.93994,1875.98022,10.3468,"cylinder",5, 225, 225, 0, 0 ) function open_gate1(hitElement) local armyTeam = getPlayerTeam ( hitElement ) if getTeamName(armyTeam) == "Army" then moveObject ( gate1, 2000, 219.9222, 1875.722, 13.93899 ) moveObject ( gate1_2, 2000, 207.98663, 1875.726, 13.93899 ) end end addEventHandler ("onMarkerHit",marker_gate1,open_gate1) function close_gate1(hitElement) local armyTeam = getPlayerTeam (hitElement) if getTeamName(armyTeam) == "Army" then moveObject ( gate1, 2000, 215.878, 1875.722, 13.93899 ) moveObject ( gate1_2, 2000, 211.7866, 1875.726, 13.93899 ) end end addEventHandler ("onMarkerLeave",marker_gate1,close_gate1) Here's the error: WARNING: Gates\server.lua:5: Bad 'player' pointer @ 'getPlayerTeam'(1) WARNING: Gates\server.lua:6: Bad argument @ 'getTeamName' From what I've discovered this only happens when the player is on a vehicle and opens the gate, ofc the gate opens but it outputs this annoying error Link to comment
iPrestege Posted February 16, 2013 Share Posted February 16, 2013 -- Server Side .. gate1= createObject ( 2927, 215.878, 1875.722, 13.93899, 0, 0, 0 ) gate1_2 = createObject ( 2927, 211.7866, 1875.726, 13.93899, 0, 0, 0 ) marker_gate1 = createMarker(213.93994,1875.98022,10.3468,"cylinder",5, 225, 225, 0, 0 ) function open_gate1(hitElement) if ( getElementType (hitElement) == "player" ) then local armyTeam = getPlayerTeam (hitElement) if ( armyTeam and getTeamName ( armyTeam ) == "Army" ) then outputChatBox ( "Welcome!",hitElement,0,255,0) else outputChatBox ( "You Are Not In Army team !!",hitElement,255,0,0) moveObject ( gate1, 2000, 219.9222, 1875.722, 13.93899 ) moveObject ( gate1_2, 2000, 207.98663, 1875.726, 13.93899 ) end end end addEventHandler ("onMarkerHit",marker_gate1,open_gate1) function close_gate1(hitElement) if ( getElementType (hitElement) == "player" ) then local armyTeam = getPlayerTeam (hitElement) if ( armyTeam and getTeamName ( armyTeam ) == "Army" ) then outputChatBox ( "Welcome!",hitElement,0,255,0) else outputChatBox ( "You Are Not In Army team !!",hitElement,255,0,0) moveObject ( gate1, 2000, 215.878, 1875.722, 13.93899 ) moveObject ( gate1_2, 2000, 211.7866, 1875.726, 13.93899 ) end end end addEventHandler ("onMarkerLeave",marker_gate1,close_gate1) Link to comment
igthomas Posted February 16, 2013 Author Share Posted February 16, 2013 Thanks man no more errors 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