lucascba Posted July 8, 2014 Share Posted July 8, 2014 Hi,I would like to know how to make a door (gate) which will only be for a group of gang system of castillo. Thank you. Link to comment
-.Paradox.- Posted July 8, 2014 Share Posted July 8, 2014 use getElementData --To get the gang's name createObject moveObject addCommandHandler Link to comment
lucascba Posted July 8, 2014 Author Share Posted July 8, 2014 but as the gang get the player because it is with getElementData but as would be the line? To explain better what I did with the "Team" of a player not with the gang look: function Funcion (source) playerTeam = getPlayerTeam ( source ) Clann = getTeamFromName ( "TeamName" ) As would be with the gang system? sorry for my bad English Link to comment
Mr_Moose Posted July 8, 2014 Share Posted July 8, 2014 (edited) -- All gates and their data gate = { -- ObjectID closeX closeY closeZ openX openY openZ rotX rotY rotZ colX colY colZ colRad Group Scale [1]={ 11327, 1587.7, -1638.4, 14.8, 1587.7, -1638.4, 20, 0, 0, 90, 1588, -1638, 10, 10, "ISA", 1 }, [2]={ 10671, -1631, 688.4, 9.587, -1631, 688.4, 20.187, 0, 0, 90, -1631, 688, 7.187, 10, "ISA", 2 }, [3]={ 11327, 2334.6, 2443.7, 7.70, 2334.6, 2443.7, 15.70, 0, 0, -30, 2334.6, 2443.7, 5.70, 10, "ISA", 1.3 }, [4]={ 11327, 2294, 2497.4, 5.3, 2294, 2497.4, 14.3, 0, 0, 0, 2294, 2497.6, 4.3, 15, "ISA", 1.2 }, } -- Global data members gates = { } cols = { } ocpenSpeed = 3000 -- Add all gates function mapLoad ( name ) for k=1, #gate do -- Create objects local gat = createObject( gate[k][1], gate[k][2], gate[k][3], gate[k][4], gate[k][8], gate[k][9], gate[k][10] ) local col = createColCircle( gate[k][11], gate[k][12], gate[k][13], gate[k][14] ) setObjectScale( gat, gate[k][16] ) -- Assign arrays of object pointers gates[col] = gat cols[col] = k -- Add event handlers addEventHandler("onColShapeHit", col, openGate ) addEventHandler("onColShapeLeave", col, closeGate ) end end addEventHandler ( "onResourceStart", getResourceRootElement(), mapLoad ) -- Gates open function openGate(player) local ID = cols[source] if isElement(player) and ( getElementData(player, "Group" ) == gate[ID][15] or getElementData(player, "Group" ) == "ACRP" ) or getPlayerTeam(player) == getTeamFromName("Staff") then moveObject(gates[source], ocpenSpeed, gate[ID][5], gate[ID][6], gate[ID][7] ) end end -- Gates close function closeGate(player) local ID = cols[source] if isElement(player) and ( getElementData(player, "Group" ) == gate[ID][15] or getElementData(player, "Group" ) == "ACRP" ) or getPlayerTeam(player) == getTeamFromName("Staff") then moveObject(gates[source], ocpenSpeed, gate[ID][2], gate[ID][3], gate[ID][4] ) end end A complete gate system with some predefined groups and gates on the police departments in all cities, source: http://forum.404rq.com/index.php/topic,242.0.html#forum Edited August 16, 2015 by Guest Link to comment
lucascba Posted July 8, 2014 Author Share Posted July 8, 2014 and how I can add these lines to my resource? objeto = createObject (980 , 135.5255859375, 1940.83203125, 20.809717178345, 0, 0, 179.75 ) x,y,z = getElementPosition (objeto) Zona = createColCircle ( x,y, 5, 5 ) function Funcion (source) playerTeam = getPlayerTeam ( source ) Clann = getTeamFromName ( "ArmedForces" ) if ( playerTeam ) == Clann then moveObject ( objeto, 300, 135.7255859375, 1940.83203125, 15.309717178345, 0, 0, 0 ) outputChatBox ( "", source, 0, 255, 0, true ) else outputChatBox ( "Tu no eres Un Militar!", source, 255, 0, 0, true ) end end addEventHandler ( "onColShapeHit", Zona, Funcion ) function Funcion2 () moveObject ( objeto, 300, 135.7255859375, 1940.83203125, 21.309717178345, 0, 0, 0 ) outputChatBox ( "Adios Soldado", source, 0, 255, 0, true ) end addEventHandler ( "onColShapeLeave", Zona, Funcion2 ) PD: this resource is Azno10 Link to comment
Mr_Moose Posted July 8, 2014 Share Posted July 8, 2014 You don't need to add anything actually, it's a complete resource. What you can do is to copy the data of your createObject function to the table according to the description in order to create a gate in a place you already chosen. Or try it out as it is by visiting LSPD garage and observe the gate there how it works according to the script. 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