Erhabi Posted April 7, 2010 Share Posted April 7, 2010 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 Link to comment
darkdreamingdan Posted April 7, 2010 Share Posted April 7, 2010 Race provides events which you can use in combination with setPlayerMoney to achieve this. Refer to https://wiki.multitheftauto.com/wiki/Resource:Race As you can see, there's an onPlayerFinish event. Link to comment
Erhabi Posted April 7, 2010 Author Share Posted April 7, 2010 Can you give me an example? Link to comment
Dark Dragon Posted April 7, 2010 Share Posted April 7, 2010 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 ) Link to comment
Erhabi Posted April 7, 2010 Author Share Posted April 7, 2010 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 Link to comment
Dark Dragon Posted April 7, 2010 Share Posted April 7, 2010 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 Link to comment
dzek (varez) Posted April 7, 2010 Share Posted April 7, 2010 And AFAIR race gamemode has money HUD disabled by default.. Maybe you just don't know that script is working? Link to comment
karlis Posted April 8, 2010 Share Posted April 8, 2010 showPlayerHudComponent(player,"money",true) 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