n0skillg3t Posted March 3, 2012 Share Posted March 3, 2012 (edited) Hey guys, i dont see the mistake Multiplier = 1.3 marker1 = createMarker(-6558.2998046875, 2801.099609375, 706.09997558594 , "cylinder" , 29, 0, 0, 204, 0) marker2 = createMarker(-6177.599609375, 2761.2998046875, 691.09997558594 , "cylinder" , 1, 255, 0, 0, 255) marker3 = createMarker(-6176.8994140625, 2735.7998046875, 655.40002441406 , "corona" , 1, 0, 255, 0, 255) function MarkerHit (hitMarker, player) if source == marker1 then outputChatBox("It Was corona!") local car = getPedOccupiedVehicle(player) speedx, speedy, speedz = getElementVelocity ( car ) speedcnx = (speedx*Multiplier) speedcny = (speedy*Multiplier) speedcnz = (speedz*Multiplier) setElementVelocity ( car, speedcnx, speedcny,speedcnz ) fixVehicle(car) addVehicleUpgrade(car, 1010) playSoundFrontEnd(46) end if source == marker2 then outputChatBox("It Was corona!") local car = getPedOccupiedVehicle(player) speedx, speedy, speedz = getElementVelocity ( car ) speedcnx = (speedx*Multiplier) speedcny = (speedy*Multiplier) speedcnz = (speedz*Multiplier) setElementVelocity ( car, speedcnx, speedcny,speedcnz ) fixVehicle(car) addVehicleUpgrade(car, 1010) playSoundFrontEnd(46) end if source == marker3 then outputChatBox("It was cylinder!") local car = getPedOccupiedVehicle(player) local x, y, z = getVehicleRotation ( car ) local newz = z + 360 setVehicleRotation ( car, x, y, newz ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) So, it does print out "It was corona!" but after that, nothing happens.. best regards, n0skillg3t Edit: I found the mistake, hitMarker is serverside Edited March 3, 2012 by Guest Link to comment
Castillo Posted March 3, 2012 Share Posted March 3, 2012 Multiplier = 1.3 marker1 = createMarker(-6558.2998046875, 2801.099609375, 706.09997558594 , "cylinder" , 29, 0, 0, 204, 0) marker2 = createMarker(-6177.599609375, 2761.2998046875, 691.09997558594 , "cylinder" , 1, 255, 0, 0, 255) marker3 = createMarker(-6176.8994140625, 2735.7998046875, 655.40002441406 , "corona" , 1, 0, 255, 0, 255) function MarkerHit (player) if (source == marker1) then if (player ~= localPlayer) then return end outputChatBox("It Was corona!") local car = getPedOccupiedVehicle(player) speedx, speedy, speedz = getElementVelocity ( car ) speedcnx = (speedx*Multiplier) speedcny = (speedy*Multiplier) speedcnz = (speedz*Multiplier) setElementVelocity ( car, speedcnx, speedcny,speedcnz ) fixVehicle(car) addVehicleUpgrade(car, 1010) playSoundFrontEnd(46) elseif (source == marker2) then if (player ~= localPlayer) then return end outputChatBox("It Was corona!") speedx, speedy, speedz = getElementVelocity ( car ) speedcnx = (speedx*Multiplier) speedcny = (speedy*Multiplier) speedcnz = (speedz*Multiplier) setElementVelocity ( car, speedcnx, speedcny,speedcnz ) fixVehicle(car) addVehicleUpgrade(car, 1010) playSoundFrontEnd(46) elseif (source == marker3) then if (player ~= localPlayer) then return end outputChatBox("It was cylinder!") local car = getPedOccupiedVehicle(player) local x, y, z = getElementRotation( car ) local newz = z + 360 setElementRotation( car, x, y, newz ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) No, is not that, is that you don't specify the player argument as you should. Link to comment
n0skillg3t Posted March 3, 2012 Author Share Posted March 3, 2012 Okey, but the rotation thingy does not work.. I wanna change the car direction about 360° so that front is back and back is front.. best regards, n0skillg3t Link to comment
Dev Posted March 3, 2012 Share Posted March 3, 2012 You must apply this script server side if you want to change a vehicle's direction which was created server side. Multiplier = 1.3 marker1 = createMarker(-6558.2998046875, 2801.099609375, 706.09997558594 , "cylinder" , 29, 0, 0, 204, 0) marker2 = createMarker(-6177.599609375, 2761.2998046875, 691.09997558594 , "cylinder" , 1, 255, 0, 0, 255) marker3 = createMarker(-6176.8994140625, 2735.7998046875, 655.40002441406 , "corona" , 1, 0, 255, 0, 255) function MarkerHit (player, matchingDimension) if (source == marker1) and ( matchingDimension ) then outputChatBox("It Was corona!") local car = getPedOccupiedVehicle(player) speedx, speedy, speedz = getElementVelocity ( car ) speedcnx = (speedx*Multiplier) speedcny = (speedy*Multiplier) speedcnz = (speedz*Multiplier) setElementVelocity ( car, speedcnx, speedcny,speedcnz ) fixVehicle(car) addVehicleUpgrade(car, 1010) playSoundFrontEnd(player, 46) elseif (source == marker2) and ( matchingDimension ) then outputChatBox("It Was corona!") speedx, speedy, speedz = getElementVelocity ( car ) speedcnx = (speedx*Multiplier) speedcny = (speedy*Multiplier) speedcnz = (speedz*Multiplier) setElementVelocity ( car, speedcnx, speedcny,speedcnz ) fixVehicle(car) addVehicleUpgrade(car, 1010) playSoundFrontEnd(player, 46) elseif (source == marker3) and ( matchingDimension ) then outputChatBox("It was cylinder!") local car = getPedOccupiedVehicle(player) local x, y, z = getElementRotation( car ) local newz = z + 360 setElementRotation( car, x, y, newz ) end end addEventHandler ( "onMarkerHit", getRootElement(), MarkerHit ) Link to comment
n0skillg3t Posted March 3, 2012 Author Share Posted March 3, 2012 It works now, but the speed is gone away when my car direction changed, where is the problem ? I want to have it like with s0beit when you press backspace Link to comment
Ludo Posted March 3, 2012 Share Posted March 3, 2012 marker1 = createMarker(-6558.2998046875, 2801.099609375, 706.09997558594 , "cylinder" , 29, 0, 0, 204, 0) marker2 = createMarker(-6177.599609375, 2761.2998046875, 691.09997558594 , "cylinder" , 1, 255, 0, 0, 255) marker3 = createMarker(-6176.8994140625, 2735.7998046875, 655.40002441406 , "corona" , 1, 0, 255, 0, 255) function MarkerHit(player, matchingDimension) car = getPedOccupiedVehicle(player) if car then speedx, speedy, speedz = getElementVelocity(car) x, y, z = getElementRotation(car) if matchingDimension then if source == marker1 then outputChatBox("It Was cylinder!") fixVehicle(car) addVehicleUpgrade(car, 1010) playSoundFrontEnd(player, 46) elseif source == marker2 then outputChatBox("It Was cylinder!") fixVehicle(car) addVehicleUpgrade(car, 1010) playSoundFrontEnd(player, 46) elseif source == marker3 then outputChatBox("It was corona!") newz = z + 360 setElementRotation(car, x, y, newz) setElementVelocity(car, speedx, speedy, speedz) end end end end addEventHandler ( "onMarkerHit", getRootElement(), MarkerHit ) This sets the speed that you have when you hit the marker I also removed some useless lines, for example: Why do you set speed when you hit a normal marker? You only need it if you change the vehicles' direction Link to comment
n0skillg3t Posted March 3, 2012 Author Share Posted March 3, 2012 Multiplier = 1.3 marker1 = createMarker(-6558.2998046875, 2801.099609375, 706.09997558594 , "cylinder" , 29, 0, 0, 255, 255) marker2 = createMarker(-6177.599609375, 2761.2998046875, 691.09997558594 , "corona" , 15, 255, 0, 0, 255) marker3 = createMarker(-6176.6000976563, 2672.3000488281, 634.29998779297 , "corona" , 23, 0, 255, 0, 255) function MarkerHit (player) if (source == marker1) then if (player ~= localPlayer) then return end local car = getPedOccupiedVehicle(player) speedx, speedy, speedz = getElementVelocity ( car ) speedcnx = (speedx*Multiplier) speedcny = (speedy*Multiplier) speedcnz = (speedz*Multiplier) setElementVelocity ( car, speedcnx, speedcny,speedcnz ) fixVehicle(car) addVehicleUpgrade(car, 1010) playSoundFrontEnd(46) elseif (source == marker2) then if (player ~= localPlayer) then return end speedx, speedy, speedz = getElementVelocity ( car ) speedcnx = (speedx*Multiplier) speedcny = (speedy*Multiplier) speedcnz = (speedz*Multiplier) setElementVelocity ( car, speedcnx, speedcny,speedcnz ) fixVehicle(car) addVehicleUpgrade(car, 1010) playSoundFrontEnd(46) elseif (source == marker3) then if (player ~= localPlayer) then return end local car = getPedOccupiedVehicle( player ) speedx, speedy, speedz = getElementVelocity ( car ) local x, y, z = getElementRotation( car ) local newz = z + 180 setElementRotation ( car, x, y, newz ) setElementVelocity ( car, speedx, speedy,speedz ) end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) This is my whole script, in marker1 and marker2 it should just speed up, but in marker3 it should change the car direction like in s0beit when you press Backspace. best regards, n0skillg3t 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