Jump to content

Help with Gate, Castillo's Gang System


Recommended Posts

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

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
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
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
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
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
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
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
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
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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...