Jump to content

[HELP] Please :x


GrubaS

Recommended Posts

Posted

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".

Posted

And where is the script which lets the player change the car mass?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 

Posted

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.

Retired

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...