Sparrow Posted February 18, 2012 Share Posted February 18, 2012 I'm trying to set a gate for LSPD that opens for whogot polices skins, the problem is the gate didn't move. he is the script: local policeSkins = { [280]=true, [281]=true, [282]=true, [283]=true, [284]=true, [285]=true, [286]=true } local theMarker = createMarker (1545.400, -1627.600, 13.400, "cylinder", 6, 255, 255, 255, 0) local gate = createObject (968, 1544.6999511719, -1631, 13.199999809265, 0, 270, 270) function openGate(thePlayer) if policeSkins[getElementModel (thePlayer)] then moveObject (gate, 1500, 1544.700, -1630.800, 13.300) end end addEventHandler("onMarkerHit", theMarker, openGate) function closeGate(thePlayer) if policeSkins[getElementModel (thePlayer)] then moveObject (gate, 1500, 1544.6999511719, -1631, 13.199999809265) end end addEventHandler( "onMarkerLeave", theMarker, closeGate) Link to comment
Kenix Posted February 18, 2012 Share Posted February 18, 2012 local policeSkins = { [280] = true, [281] = true, [282] = true, [283] = true, [284] = true, [285] = true, [286] = true } local theMarker = createMarker ( 1545.400, -1627.600, 13.400, "cylinder", 6, 255, 255, 255, 0 ) local gate = createObject ( 968, 1544.6999511719, -1631, 13.199999809265, 0, 270, 270 ) local state = { } local function gateState( hitElement,dim ) local el if getElementType( hitElement ) == 'player' then el = hitElement elseif getElementType( hitElement ) == 'vehicle' then el = getVehicleController( hitElement ) end if policeSkins[ getElementModel ( el ) ] then state[ el ] = not state[ el ] if state then moveObject ( gate, 1500, 1544.700, -1630.800, 13.300 ) else moveObject ( gate, 1500, 1544.6999511719, -1631, 13.199999809265 ) end end end addEventHandler( "onMarkerHit", theMarker, gateState ) addEventHandler( 'onPlayerQuit',root, function( ) state[ source ] = nil end ) Updated. Link to comment
Sparrow Posted February 18, 2012 Author Share Posted February 18, 2012 still not working, also no errors on debugscript 3 and on mtaserver.exe Link to comment
Kenix Posted February 18, 2012 Share Posted February 18, 2012 Oh my bad i forgot call index table. local policeSkins = { [280] = true, [281] = true, [282] = true, [283] = true, [284] = true, [285] = true, [286] = true } local theMarker = createMarker ( 1545.400, -1627.600, 13.400, "cylinder", 6, 255, 255, 255, 0 ) local gate = createObject ( 968, 1544.6999511719, -1631, 13.199999809265, 0, 270, 270 ) local state = { } local function gateState( hitElement,dim ) local el if getElementType( hitElement ) == 'player' then el = hitElement elseif getElementType( hitElement ) == 'vehicle' then el = getVehicleController( hitElement ) end if policeSkins[ getElementModel ( el ) ] then state[ el ] = not state[ el ] if state[ el ] then moveObject ( gate, 1500, 1544.700, -1630.800, 13.300 ) else moveObject ( gate, 1500, 1544.6999511719, -1631, 13.199999809265 ) end end end addEventHandler( "onMarkerHit", theMarker, gateState ) addEventHandler( 'onPlayerQuit',root, function( ) state[ source ] = nil end ) Tested. Link to comment
Sparrow Posted February 18, 2012 Author Share Posted February 18, 2012 does it work for you? it didn't for me Link to comment
Kenix Posted February 18, 2012 Share Posted February 18, 2012 Very small move. Change position for example z-axis. Link to comment
Sparrow Posted February 18, 2012 Author Share Posted February 18, 2012 (edited) ok, I'll try. EDIT: I test it with others X, Y and Z coordination, nothing happend, gate didn't work. Edited February 18, 2012 by Guest Link to comment
Kenix Posted February 18, 2012 Share Posted February 18, 2012 ok, I'll try.EDIT: I test it with others Z coordination, nothing happend, gate didn't work. Your skin is police? Link to comment
Kenix Posted February 18, 2012 Share Posted February 18, 2012 I don't know how you test. It working.. local policeSkins = { [280] = true, [281] = true, [282] = true, [283] = true, [284] = true, [285] = true, [286] = true } local theMarker = createMarker ( 1545.400, -1627.600, 13.400, "cylinder", 6, 255, 255, 255, 255 ) local gate = createObject ( 968, 1544.6999511719, -1631, 13.199999809265, 0, 270, 270 ) local state = { } local function gateState( hitElement,dim ) local el if getElementType( hitElement ) == 'player' then el = hitElement elseif getElementType( hitElement ) == 'vehicle' then el = getVehicleController( hitElement ) end if policeSkins[ getElementModel ( el ) ] then state[ el ] = not state[ el ] if state[ el ] then moveObject ( gate, 1500, 1544.700, -1630.800, 13.300 ) else moveObject ( gate, 1500, 1544.6999511719, -1631, 23.199999809265 ) end end end addEventHandler( "onMarkerHit", theMarker, gateState ) addEventHandler( 'onPlayerQuit',root, function( ) state[ source ] = nil end ) Marker visible. Just try. Updated. Link to comment
Sparrow Posted February 18, 2012 Author Share Posted February 18, 2012 didn't work http://img853.imageshack.us/img853/9899 ... 215229.png Link to comment
Kenix Posted February 18, 2012 Share Posted February 18, 2012 Working local policeSkins = { [280] = true, [281] = true, [282] = true, [283] = true, [284] = true, [285] = true, [286] = true } local theMarker = createMarker ( 1545.400, -1627.600, 13.400, "cylinder", 6, 255, 255, 255, 255 ) local gate = createObject ( 968, 1544.6999511719, -1631, 13.199999809265, 0, 270, 270 ) local state = { } local function gateState( hitElement,dim ) local el if getElementType( hitElement ) == 'player' then el = hitElement elseif getElementType( hitElement ) == 'vehicle' then el = getVehicleController( hitElement ) end if policeSkins[ getElementModel ( el ) ] then state[ el ] = not state[ el ] if state[ el ] then moveObject ( gate, 1500, 1544.6999511719, -1631, 23.199999809265 ) else moveObject ( gate, 1500, 1544.700, -1630.800, 13.300 ) end end end addEventHandler( "onMarkerHit", theMarker, gateState ) addEventHandler( 'onPlayerQuit',root, function( ) state[ source ] = nil end ) Just need interchange But you only hit marker and done ( you not re hit again ) .. Link to comment
Sparrow Posted February 18, 2012 Author Share Posted February 18, 2012 still didn't work for me Link to comment
Kenix Posted February 18, 2012 Share Posted February 18, 2012 (edited) Lol i tested it now. Idk why it not working for you. You use this script in server side? Edited February 18, 2012 by Guest Link to comment
Sparrow Posted February 18, 2012 Author Share Posted February 18, 2012 lol, bad local server thank you anyways for help 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