xUltimate Posted October 26, 2010 Share Posted October 26, 2010 I have a small problem, I am trying to make it so when someone in faction 1 (SFPD) hits a area it opens the barrier, but I get this error on load: sfpd/map-outside.lua:17: Bad argument @ 'addEventHandler' The code: function policeDoor(thePlayer) pdb1s = createColRectangle( -1566.64, 665.95, 7.03, 10, 7) if exports.factions:isPlayerInFaction( thePlayer, 1 ) then moveObject(pdd1, 3000, -1620.6579589844, 688.30285644531, 10.809907913208) setTimer(policeDoorClose, 4000, 1) end end addEventHandler ( "onColShapeHit", pdb1s, policeDoor )--Line 17 addCommandHandler("pdd", policeDoor) Link to comment
Castillo Posted October 26, 2010 Share Posted October 26, 2010 of course won't work, you are creating the shape when you enter on it if i'm right can't work like this, try pdb1s = createColRectangle( -1566.64, 665.95, 7.03, 10, 7) function policeDoor(thePlayer) if exports.factions:isPlayerInFaction( thePlayer, 1 ) then moveObject(pdd1, 3000, -1620.6579589844, 688.30285644531, 10.809907913208) setTimer(policeDoorClose, 4000, 1) end end addEventHandler ( "onColShapeHit", pdb1s, policeDoor )--Line 17 addCommandHandler("pdd", policeDoor) Link to comment
xUltimate Posted October 26, 2010 Author Share Posted October 26, 2010 Haha I fixed that problem but it was in the wrong thing, now I have this problem: The barrier will not open pdb1s = createColRectangle( -1566.64, 665.95, 7.03, 10, 7) function policeBarrier() local allPlayers = getElementsByType("player") for index,val in ipairs(allPlayers) do if exports.factions:isPlayerInFaction(val, 1 ) then moveObject(pdb1, 3000, -1572.1899414063, 658.65002441406, 6.8000001907349, 90, 0, 0) setTimer ( policeBarrierClose, 5000, 1) end end end addEventHandler ( "onColShapeHit", pdb1s, policeBarrier ) addCommandHandler("pdb", policeBarrier) Link to comment
Castillo Posted October 26, 2010 Share Posted October 26, 2010 try to give us more information please, like you getting any error at debugscript? /debugscript 3 Link to comment
xUltimate Posted October 26, 2010 Author Share Posted October 26, 2010 Nope, no errors. Link to comment
Castillo Posted October 27, 2010 Share Posted October 27, 2010 can you give me the createObject function, i will try to fix it. Link to comment
xUltimate Posted October 27, 2010 Author Share Posted October 27, 2010 ye pdb1 = createObject(968, -1572.1899414063, 658.70002441406, 6.8500001907349, 0, 90, 90) pdb2 = createObject(968, -1701.4300537109, 687.65997314453, 24.670000076294, 0, 90, -90) As of now im going to sleep, got school, so ill see this tomorrow. Link to comment
Castillo Posted October 27, 2010 Share Posted October 27, 2010 oh yeah, its moving but in wrong position, check again the cordinates. Link to comment
xUltimate Posted October 27, 2010 Author Share Posted October 27, 2010 oh yeah, its moving but in wrong position, check again the cordinates. Coordinates look fine to me, the object isnt even moving for me, but the cmd works. Link to comment
dzek (varez) Posted October 27, 2010 Share Posted October 27, 2010 Debug? https://wiki.multitheftauto.com/wiki/Debugging local test = moveObject(......) outputDebugString (tostring(test)) Link to comment
xUltimate Posted October 27, 2010 Author Share Posted October 27, 2010 I already debugged and everything, no errors, no nothing. Link to comment
Castillo Posted October 27, 2010 Share Posted October 27, 2010 You added the line varez said? 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