will briggs Posted June 10, 2011 Posted June 10, 2011 Hey, Me again Well im trying to make a gate open on col shape hit but it isnt working... Barrier = createObject ( 968, 1544.6271972656, -1630.3720703125, 13.8182258605957, 0, 0, 0 ) <colrectangle posX="1534.768" posY="-1630.3720703125" posZ="13.8182258605957" width="100" depth="61.8"/> toggle = 0 function toggleBarrier(thePlayer,command) if toggle == 0 then setElementRotation (Barrier, 0, 0, 277) toggle = 1 else setElementRotation (Barrier, 0, 0, 0) toggle = 0 end end function toggleBarrier(thePlayer,command) if toggle == 0 then setElementRotation (Barrier, 0, 0, 277) toggle = 1 else setElementRotation (Barrier, 0, 0, 0) toggle = 0 end end addEventHandler( "onMarkerHit", marker, toggleBarrier ) addEventHandler( "onMarkerHit", marker, toggleBarrier ) Please can someone correct me ? Thanks Founder of SAUR - Founder/Owner of ARC RPG
JR10 Posted June 10, 2011 Posted June 10, 2011 (edited) your whole code is f***ed up 1- there are 2 function with the same name which does the same thing , 2- you are creating the colshape wrong its not a map file use createColCircle createColCuboid createColRectangle createColSphere createColTube createColPolygon 3- next time use [lua.][/lua] without the dot Edited June 10, 2011 by Guest Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Jaysds1 Posted June 10, 2011 Posted June 10, 2011 3- next time use [lua.][/lua.] without the dots Actually it's . My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
JR10 Posted June 10, 2011 Posted June 10, 2011 [lua][/lua] works Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
will briggs Posted June 10, 2011 Author Posted June 10, 2011 your whole code is f***ed up1- there are 2 function with the same name which does the same thing , 2- you are creating the colshape wrong its not a map file use createColCircle createColCuboid createColRectangle createColSphere createColTube createColPolygon 3- next time use Dude, the point of this was to ask if someone could correct it for me, can you do so? Founder of SAUR - Founder/Owner of ARC RPG
JR10 Posted June 10, 2011 Posted June 10, 2011 Barrier = createObject ( 968, 1544.6271972656, -1630.3720703125, 13.8182258605957, 0, 0, 0 ) Col = createColTube(1534.768, -1630.3720703125, 13.8182258605957, 10, 10) addEventHandler('onColShapeHit', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 277) end end ) addEventHandler('onColShapeLeave', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 0) end end ) not tested but should work Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
will briggs Posted June 11, 2011 Author Posted June 11, 2011 Ive tested it, and it aint working, can you test it and see please... Founder of SAUR - Founder/Owner of ARC RPG
JR10 Posted June 11, 2011 Posted June 11, 2011 Barrier = createObject ( 968, 1544.6271972656, -1630.3720703125, 13.8182258605957, 0, 0, 0 ) Col = createColTube(1544.768, -1630.3720703125, 11.8182258605957, 15, 15) addEventHandler('onColShapeHit', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 277) end end ) addEventHandler('onColShapeLeave', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 0) end end ) the col shape was a bit high Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
karlis Posted June 11, 2011 Posted June 11, 2011 3- next time use [lua.][/lua.] without the dots Actually it's . both works. [WIP]GTA IV style hud+custom blips + blip text + circular radar areas
SDK Posted June 11, 2011 Posted June 11, 2011 Dude, the point of this was to ask if someone could correct it for me, can you do so? Actually, the purpose of this forum is: you have a problem with scripting, we offer guidance on how to fix the problem and how to learn from your mistakes. Not: fix my script plz. Learn Lua - Learn to script - GUI scripting Scripter tools - Find/fix errors yourself(!) Don't pm me for scripting help, keep it for the Scripting subforum!
will briggs Posted June 11, 2011 Author Posted June 11, 2011 Ok, Sorry Founder of SAUR - Founder/Owner of ARC RPG
will briggs Posted June 11, 2011 Author Posted June 11, 2011 Does anyone know how to make it move in one sweep, not just cut to the position? Barrier = createObject ( 968, 1544.69, -1630.8, 13.3, 0, 89, 90 ) Col = createColTube(1544.8, -1630.3720703125, 11.8182258605957, 10, 10) addEventHandler('onColShapeHit', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 90) end end ) addEventHandler('onColShapeLeave', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 90, 90) end end ) Thanks Founder of SAUR - Founder/Owner of ARC RPG
JR10 Posted June 11, 2011 Posted June 11, 2011 dont double post use the edit botton ... use move object use the map editor to get the coords of where the object should be and use moveObject(Barrier, 3000, x, y, z) Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
will briggs Posted June 11, 2011 Author Posted June 11, 2011 Thanks and sorry for the double post. Founder of SAUR - Founder/Owner of ARC RPG
JR10 Posted June 11, 2011 Posted June 11, 2011 No problem. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
will briggs Posted June 11, 2011 Author Posted June 11, 2011 Hey, I changed it over to moveobject and its started doing alot of crazy stuff when i enter the colshape, can someone test it for me or tell me whats wrong with it... I think its because of the order setelementrotation was in... Heres the code Barrier = createObject ( 968, 1544.69, -1630.8, 13.3, 0, 89, 90 ) Col = createColTube(1544.8, -1630.3720703125, 11.8182258605957, 10, 10) addEventHandler('onColShapeHit', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then if getTeamName(getPlayerTeam(hitElement))=="Police" then playSoundFrontEnd ( 41 ) moveObject(Barrier, 3000, 1544.69, -1630.8, 13.3, 0, 0, 90) end end end ) addEventHandler('onColShapeLeave', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then if getTeamName(getPlayerTeam(hitElement))=="Police" then moveObject(Barrier, 3000, 1544.69, -1630.8, 13.3, 0, 89, 90) end end end ) Thanks Founder of SAUR - Founder/Owner of ARC RPG
Aibo Posted June 11, 2011 Posted June 11, 2011 moveObject uses relative rotation. so to place it back after you've rotated it 90 on Z axis you need to rotate it -90 degrees on Z axis (not by setting object rotation parameters from createObject) ?
will briggs Posted June 11, 2011 Author Posted June 11, 2011 I added it and its still pretty messed up... Could you correct it for me? Thanks - You help me with everything Founder of SAUR - Founder/Owner of ARC RPG
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