nagugg Posted February 25, 2017 Share Posted February 25, 2017 THE ERRORS ARE: WARNING!:bad argument "isPedInVehicle" [Expected ped at argument 1, got string "repair"] WARNING!:bad argument "outputChatBox" [Expected bool at argument 5, got number "0"] and my script is this: (the chatbox are in spanish) function mecanico ( thePlayer ) car= getPedOccupiedVehicle ( thePlayer ) if isPedInVehicle( thePlayer ) then outputChatBox("reparaste el auto correctamente", thePlayer, 255, 255, 0) fixVehicle( car ) else outputChatBox("No estas en el vehiculo para reparar el coche", thePlayer, 255, 0, 0) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), mecanico) addCommandHandler("reparar", mecanico) any solution please?? Link to comment
Mr.Loki Posted February 25, 2017 Share Posted February 25, 2017 function mecanico ( thePlayer ) local car= getPedOccupiedVehicle ( thePlayer ) if isPedInVehicle( thePlayer ) then outputChatBox("reparaste el auto correctamente", thePlayer, 255, 255, 0) fixVehicle( car ) else outputChatBox("No estas en el vehiculo para reparar el coche", thePlayer, 255, 0, 0) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), mecanico) addCommandHandler("reparar", mecanico) You are getting the errors because you have the code on the client side, this is a server sided script. Link to comment
LoPollo Posted February 25, 2017 Share Posted February 25, 2017 There's something weird car= getPedOccupiedVehicle ( thePlayer ) if isPedInVehicle( thePlayer ) then --this generates warning but getPedOccupiedVehicle don't??? are you sure this is the correct line? Also: Expected bool at argument 5 Copying pasting from wiki the 5th arg serverside is int b=176 so an integer. The correct syntax (for your clientside script) is: bool outputChatBox ( string text [, int r=231, int g=217, int b=176, bool colorCoded=false ] ) Link to comment
Ayush Rathore Posted February 26, 2017 Share Posted February 26, 2017 (edited) Why using two checks if only one can fulfill the need whether client or server use this for Client-Sided function mecanico ( thePlayer ) local car= getPedOccupiedVehicle ( thePlayer ) if car then outputChatBox("reparaste el auto correctamente", 255, 255, 0) fixVehicle( car ) else outputChatBox("No estas en el vehiculo para reparar el coche",255, 0, 0) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), mecanico) addCommandHandler("reparar", mecanico) for server-sided function mecanico ( thePlayer ) local car= getPedOccupiedVehicle ( thePlayer ) if car then outputChatBox("reparaste el auto correctamente",thePlayer, 255, 255, 0) fixVehicle( car ) else outputChatBox("No estas en el vehiculo para reparar el coche",thePlayer,255, 0, 0) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), mecanico) addCommandHandler("reparar", mecanico) Edited February 26, 2017 by Ayush Rathore some spell mistakes 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