Ab-47 Posted December 24, 2012 Posted December 24, 2012 What does this do? Simple, enter the col-shape forcing the gate to move the the next co-ordinates. Using these co-ordinates determines which ways you'd like the gate to move, Left Right, Down, Up. Setting elements rotations whilst moving would come in a next step in scripting, for this simple script I'll only add an adjustment to the starting position which we call: Closed. gate = createObject( ID, x, y, z ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. setElementRotation ( gate, x, y, z ) --Co-Ordinates to your start of rotation gatecol = createColCircle ( x, y, radius ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. function openagates(thePlayer) if getElementModel( thePlayer ) == 217 then --Will open only if the player is in the male staff skin moveObject ( gate, speed, x, y, z ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. end end addEventHandler( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function function closeagates(thePlayer) if getElementModel( thePlayer ) == 217 then --Will close only if the player is in the male staff skin moveObject (gate1, speed, x, y, z) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. end end addEventHandler( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function How to construct it? Simple fill in the co-ordinates and values to whichever position you like, with whatever object ID you want to use, add the col-shapes co-ordinates where when the player enters the col-shape it triggers the function. You can also change that "if" statement to any other way of opening it, like getPedOccupation or getPlayerTeam etc. For more information follow a forum PM or contact me via IRC @ irc.gtanet.com / #UIP
Ab-47 Posted January 3, 2013 Author Posted January 3, 2013 Wrong section. Which board should it be in? Board says; 'Showroom', I'm clearly showing my script to the public just telling them how to construct it in whichever coods they want. Hmm, I've been here for a small while, and I'm pretty sure this is the correct place. (Correct me if I'm wrong, please) And thanks.
GTX Posted January 3, 2013 Posted January 3, 2013 This is the right section: viewforum.php?f=148 This section is a map showroom .
Ab-47 Posted January 14, 2013 Author Posted January 14, 2013 This is the right section: viewforum.php?f=148This section is a map showroom . Ohhh.. I'm absolutely sorry both of you for posting in the wrong place. Kindly could a moderator move this board to the correct place D: thanks Nvm thanks moderators
maky55 Posted February 14, 2013 Posted February 14, 2013 With the help with Castillo(Solidsnake14) You can have it 3 ways: By skin: gate = createObject( ID, x, y, z ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. setElementRotation ( gate, x, y, z ) --Co-Ordinates to your start of rotation gatecol = createColCircle ( x, y, radius ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. function openagates(thePlayer) if getElementModel( thePlayer ) == PutSkinHear then moveObject ( gate, speed, x, y, z ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. end end addEventHandler( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function function closeagates(thePlayer) if getElementModel( thePlayer ) == PutSkinHear then moveObject (gate1, speed, x, y, z) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. end end addEventHandler( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function By team: gate = createObject( putObjectIdHear, PutXHear, PutYHear, PutZHear ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. gatecol = createColCircle ( putXhear, putYhear, putRadiushear ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. function openagates ( thePlayer ) if ( getElementType ( thePlayer ) == "player" ) then local team = getPlayerTeam ( thePlayer ) local teamName = ( team and getTeamName ( team ) or "" ) if ( teamName == "putTeamHear" ) then moveObject ( gate, 2000, PutXHear, PutYHear, PutZHear ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. else outputChatBox ( "Sorry, you can not open this gate as you are not in the specified groups", thePlayer ) end end end addEventHandler ( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function function closeagates(thePlayer) if ( getElementType ( thePlayer ) == "player" ) then local team = getPlayerTeam ( thePlayer ) local teamName = ( team and getTeamName ( team ) or "" ) if ( teamName == "PutTeamNameHear" ) then moveObject ( gate, 2000, putOrriginalXhear, putOrriginalYhear, putorriginalZhear ) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. end end end addEventHandler ( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function By ACL Group: gate = createObject([b]putObjectIdHear, PutXHear, PutYHear, PutZHear, 0, 0, 0 [/b]) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. gatecol = createColCircle ( [b]putXhear, putYhear, putRadiusHear[/b] ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. function openagates ( thePlayer ) if ( getElementType ( thePlayer ) == "player" ) then if ( isPlayerInGroup ( thePlayer ) ) then moveObject ( gate, [b]putXhear, putYhear, putZhear[/b] ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. else outputChatBox ( "Sorry, you can not open this gate as you are not in the specified groups", thePlayer ) end end end addEventHandler ( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function function closeagates ( thePlayer ) if ( getElementType ( thePlayer ) == "player" ) then if ( isPlayerInGroup ( thePlayer ) ) then moveObject ( gate, [b]putOrriginalXhear, putOrriginalYhear, putorriginalZhear[/b] ) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. end end end addEventHandler ( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function function isPlayerInGroup ( thePlayer ) local accountName = getAccountName ( getPlayerAccount ( thePlayer ) ) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) then return true else return false end end Hope this helps! Thanks to Castillo for the help in changing the script!
|xTR|Silver Posted March 6, 2014 Posted March 6, 2014 @maky55 , thx dude its working , but how can i rotate it ?? , iam new to scripting but i can do some basics.... , please reply
Saml1er Posted March 6, 2014 Posted March 6, 2014 @maky55 , thx dude its working , but how can i rotate it ?? , iam new to scripting but i can do some basics.... , please reply setElementRotation
Hell-Mate Posted March 6, 2014 Posted March 6, 2014 user getElementRotation and setElementRotation rX, rY, rZ = getElementRotation ( gate ) setElementRotation ( gate, rX, rY,rZ, true ) well for example if you want to rotate from Z then it will look like this setElementRotation ( gate, 0, 0, rZ+50, true ) + 50 is the amount of rotation.
|xTR|Silver Posted March 6, 2014 Posted March 6, 2014 gate = createObject( 980, 2253.1000976563, 512.5, 2 ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. gatecol = createColCircle ( 2253.1000976563, 512.5, 25 ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. function openagates ( thePlayer ) if ( getElementType ( thePlayer ) == "player" ) then local team = getPlayerTeam ( thePlayer ) local teamName = ( team and getTeamName ( team ) or "" ) if ( teamName == "Staff" ) then moveObject ( gate, 2000, 2253.1000976563, 512.5, -3 ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. else outputChatBox ( "Sorry, you can not open this gate as you are not in the specified groups", thePlayer ) end end end addEventHandler ( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function function closeagates(thePlayer) if ( getElementType ( thePlayer ) == "player" ) then local team = getPlayerTeam ( thePlayer ) local teamName = ( team and getTeamName ( team ) or "" ) if ( teamName == "Staff" ) then moveObject ( gate, 1000, 2253.1000976563, 512.5, 2 ) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. rX, rY, rZ = getElementRotation ( gate ) setElementRotation ( gate, rX, rY,rZ+272, true ) end end end addEventHandler ( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function i should put it like that ?? , iam a newbie on scripting
Ab-47 Posted March 7, 2014 Author Posted March 7, 2014 gate = createObject( 980, 2253.1000976563, 512.5, 2 ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. gatecol = createColCircle ( 2253.1000976563, 512.5, 25 ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. function openagates ( thePlayer ) if ( getElementType ( thePlayer ) == "player" ) then local team = getPlayerTeam ( thePlayer ) local teamName = ( team and getTeamName ( team ) or "" ) if ( teamName == "Staff" ) then moveObject ( gate, 2000, 2253.1000976563, 512.5, -3 ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. else outputChatBox ( "Sorry, you can not open this gate as you are not in the specified groups", thePlayer ) end end end addEventHandler ( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function function closeagates(thePlayer) if ( getElementType ( thePlayer ) == "player" ) then local team = getPlayerTeam ( thePlayer ) local teamName = ( team and getTeamName ( team ) or "" ) if ( teamName == "Staff" ) then moveObject ( gate, 1000, 2253.1000976563, 512.5, 2 ) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. rX, rY, rZ = getElementRotation ( gate ) setElementRotation ( gate, rX, rY,rZ+272, true ) end end end addEventHandler ( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function i should put it like that ?? , iam a newbie on scripting What are you trying to do? I've cleared it up for you (not tested), but what you're doing is entering a col shape, opening the gate then when you leave the colshape, it closes and rotates to rot z 272 degrees.. local gate = createObject( 980, 2253.1000976563, 512.5, 2 ) --Object ID (Airport Gate=978) & Co-Ordinates of your gates start of position. local gatecol = createColCircle ( 2253.1000976563, 512.5, 25 ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. local team = getPlayerTeam ( localPlayer ) local teamName = (getTeamName ( team )) function openagates ( thePlayer ) if ( getElementType ( thePlayer ) == "player" ) then if ( teamName == "Staff" ) then moveObject ( gate, 2000, 2253.1000976563, 512.5, -3 ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. else outputChatBox ( "Sorry, you can not open this gate as you are not in the specified groups", thePlayer ) end end end addEventHandler ( "onColShapeHit", gatecol, openagates ) --Event Handler to trigger the function function closeagates(thePlayer) if ( getElementType ( thePlayer ) == "player" ) then if ( teamName == "Staff" ) then moveObject ( gate, 1000, 2253.1000976563, 512.5, 2 ) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. rX, rY, rZ = getElementRotation ( gate ) setElementRotation ( gate, rX, rY,rZ+272, true ) end end end addEventHandler ( "onColShapeLeave", gatecol, closeagates ) --Event Handler to trigger the function
|xTR|Silver Posted March 7, 2014 Posted March 7, 2014 Thx , but.... , its working now , thanks again anyway
Ab-47 Posted March 11, 2014 Author Posted March 11, 2014 Thx , but.... , its working now , thanks again anyway Your welcome
Recommended Posts