illestiraqi Posted March 6, 2013 Share Posted March 6, 2013 This gate opens and closes with /openadm, and /closeadm, I want this all changed but keep the gates. I want the gates to open if user in "SWAT" gang is in it and to close but only opens and closes when user in "SWAT" gang is in it. function createTheGate () myGate1 = createObject ( 980, 1278.5, -1651.8000488281, 15.300000190735, 0, 0, 270 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate ) function openMyGate ( ) moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 9.8000001907349 ) end addCommandHandler("openadm",openMyGate) function movingMyGateBack () moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 15.300000190735 ) end addCommandHandler("closeadm",movingMyGateBack) Link to comment
WASSIm. Posted March 6, 2013 Share Posted March 6, 2013 try this: local myGate1 = createObject ( 980, 1278.5, -1651.8000488281, 15.300000190735, 0, 0, 270 ) function openMyGate ( ) if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 9.8000001907349 ) end end addCommandHandler("openadm",openMyGate) function movingMyGateBack () if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 15.300000190735 ) end end addCommandHandler("closeadm",movingMyGateBack) Link to comment
illestiraqi Posted March 6, 2013 Author Share Posted March 6, 2013 try this: local myGate1 = createObject ( 980, 1278.5, -1651.8000488281, 15.300000190735, 0, 0, 270 ) function openMyGate ( ) if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 9.8000001907349 ) end end addCommandHandler("openadm",openMyGate) function movingMyGateBack () if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 15.300000190735 ) end end addCommandHandler("closeadm",movingMyGateBack) Remove the commands thing. I want the gates to trigger open/close when user in "SWAT" gang goes near it. Link to comment
WASSIm. Posted March 6, 2013 Share Posted March 6, 2013 local myGate1 = createObject ( 980, 1278.5, -1651.8000488281, 15.300000190735, 0, 0, 270 ) local marker = createMarker( -713.90002441406, 973.20001220703, 14, "cylinder", 10, 255, 255, 255, 0) function openMyGate ( ) if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 9.8000001907349 ) end end addEventHandler("onMarkerHit", marker, openMyGate) function movingMyGateBack () if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 15.300000190735 ) end end addEventHandler("onMarkerLeave", marker, movingMyGateBack) Link to comment
illestiraqi Posted March 6, 2013 Author Share Posted March 6, 2013 local myGate1 = createObject ( 980, 1278.5, -1651.8000488281, 15.300000190735, 0, 0, 270 ) local marker = createMarker( -713.90002441406, 973.20001220703, 14, "cylinder", 10, 255, 255, 255, 0) function openMyGate ( ) if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 9.8000001907349 ) end end addEventHandler("onMarkerHit", marker, openMyGate) function movingMyGateBack () if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 15.300000190735 ) end end addEventHandler("onMarkerLeave", marker, movingMyGateBack) Why df is there this? local marker = createMarker( -713.90002441406, 973.20001220703, 14, "cylinder", 10, 255, 255, 255, 0) I think that just triggers the gate if user in "SWAT" team goes on the cylinder witch i dont want. I want the gates there, and user in "SWAT" group if they walk near them than it opens, no need for marker. Link to comment
WASSIm. Posted March 6, 2013 Share Posted March 6, 2013 you need this for auto open/close gate createMarker or createColCircle Link to comment
Castillo Posted March 6, 2013 Share Posted March 6, 2013 local myGate1 = createObject ( 980, 1278.5, -1651.8000488281, 15.300000190735, 0, 0, 270 ) local marker = createMarker( -713.90002441406, 973.20001220703, 14, "cylinder", 10, 255, 255, 255, 0) function openMyGate ( ) if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 9.8000001907349 ) end end addEventHandler("onMarkerHit", marker, openMyGate) function movingMyGateBack () if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 15.300000190735 ) end end addEventHandler("onMarkerLeave", marker, movingMyGateBack) 'source' in your script is the marker you just hit, not the player that hit it. Link to comment
OGF Posted March 6, 2013 Share Posted March 6, 2013 team getPlayerTeam ( player thePlayer ) you could try using this to make this less complicated. Link to comment
Castillo Posted March 6, 2013 Share Posted March 6, 2013 He's talking about my gang system, which is not team based, so that obviously wouldn't work. Link to comment
OGF Posted March 6, 2013 Share Posted March 6, 2013 Oh, I completely ignored the fact it was something else. forget what I said. Link to comment
illestiraqi Posted March 6, 2013 Author Share Posted March 6, 2013 So whats the code? Link to comment
PaiN^ Posted March 6, 2013 Share Posted March 6, 2013 local myGate1 = createObject ( 980, 1278.5, -1651.8000488281, 15.300000190735, 0, 0, 270 ) local marker = createMarker( -713.90002441406, 973.20001220703, 14, "cylinder", 10, 255, 255, 255, 0) addEventHandler("onMarkerHit", marker, function (hitElement) if getElementType(hitElement) == "player" then if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 9.8000001907349 ) end end end ) addEventHandler("onMarkerLeave", marker, function (leftElement) if getElementType(leftElement) == "player" then if (getElementData(source, "gang") == "SWAT") then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 15.300000190735 ) end end end ) Link to comment
Castillo Posted March 6, 2013 Share Posted March 6, 2013 local myGate1 = createObject ( 980, 1278.5, -1651.8000488281, 15.300000190735, 0, 0, 270 ) local marker = createMarker( -713.90002441406, 973.20001220703, 14, "cylinder", 10, 255, 255, 255, 0) addEventHandler ( "onMarkerHit", marker, function ( hitElement ) if ( getElementType ( hitElement ) == "player" ) then if ( getElementData ( hitElement, "gang") == "SWAT" ) then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 9.8000001907349 ) end end end ) addEventHandler ( "onMarkerLeave", marker, function ( leftElement ) if ( getElementType ( leftElement ) == "player" ) then if ( getElementData ( leftElement, "gang" ) == "SWAT" ) then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 15.300000190735 ) end end end ) Link to comment
PaiN^ Posted March 6, 2013 Share Posted March 6, 2013 local myGate1 = createObject ( 980, 1278.5, -1651.8000488281, 15.300000190735, 0, 0, 270 ) local marker = createMarker( -713.90002441406, 973.20001220703, 14, "cylinder", 10, 255, 255, 255, 0) addEventHandler ( "onMarkerHit", marker, function ( hitElement ) if ( getElementType ( hitElement ) == "player" ) then if ( getElementData ( hitElement, "gang") == "SWAT" ) then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 9.8000001907349 ) end end end ) addEventHandler ( "onMarkerLeave", marker, function ( leftElement ) if ( getElementType ( leftElement ) == "player" ) then if ( getElementData ( leftElement, "gang" ) == "SWAT" ) then moveObject ( myGate1, 2500, 1278.5, -1651.8000488281, 15.300000190735 ) end end end ) What have you changed in my code .? EDIT: LooL saw it, Thanx Link to comment
illestiraqi Posted March 7, 2013 Author Share Posted March 7, 2013 Lol you guys didn't read my 2nd latest post, I want the cylinder thing removed, the gate should only trigger open when user in swat gang is near it, and close when is not near it. :L Link to comment
illestiraqi Posted March 7, 2013 Author Share Posted March 7, 2013 Use colshapes then. Like I said, I don't know how to add stuff like that and that's why I posted this here to have help for my server. Link to comment
Castillo Posted March 7, 2013 Share Posted March 7, 2013 I think that you aren't getting the point of this section right, here we help you to fix your scripts, we don't make them for you, so, you should try to make the script, if it doesn't work, post it here and we help you. Link to comment
illestiraqi Posted March 7, 2013 Author Share Posted March 7, 2013 I think that you aren't getting the point of this section right, here we help you to fix your scripts, we don't make them for you, so, you should try to make the script, if it doesn't work, post it here and we help you. The first script (Main Topic part) is basically my script, once I try the script will get fked up so theres no point of me trying, all I'm asking for the cylinder removed because I just want it to open if user in SWAT gang goes near it and to close. Link to comment
OGF Posted March 7, 2013 Share Posted March 7, 2013 The first script (Main Topic part) is basically my script, once I try the script will get fked up so theres no point of me trying, all I'm asking for the cylinder removed because I just want it to open if user in SWAT gang goes near it and to close. Then replace the marker line with colshape createColCircle ( float fX, float fY, float radius ) Or colshape createColRectangle ( float fX, float fY, float fWidth, float fHeight) Then with events onColShapeHit onColShapeLeave You can also check the shapes using https://wiki.multitheftauto.com/wiki/SetDevelopmentMode Like snake said this area is to get help not get people to do them for you. If you want them done some people are offering to do it for cash. Link to comment
illestiraqi Posted March 8, 2013 Author Share Posted March 8, 2013 The first script (Main Topic part) is basically my script, once I try the script will get fked up so theres no point of me trying, all I'm asking for the cylinder removed because I just want it to open if user in SWAT gang goes near it and to close. Then replace the marker line with colshape createColCircle ( float fX, float fY, float radius ) Or colshape createColRectangle ( float fX, float fY, float fWidth, float fHeight) Then with events onColShapeHit onColShapeLeave You can also check the shapes using https://wiki.multitheftauto.com/wiki/SetDevelopmentMode Like snake said this area is to get help not get people to do them for you. If you want them done some people are offering to do it for cash. Can the script be made because I just wanted my gate changed by having commands removed and open by users in castillo's gang system in SWAT gang 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