ViRuZGamiing Posted December 28, 2012 Share Posted December 28, 2012 Hello Community, here's my script: local gate = createObject(7709, -2122.5, 381.89999389648, 35.700000762939, 0, 0, 358) function open() moveObject(gate, -2122.5, 381.89999389648, 30, 0, 0, 358 ) end addCommandHandler("open", open) function close() moveObject(gate, -2122.5, 381.89999389648, 35.700000762939, 0, 0, 358 ) end addCommandHandler("close", close) My Problem: When /open the Gate is Invisible but still there When /close nothing happens. Please help me, Thanks Link to comment
TAPL Posted December 28, 2012 Share Posted December 28, 2012 You forgot argument "time" at moveObject time: The time in milliseconds the object will arrive at the destination. local gate = createObject(7709, -2122.5, 381.89999389648, 35.700000762939, 0, 0, 358) function open() moveObject(gate, 2500, -2122.5, 381.89999389648, 30, 0, 0, 358 ) end addCommandHandler("open", open) function close() moveObject(gate, 2500, -2122.5, 381.89999389648, 35.700000762939, 0, 0, 358 ) end addCommandHandler("close", close) Link to comment
ViRuZGamiing Posted December 28, 2012 Author Share Posted December 28, 2012 The gate goes open and closes but: It Rotates while opening and closing, When open I can enter there is an Invisable wall Link to comment
denny199 Posted December 28, 2012 Share Posted December 28, 2012 You had the rotation set to 358 while moving. local gate = createObject(7709, -2122.5, 381.89999389648, 35.700000762939, 0, 0, 358) function open() moveObject(gate, 2500, -2122.5, 381.89999389648, 30, 0, 0, 0 ) end addCommandHandler("open", open) function close() moveObject(gate, 2500, -2122.5, 381.89999389648, 35.700000762939, 0, 0, 0 ) end addCommandHandler("close", close) BTW, you can move the gate with one command with this code: local gate = createObject(7709, -2122.5, 381.89999389648, 35.700000762939, 0, 0, 358) megusta = false addCommandHandler("openclose", function () if (megusta == false) then moveObject(gate, 2500, -2122.5, 381.89999389648, 30, 0, 0, 0 ) megusta = true elseif (megusta == true) then moveObject(gate, 2500, -2122.5, 381.89999389648, 35.700000762939, 0, 0, 0 ) megusta = false end end) Link to comment
ViRuZGamiing Posted December 28, 2012 Author Share Posted December 28, 2012 1 Command is much better, the invisable wall is fixed (Mapping problem) Thanks. Problem solved /close Link to comment
ViRuZGamiing Posted December 28, 2012 Author Share Posted December 28, 2012 Can I also let the Gate go open when a Car is near? But only for Busses ''no other cars'' Link to comment
manve1 Posted December 28, 2012 Share Posted December 28, 2012 U can make it on a col shape, so when a person driving a vehicle hits the col shape, it gets his vehicle if it matches up (( the vehicle to the specified vehicle )) it will move the object. Link to comment
ViRuZGamiing Posted December 28, 2012 Author Share Posted December 28, 2012 Can you show me the Col thing? My Coördinates Open: "object (barrierturn) (1)" interior="0" alpha="255" doublesided="true" model="968" scale="1" dimension="0" posX="-2063.5" posY="1371.0999755859" posZ="7.0999999046326" rotX="0" rotY="0" rotZ="0"> Closed: "object (barrierturn) (1)" interior="0" alpha="255" doublesided="true" model="968" scale="1" dimension="0" posX="-2063.5" posY="1371.0999755859" posZ="7.0999999046326" rotX="0" rotY="270" rotZ="0"> Link to comment
manve1 Posted December 28, 2012 Share Posted December 28, 2012 A col shape is a still object unless u attach it to something moving, but u can use: createColRectangle click on it, and read, u should understand it. Link to comment
ViRuZGamiing Posted December 28, 2012 Author Share Posted December 28, 2012 Do I replace colshape createColRectangle ( float fX, float fY, float fWidth, float fHeight) for the addCommandHandler? Please I'm really a noob in scripting and I don't understand the WIKI language Link to comment
manve1 Posted December 28, 2012 Share Posted December 28, 2012 It explains everything ... it takes only about minute or 2 to read the whole thing. and create the col shape by side of the gate .. so it is on both sides ... Link to comment
denny199 Posted December 29, 2012 Share Posted December 29, 2012 Here ya go, with explanations bargate = createObject (968,-2063.5,1371.0999755859,7.0999999046326,0,270,0) -- creating the object damarker = createMarker (-2066.81201, 1370.72888, 6.90067, "cylinder", 9.5, 255, 0, 0, 100 ) -- the last thing 255,0,0,0 = the color & the alpha so: Red,Green,Blue,alpha, so the alpha is 0 so you can't see the marker moving = false function gatefunc(hitPlayer) if getElementType ( hitPlayer ) == "player" and isPedInVehicle(hitPlayer) and (moving == false ) then -- you want to chek if the hitElement is a player and if it's in a vehicle, because you only want to do this for busses. --and because you are working with rotations, you need to chek if it's moving. or else it will rotate sometimes twice when two people are hitting it. veh = getPedOccupiedVehicle ( hitPlayer ) -- get the players vehicle if getElementModel ( veh ) == 431 then -- if the players vehicle is 431 so the bus then it will execute these lines underneath moving = true moveObject(bargate, 1500, -2063.5,1371.0999755859,7.0999999046326, 0,90,0 ) end end end addEventHandler ("onMarkerHit",damarker, gatefunc ) -- adding event when the player will hit the marker function gatefuncclose(leavePlayer) if getElementType ( leavePlayer ) == "player" and isPedInVehicle(leavePlayer) and ( moving == true ) then -- you want to chek if the hitElement is a player and if it's in a vehicle, because you only want to do this for busses. --chekking if it's moving or else when it's already done it will rotateback veh = getPedOccupiedVehicle ( leavePlayer ) -- get the players vehicle if getElementModel ( veh ) == 431 then -- if the players vehicle is 431 so the bus then it will execute these lines underneath moving = false moveObject(bargate, 1500, -2063.5,1371.0999755859,7.0999999046326, 0,-90,0 ) end end end addEventHandler ("onMarkerLeave",damarker, gatefuncclose ) -- adding event when the player will leave the marker Link to comment
ViRuZGamiing Posted December 29, 2012 Author Share Posted December 29, 2012 Now i use your script denny, The Gate won't open when bus is near, I see the Red Marker (Not supposed to be vissable) I the bus of the Bus Job Script I have. normally no problem. Please Help Link to comment
Vision Posted December 29, 2012 Share Posted December 29, 2012 Try this bargate = createObject (968,-2063.5,1371.0999755859,7.0999999046326,0,270,0) damarker = createMarker (-2066.81201, 1370.72888, 6.90067, "cylinder", 9.5, 255, 0, 0, 100 ) isMoving = false function gatefunc( hitPlayer ) if ( getElementType ( hitPlayer ) == "player" and isPedInVehicle( hitPlayer ) ) then local veh = getElementModel ( getPedOccupiedVehicle ( hitPlayer ) ) if ( veh == 431 ) then isMoving = true moveObject( bargate, 1500, -2063.5, 1371.0999755859, 7.0999999046326, 0, 90, 0 ) end end end addEventHandler( "onMarkerHit", damarker, gatefunc ) function gatefuncclose( hitPlayer ) if ( getElementType( hitPlayer ) == "player" and isPedInVehicle( hitPlayer ) ) then local veh = getElementModel( getPedOccupiedVehicle( hitPlayer ) ) if ( veh == 431 ) then isMoving = false moveObject( bargate, 1500, -2063.5, 1371.0999755859, 7.0999999046326, 0, -90, 0 ) end end end addEventHandler( "onMarkerLeave", damarker, gatefuncclose ) Link to comment
TAPL Posted December 29, 2012 Share Posted December 29, 2012 Try this bargate = createObject (968,-2063.5,1371.0999755859,7.0999999046326,0,270,0) damarker = createMarker (-2066.81201, 1370.72888, 6.90067, "cylinder", 9.5, 255, 0, 0, 100 ) isMoving = false function gatefunc( hitPlayer ) if ( getElementType ( hitPlayer ) == "player" and isPedInVehicle( hitPlayer ) ) then local veh = getElementModel ( getPedOccupiedVehicle ( hitPlayer ) ) if ( veh == 431 ) then isMoving = true moveObject( bargate, 1500, -2063.5, 1371.0999755859, 7.0999999046326, 0, 90, 0 ) end end end addEventHandler( "onMarkerHit", damarker, gatefunc ) function gatefuncclose( hitPlayer ) if ( getElementType( hitPlayer ) == "player" and isPedInVehicle( hitPlayer ) ) then local veh = getElementModel( getPedOccupiedVehicle( hitPlayer ) ) if ( veh == 431 ) then isMoving = false moveObject( bargate, 1500, -2063.5, 1371.0999755859, 7.0999999046326, 0, -90, 0 ) end end end addEventHandler( "onMarkerLeave", damarker, gatefuncclose ) isMoving not used at all. Link to comment
ViRuZGamiing Posted December 29, 2012 Author Share Posted December 29, 2012 @TAPL, Is this Script correct of "Castro" or not? Link to comment
ViRuZGamiing Posted December 29, 2012 Author Share Posted December 29, 2012 The gate still don't open and the marker is Vissable. Same Problem, differtent script. I'll think i delete the Gate Link to comment
TAPL Posted December 29, 2012 Share Posted December 29, 2012 -- Server Side -- bargate = createObject (968,-2063.5,1371.0999755859,7.0999999046326,0,270,0) damarker = createMarker (-2066.81201, 1370.72888, 6.90067, "cylinder", 9.5, 255, 0, 0, 0 ) isMoving = false function gatefunc( hitPlayer ) if ( getElementType ( hitPlayer ) == "player" and isPedInVehicle( hitPlayer ) ) then local veh = getElementModel ( getPedOccupiedVehicle ( hitPlayer ) ) if ( veh == 431 ) and not isMoving then isMoving = true moveObject( bargate, 1500, -2063.5, 1371.0999755859, 7.0999999046326, 0, 90, 0 ) end end end addEventHandler( "onMarkerHit", damarker, gatefunc ) function gatefuncclose( hitPlayer ) if ( getElementType( hitPlayer ) == "player" and isPedInVehicle( hitPlayer ) ) then local veh = getElementModel( getPedOccupiedVehicle( hitPlayer ) ) if ( veh == 431 ) and isMoving then isMoving = false moveObject( bargate, 1500, -2063.5, 1371.0999755859, 7.0999999046326, 0, -90, 0 ) end end end addEventHandler( "onMarkerLeave", damarker, gatefuncclose ) Link to comment
ViRuZGamiing Posted December 29, 2012 Author Share Posted December 29, 2012 @TAPL, and Client? Link to comment
TAPL Posted December 29, 2012 Share Posted December 29, 2012 Client what for? Not needed. Link to comment
ViRuZGamiing Posted December 29, 2012 Author Share Posted December 29, 2012 There's the problem, I posted it in Client Sorry for bothering and thanks for help to: TAPL, Denny and Castro 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