JohnDoe91286 Posted December 13, 2009 Share Posted December 13, 2009 I have a wanted system running on my server, it all works fine exept for the fact that hardcored into MTA the wanted level is set to 0 onPlayerWasted. Is there any way of manually removing this or does it have to be un-hardcored from MTA? I mean, could it be un-hardcored because it gives better oppertunities then? If somebody wanted it how it is now all they would have to use is the code below. And of course, if they wanted it like I do, they just let the wanted level stay as it is. function resetWanted () setPlayerWantedLevel ( source, 0 ) end addEventHandler ( "onPlayerWasted", getRootElement(), resetWanted ) Link to comment
50p Posted December 14, 2009 Share Posted December 14, 2009 You can try and set it back to what player's wanted level was before they died. Link to comment
JohnDoe91286 Posted December 14, 2009 Author Share Posted December 14, 2009 How would I do that? function keepWanted () wlevel = getPlayerWantedLevel ( source ) setPlayerWantedLevel ( source, wlevel ) end addEventHandler ( "onPlayerWasted", getRootElement(), keepWanted ) Link to comment
50p Posted December 14, 2009 Share Posted December 14, 2009 addEventHandler( "onPlayerWasted", getRootElement( ), function( ) setElementData( source, "wantedlevelB4death", getPlayerWantedLevel( source ), false ); end ) addEventHandler( "onPlayerSpawn", getRootElement( ), function( ) local wantedlevel = getElementData( source, "wantedlevelB4death" ); if wantedlevel and wantedlevel > 0 then setPlayerWantedLevel( source, wantedlevel ); end end ) But as I said try. Not sure if it'll work since I'm not sure if level is set back to 0 after all event handlers are executed or just before event is triggered. Link to comment
eAi Posted December 14, 2009 Share Posted December 14, 2009 I'd guess it's GTA doing it in it's SpawnPlayer function, which I believe happens before the onPlayerSpawn event. 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