toptional Posted June 1, 2013 Share Posted June 1, 2013 I get this debug error ERROR: line 18: attempt to compare boolean with number It's supposed to when you enter the marker see if your vehicle health is below 100% if it is, it fixes it, if not it does nothing. UKMarker = createMarker ( -2079.88, 2099.58, 15.5,"cylinder",6.0,255,255,0,125) USAMarker = createMarker (349.18, 2540.00, 15.5,"cylinder",6.0,255,255,0,125) RUSMarker = createMarker ( 2205.92, -219.31, 16.5,"cylinder",6.0,255,255,0,125) GERMarker = createMarker ( -1088.41, -1036.57, 128.25,"cylinder",6.0,255,255,0,125) UKBlip = createBlipAttachedTo ( UKMarker,63, 1,0,0,0,255,0,3000,getRootElement()) USABlip = createBlipAttachedTo ( USAMarker,63, 1,0,0,0,255,0,3000,getRootElement()) RUSBlip = createBlipAttachedTo ( RUSMarker,63, 1,0,0,0,255,0,3000,getRootElement()) GERBlip = createBlipAttachedTo ( GERMarker,63, 1,0,0,0,255,0,3000,getRootElement()) function fixUK ( hitPlayer, matchingDimension ) if ( hitPlayer == localPlayer ) then if ( getElementType ( hitPlayer ) == "player" ) then local vehicle = getPedOccupiedVehicle ( hitPlayer ) if ( vehicle ) then local vehicleHealth = getElementHealth ( playerVehicle ) if vehicleHealth <= 100 then fadeCamera ( false ) --toggleAllControls ( false ) setElementFrozen ( vehicle, true ) setTimer ( function ( ) fixVehicle ( vehicle ) --toggleAllControls ( true ) setElementFrozen ( vehicle, false ) fadeCamera ( true ) takePlayerMoney(250) outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) end , 2000, 1 ) else outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) end end end end end addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) Link to comment
ViRuZGamiing Posted June 1, 2013 Share Posted June 1, 2013 Is this a Pay 'n Spray? Because I have a Working One if you want it send me a PM Link to comment
iPrestege Posted June 1, 2013 Share Posted June 1, 2013 local vehicleHealth = getElementHealth ( playerVehicle ) You see ( playerVehicle ) This argument should be ( vehicle ) . Link to comment
toptional Posted June 1, 2013 Author Share Posted June 1, 2013 I changed that Pre[T]ege, but now it says I need to be in a vehicle when i go through the marker Link to comment
iPrestege Posted June 1, 2013 Share Posted June 1, 2013 function fixUK ( hitPlayer, matchingDimension ) if ( hitPlayer == localPlayer ) then local vehicle = getPedOccupiedVehicle ( hitPlayer ) if not ( vehicle ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end local vehicleHealth = getElementHealth ( vehicle ) if vehicleHealth <= 100 then fadeCamera ( false ) --toggleAllControls ( false ) setElementFrozen ( vehicle, true ) setTimer ( function ( ) fixVehicle ( vehicle ) --toggleAllControls ( true ) setElementFrozen ( vehicle, false ) fadeCamera ( true ) takePlayerMoney(250) outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) end , 2000, 1 ) end end end addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) Link to comment
Vision Posted June 1, 2013 Share Posted June 1, 2013 Is that what you wanted to? UKMarker = createMarker ( -2079.88, 2099.58, 15.5,"cylinder",6.0,255,255,0,125) USAMarker = createMarker (349.18, 2540.00, 15.5,"cylinder",6.0,255,255,0,125) RUSMarker = createMarker ( 2205.92, -219.31, 16.5,"cylinder",6.0,255,255,0,125) GERMarker = createMarker ( -1088.41, -1036.57, 128.25,"cylinder",6.0,255,255,0,125) UKBlip = createBlipAttachedTo ( UKMarker,63, 1,0,0,0,255,0,3000,getRootElement()) USABlip = createBlipAttachedTo ( USAMarker,63, 1,0,0,0,255,0,3000,getRootElement()) RUSBlip = createBlipAttachedTo ( RUSMarker,63, 1,0,0,0,255,0,3000,getRootElement()) GERBlip = createBlipAttachedTo ( GERMarker,63, 1,0,0,0,255,0,3000,getRootElement()) function fixUK ( hitPlayer, matchingDimension ) if ( hitPlayer == localPlayer ) then if ( getElementType ( hitPlayer ) == "player" ) then local vehicle = getPedOccupiedVehicle ( hitPlayer ) if ( vehicle ) then local vehicleHealth = getElementHealth ( vehicle ) if ( vehicleHealth < 1000 ) then fadeCamera ( false ) --toggleAllControls ( false ) setElementFrozen ( vehicle, true ) setTimer ( function ( ) fixVehicle ( vehicle ) --toggleAllControls ( true ) setElementFrozen ( vehicle, false ) fadeCamera ( true ) takePlayerMoney ( 250 ) outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) end , 2000, 1 ) end else outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) end end end end addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) Link to comment
denny199 Posted June 1, 2013 Share Posted June 1, 2013 And you are taking the money on client side, bad idea. Note: Using this function client side (not recommended) will not change a players money server side. Link to comment
iPrestege Posted June 1, 2013 Share Posted June 1, 2013 It's a fake money also the fix vehicle . Link to comment
toptional Posted June 1, 2013 Author Share Posted June 1, 2013 function fixUK ( hitPlayer, matchingDimension ) if ( hitPlayer == localPlayer ) then local vehicle = getPedOccupiedVehicle ( hitPlayer ) if not ( vehicle ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end local vehicleHealth = getElementHealth ( vehicle ) if vehicleHealth <= 100 then fadeCamera ( false ) --toggleAllControls ( false ) setElementFrozen ( vehicle, true ) setTimer ( function ( ) fixVehicle ( vehicle ) --toggleAllControls ( true ) setElementFrozen ( vehicle, false ) fadeCamera ( true ) takePlayerMoney(250) outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) end , 2000, 1 ) end end end addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) Thanks you fixed it Link to comment
toptional Posted June 1, 2013 Author Share Posted June 1, 2013 Another issue D: It outputs the message 3 times, when you go and get the vehicle fixed. function fixUK ( hitPlayer, matchingDimension ) if ( hitPlayer == localPlayer ) then local vehicle = getPedOccupiedVehicle ( hitPlayer ) if not ( vehicle ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end local vehicleHealth = getElementHealth ( vehicle ) if vehicleHealth <= 950 then fadeCamera ( false ) --toggleAllControls ( false ) setElementFrozen ( vehicle, true ) setTimer ( function ( ) fixVehicle ( vehicle ) --toggleAllControls ( true ) setElementFrozen ( vehicle, false ) fadeCamera ( true ) takePlayerMoney(250) outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) end , 2000, 1 ) end end end addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) function fixUSA ( hitPlayer, matchingDimension ) if ( hitPlayer == localPlayer ) then local vehicle2 = getPedOccupiedVehicle ( hitPlayer ) if not ( vehicle2 ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end local vehicleHealth2 = getElementHealth ( vehicle2 ) if vehicleHealth2 <= 950 then fadeCamera ( false ) --toggleAllControls ( false ) setElementFrozen ( vehicle2, true ) setTimer ( function ( ) fixVehicle ( vehicle2 ) --toggleAllControls ( true ) setElementFrozen ( vehicle2, false ) fadeCamera ( true ) takePlayerMoney(250) outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) end , 2000, 1 ) end end end addEventHandler ( "onClientMarkerHit", USAMarker, fixUSA ) function fixUK ( hitPlayer, matchingDimension ) if ( hitPlayer == localPlayer ) then local vehicle3 = getPedOccupiedVehicle ( hitPlayer ) if not ( vehicle3 ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end local vehicleHealth3 = getElementHealth ( vehicle3 ) if vehicleHealth3 <= 950 then fadeCamera ( false ) --toggleAllControls ( false ) setElementFrozen ( vehicle3, true ) setTimer ( function ( ) fixVehicle ( vehicle3 ) --toggleAllControls ( true ) setElementFrozen ( vehicle3, false ) fadeCamera ( true ) takePlayerMoney(250) outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) end , 2000, 1 ) end end end addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) function fixUK ( hitPlayer, matchingDimension ) if ( hitPlayer == localPlayer ) then local vehicle4 = getPedOccupiedVehicle ( hitPlayer ) if not ( vehicle4 ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end local vehicleHealth4 = getElementHealth ( vehicle4 ) if vehicleHealth4 <= 950 then fadeCamera ( false ) --toggleAllControls ( false ) setElementFrozen ( vehicle4, true ) setTimer ( function ( ) fixVehicle ( vehicle4 ) --toggleAllControls ( true ) setElementFrozen ( vehicle4, false ) fadeCamera ( true ) takePlayerMoney(250) outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) end , 2000, 1 ) end end end addEventHandler ( "onClientMarkerHit", UKMarker, fixUK ) P.S The markers are created before the script don't worry Link to comment
Jaysds1 Posted June 1, 2013 Share Posted June 1, 2013 (edited) try this: function fixScript( hitPlayer, matchingDimension ) if ( hitPlayer == localPlayer ) then local vehicle = getPedOccupiedVehicle ( hitPlayer ) if not ( vehicle ) then outputChatBox ( "You need to be in a vehicle!", 255, 0, 0 ) return end local vehicleHealth = getElementHealth ( vehicle ) if vehicleHealth <= 950 then fadeCamera ( false ) --toggleAllControls ( false ) setElementFrozen ( vehicle, true ) setTimer ( function ( ) fixVehicle ( vehicle ) --toggleAllControls ( true ) setElementFrozen ( vehicle, false ) fadeCamera ( true ) takePlayerMoney(250) outputChatBox ( "Your vehicle was fixed for $250!", 255, 0, 0 ) end , 2000, 1 ) end end end addEventHandler ( "onClientMarkerHit", UKMarker, fixScript ) addEventHandler ( "onClientMarkerHit", USAMarker,fixScript) addEventHandler ( "onClientMarkerHit", RUSMarker,fixScript) addEventHandler ( "onClientMarkerHit", GERMarker,fixScript) Edited June 2, 2013 by Guest Link to comment
Castillo Posted June 1, 2013 Share Posted June 1, 2013 Isn't the code from each function the same? if so, then you can just use one function, that would be a lot more efficient. Link to comment
Jaysds1 Posted June 2, 2013 Share Posted June 2, 2013 oh, your right, let me change that then Link to comment
PaiN^ Posted June 2, 2013 Share Posted June 2, 2013 And you are taking the money on client side, bad idea.Note: Using this function client side (not recommended) will not change a players money server side. It's a fake money also the fix vehicle . Link to comment
Castillo Posted June 2, 2013 Share Posted June 2, 2013 He has to use triggerServerEvent to take/fix it server side. 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