GrubaS Posted March 8, 2015 Share Posted March 8, 2015 Hey, guys I have a question about function. I want make script, if player change his car mass then it will be show on outputchatbox "Player changed mass "car mass". Link to comment
Castillo Posted March 8, 2015 Share Posted March 8, 2015 And where is the script which lets the player change the car mass? Link to comment
GrubaS Posted March 8, 2015 Author Share Posted March 8, 2015 setTimer( function ( p,c,thePlayer) local target = getPlayerFromPartialName(thePlayer) if target then local handling = getVehicleHandling(target) if handling > 1200 then outputChatBox(getPlayerName(target).." - mass: "..handling[1]) end end end, 2000, 1) function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end Link to comment
Callum Posted March 8, 2015 Share Posted March 8, 2015 That code makes no sense, it looks like you've just aimlessly scraped together some code from various sources. The timer will run once after 2 seconds, and then use 'thePlayer' which hasn't even been passed via the timer. getVehicleHandling returns a table not an integer. Link to comment
JR10 Posted March 9, 2015 Share Posted March 9, 2015 Let alone that you're comparing a table (handling) to a number. There is no event for changing any of the handling data of a car. You will have to add the check code (or triggerEvent) to the part where the player changes the mass of the vehicle. 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