iPrestege Posted February 8, 2013 Share Posted February 8, 2013 Hello , I Have Problem Here On This Script I Do it With Marker But The Problem If Is Player In Vehicle And He Didn,t Hit The Marker He Will Be Spawned To The Fucking Position i Put ( = Note : Am Using It On Server Side On Meta Some Help To Fix It local Marker = createMarker ( -2842.7297363281, -329.54904174805, 167.10781860352, "checkpoint", 20, 255, 255, 255, 255 ) local Marker1 = createMarker ( -2953.7856445313,-330.46145629883, 4.9000000953674, "checkpoint", 20, 255, 255, 255, 255 ) timers = {} function marker(player) if (source == Marker or source == Marker1 and player and getElementType(player) == "player") then outputChatBox ("You , Can,t Ger Vehicle Here!!", player, 255, 0, 0, false) triggerClientEvent (player, "enableGodMode", player) toggleControl (player, "fire", false ) toggleControl (player, "aim_weapon", false) toggleControl (player, "vehicle_fire", false) timers[player] = setTimer (function (player) if isElement(player) then local weaponType = getPedWeapon ( player ) if ( weaponType ) then takeAllWeapons ( player ) end if isPedInVehicle( player ) then if isTimer(timers[player]) then killTimer(timers[player]) timers[player] = nil end setTimer(onhit, 2000, 1, player) outputChatBox ("You , Can,t Ger Vehicle Here!!", player, 255, 0, 0, false) end end end, 1000, 0, player) end end addEventHandler ("onMarkerHit",getRootElement(),marker) function onhit(plr) if plr and isElement(plr) then local veh = getPedOccupiedVehicle(plr) setElementVelocity (veh, 0, 0, 0) setElementPosition (veh, -3031.3862304688,-194.81304931641,5) setVehicleRotation (veh, 0,0,270) end end addEventHandler ("onMarkerLeave",getRootElement(),function(player) if (source == Marker or source == Marker1 and getElementType(player) == "player" )then if isTimer(timers[player]) then killTimer(timers[player]) timers[player] = nil end triggerClientEvent (player, "disableGodMode", player) toggleControl (player, "fire", true ) toggleControl (player, "aim_weapon", true) toggleControl (player, "vehicle_fire", true) end end) addEventHandler("onPlayerQuit",root,function() if isTimer(timers[source]) then killTimer(timers[source]) timers[source] = nil end end ) Link to comment
manve1 Posted February 8, 2013 Share Posted February 8, 2013 use: getPedOccupiedVehicle Link to comment
iPrestege Posted February 9, 2013 Author Share Posted February 9, 2013 use: getPedOccupiedVehicle if isPedInVehicle( player ) the script it works but the problem some times i didn,t hit the marker but i will go to the position the one i put -_-" . Link to comment
manve1 Posted February 9, 2013 Share Posted February 9, 2013 You need to get the dimensions of the marker then (( if you know what i mean )) Link to comment
iPrestege Posted February 9, 2013 Author Share Posted February 9, 2013 Yes, I know this, but what would do if I used? getElementDimension Link to comment
manve1 Posted February 9, 2013 Share Posted February 9, 2013 no, by dimensions i mean u need to get the marker height, width, depth ... Link to comment
TAPL Posted February 9, 2013 Share Posted February 9, 2013 http://bugs.multitheftauto.com/view.php?id=6586 This bug occur with big markers, as i see you're using size "20", because of this the col shape doesn't match the visual. Link to comment
iPrestege Posted February 9, 2013 Author Share Posted February 9, 2013 http://bugs.multitheftauto.com/view.php?id=6586This bug occur with big markers, as i see you're using size "20", because of this the col shape doesn't match the visual. So , How can i do it with colshape . Link to comment
TAPL Posted February 9, 2013 Share Posted February 9, 2013 https://wiki.multitheftauto.com/wiki/CreateColSphere https://wiki.multitheftauto.com/wiki/OnColShapeHit https://wiki.multitheftauto.com/wiki/OnColShapeLeave Link to comment
iPrestege Posted February 9, 2013 Author Share Posted February 9, 2013 https://wiki.multitheftauto.com/wiki/CreateColSpherehttps://wiki.multitheftauto.com/wiki/OnColShapeHit https://wiki.multitheftauto.com/wiki/OnColShapeLeave Col = createColSphere (-2842.7297363281, -329.54904174805,167.10781860352, 20 ) Col1 = createColSphere ( -2953.7856445313,-330.46145629883,4.9000000953674, 20 ) addEventHandler( "onColShapeHit", root, function (player) if ( source == Col or source == Col1 and player and getElementType(player) == "player") then outputChatBox ("You , Can,t Get Vehicle Here!!", player, 255, 0, 0, false) triggerClientEvent (player, "enableGodMode", player) toggleControl (player, "fire", false ) toggleControl (player, "aim_weapon", false) toggleControl (player, "vehicle_fire", false) timers[player] = setTimer (function (player) if isElement(player) then local weaponType = getPedWeapon ( player ) if ( weaponType ) then takeAllWeapons ( player ) end if isPedInVehicle( player ) then if isTimer(timers[player]) then killTimer(timers[player]) timers[player] = nil end setTimer(onhit, 2000, 1, player) outputChatBox ("You , Can,t Get Vehicle Here!!", player, 255, 0, 0, false) end end end, 1000, 0, player) end end ) function onhit(plr) if plr and isElement(plr) then local veh = getPedOccupiedVehicle(plr) setElementVelocity (veh, 0, 0, 0) setElementPosition (veh, -3031.3862304688,-194.81304931641,5) setVehicleRotation (veh, 0,0,270) end end addEventHandler ("onColShapeLeave", root, function(player) if ( source == Col or source == Col1 and getElementType(player) == "player" )then if isTimer(timers[player]) then killTimer(timers[player]) timers[player] = nil end triggerClientEvent (player, "disableGodMode", player) toggleControl (player, "fire", true ) toggleControl (player, "aim_weapon", true) toggleControl (player, "vehicle_fire", true) end end ) addEventHandler("onPlayerQuit",root, function() if isTimer(timers[source]) then killTimer(timers[source]) timers[source] = nil end end ) Link to comment
3NAD Posted February 9, 2013 Share Posted February 9, 2013 Col = createColSphere ( -2842.7297363281, -329.54904174805,10.10781860352, 20 ) Col1 = createColSphere ( -2953.7856445313,-330.46145629883,4.9000000953674, 20 ) timers = { } addEventHandler( "onColShapeHit", root, function ( player ) if ( source == Col or source == Col1 ) then if ( player and getElementType ( player ) == "player" ) then outputChatBox ( "You , Can,t Get Vehicle Here!!", player, 255, 0, 0, false ) triggerClientEvent ( player, "enableGodMode", player ) toggleControl ( player, "fire", false ) toggleControl ( player, "aim_weapon", false ) toggleControl ( player, "vehicle_fire", false ) timers[player] = setTimer ( function ( player ) if isElement ( player ) then local weaponType = getPedWeapon ( player ) if ( weaponType ) then takeAllWeapons ( player ) end if isPedInVehicle ( player ) then local shape = Col or Col1 local veh = getPedOccupiedVehicle ( player ) if not isElementWithinColShape ( veh, shape ) then if isTimer ( timers[player] ) then killTimer ( timers[player] ) timers[player] = nil end return end outputChatBox ( "You , Can,t Get Vehicle Here!!", player, 255, 0, 0, false ) onhit ( player ) end end end , 1000, 0, player ) end end end ) function onhit ( plr ) if plr and isElement ( plr ) then local veh = getPedOccupiedVehicle ( plr ) if veh then setElementVelocity ( veh, 0, 0, 0 ) setElementPosition ( veh, -3031.3862304688, -194.81304931641, 5 ) setVehicleRotation ( veh, 0,0,270 ) timers[plr] = nil end end end addEventHandler ( "onColShapeLeave", root, function ( player ) if ( source == Col or source == Col1 ) then if getElementType ( player ) == "player" then if isTimer ( timers[player] ) then killTimer ( timers[player] ) timers[player] = nil end triggerClientEvent ( player, "disableGodMode", player ) toggleControl ( player, "fire", true ) toggleControl ( player, "aim_weapon", true ) toggleControl ( player, "vehicle_fire", true ) end end end ) addEventHandler("onPlayerQuit",root, function() if isTimer ( timers[source] ) then killTimer ( timers[source] ) timers[source] = nil end end ) Link to comment
iPrestege Posted February 9, 2013 Author Share Posted February 9, 2013 Col = createColSphere ( -2842.7297363281, -329.54904174805,10.10781860352, 20 ) Col1 = createColSphere ( -2953.7856445313,-330.46145629883,4.9000000953674, 20 ) timers = { } addEventHandler( "onColShapeHit", root, function ( player ) if ( source == Col or source == Col1 ) then if ( player and getElementType ( player ) == "player" ) then outputChatBox ( "You , Can,t Get Vehicle Here!!", player, 255, 0, 0, false ) triggerClientEvent ( player, "enableGodMode", player ) toggleControl ( player, "fire", false ) toggleControl ( player, "aim_weapon", false ) toggleControl ( player, "vehicle_fire", false ) timers[player] = setTimer ( function ( player ) if isElement ( player ) then local weaponType = getPedWeapon ( player ) if ( weaponType ) then takeAllWeapons ( player ) end if isPedInVehicle ( player ) then local shape = Col or Col1 local veh = getPedOccupiedVehicle ( player ) if not isElementWithinColShape ( veh, shape ) then if isTimer ( timers[player] ) then killTimer ( timers[player] ) timers[player] = nil end return end outputChatBox ( "You , Can,t Get Vehicle Here!!", player, 255, 0, 0, false ) onhit ( player ) end end end , 1000, 0, player ) end end end ) function onhit ( plr ) if plr and isElement ( plr ) then local veh = getPedOccupiedVehicle ( plr ) if veh then setElementVelocity ( veh, 0, 0, 0 ) setElementPosition ( veh, -3031.3862304688, -194.81304931641, 5 ) setVehicleRotation ( veh, 0,0,270 ) timers[plr] = nil end end end addEventHandler ( "onColShapeLeave", root, function ( player ) if ( source == Col or source == Col1 ) then if getElementType ( player ) == "player" then if isTimer ( timers[player] ) then killTimer ( timers[player] ) timers[player] = nil end triggerClientEvent ( player, "disableGodMode", player ) toggleControl ( player, "fire", true ) toggleControl ( player, "aim_weapon", true ) toggleControl ( player, "vehicle_fire", true ) end end end ) addEventHandler("onPlayerQuit",root, function() if isTimer ( timers[source] ) then killTimer ( timers[source] ) timers[source] = nil end end ) I'm going to try it i will give you the results wait please ... ! 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