SoiiNoob Posted March 12, 2012 Posted March 12, 2012 I want to make a marker when you are inside it, repair your vehicle and if you are out your vehicle will say "No estas en un vehiculo!" Also I want if money is lower than 0 will no repair. createBlip ( -2431.3276367188, 1028.6922607422, 0, 63 ) spray1 = createMarker ( -2437.853515625, 1036.1303710938, 49.5, "cylinder", 5, 0, 255, 0, 50 ) function Reparar(Player) local dinero = getPlayerMoney(thePlayer) if (dinero > 0) then takePlayerMoney(100) outputChatBox("#c8c8c8Servidor: #00ff00Vehiculo Reparado [100$]", 0, 0, 0, true) end if (dinero < 0) then outputChatBox ("#c8c8c8Servidor: #ff0000Dinero insuficiente") end end local Vehicle = getPedOccupiedVehicle(Player) if isPedInVehicle(Player) == true then fixVehicle(Vehicle) else if isPedOnGround (Player) == true then outputChatBox(marker.."#c8c8c8Servidor: #ff0000No estas en un vehiculo!", true) end end addEventHandler( "onClientMarkerHit", spray1, Reparar ) WARNING: line 15 Bad Argument @ 'isPedInVehicle' WARNING: line 18 Bad Argument @ 'isPedOnGround'
Castillo Posted March 12, 2012 Posted March 12, 2012 1: Your script is client side, and you're using takePlayerMoney, money is not synchronized when you take it client side. 2: You're checking if the vehicle is on ground, but that's not required. 3: You're using 'thePlayer', but your argument is 'Player. spray1 = createMarker ( -2437.853515625, 1036.1303710938, 49.5, "cylinder", 5, 0, 255, 0, 50 ) createBlipAttachedTo(spray1, 63) function Reparar ( thePlayer ) local dinero = getPlayerMoney ( thePlayer ) local vehicle = getPedOccupiedVehicle ( thePlayer ) if ( not vehicle ) then outputChatBox( "#c8c8c8Servidor: #ff0000No estas en un vehiculo!", thePlayer, 255, 0, 0, true ) return end if ( dinero >= 100 ) then takePlayerMoney( thePlayer, 100 ) fixVehicle( vehicle ) outputChatBox ( "#c8c8c8Servidor: #00ff00Vehiculo Reparado [100$]", thePlayer, 0, 255, 0, true ) else outputChatBox ( "#c8c8c8Servidor: #ff0000Dinero insuficiente", thePlayer, 255, 0, 0, true ) end end addEventHandler( "onMarkerHit", spray1, Reparar ) That script is server side. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted March 12, 2012 Posted March 12, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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