Jump to content

i need help for race scripting


Erhabi

Recommended Posts

Posted

hi all

I made the scripting for race mode

But I have a problem

I want to know how to make the player if he wins give him 100

I'm sorry for my bad English

Posted
addEvent("onPlayerFinish",true) -- add the custom event so our resource knows about it
addEventHandler("onPlayerFinish",getRootElement(), -- add an event handler for the event
function (rank,finishtime)
if rank == 1 then -- check if the player finished first
givePlayerMoney(source,100) -- give him 100$ if so
end
end
)

Posted

plzzz i need help the scrioting does not work

i created a file.lua in race folder

function win ( rank, finishtime )

if ( rank == 1 ) then

givePlayerMoney ( source, 100 )

end

end

addEvent ( "onPlayerFinish", true )

addEventHandler( "onPlayerFinish", getRootElement(), win )

but that not work

Posted

you know that you have to add your scripting files to the meta.xml don't you? by the way you should start a new resource, adding this to race wouldn't be too good for the organization

and yes my code works, yours should too

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