h4x7o0r Posted December 31, 2012 Posted December 31, 2012 Hello there, I wanna check when map starts, if the map has specific word "dm" in its name. If so , i wanna start a resource . Otherwise, i want that the resource to be stopped during map playing. I have the following code: addEvent("onClientRequestRespawn", true) addEventHandler("onClientRequestRespawn", getRootElement(), function checkDM ( mapName ) if not string.find( mapName, "[DD]", 1, true ) or string.find( mapName, "[FDD]", 1, true ) then startResource (test) else stopResource (test) end )
Castillo Posted December 31, 2012 Posted December 31, 2012 Try this: addEventHandler ( "onMapStarting", root, function ( mapInfo ) if string.find ( mapInfo.name, "[DM]", 1, true ) then startResource ( getResourceFromName ( "TEST" ) ) else stopResource ( getResourceFromName ( "TEST" ) ) end end )
h4x7o0r Posted December 31, 2012 Author Posted December 31, 2012 Thank you for your help. I've test it, but doesn't work without any error. client or server ? i've use it both (even with admin rights set on the resource itself).
Castillo Posted December 31, 2012 Posted December 31, 2012 Try this and see what it says on chat box: addEventHandler ( "onMapStarting", root, function ( mapInfo ) outputChatBox ( "Map name: ".. mapInfo.name ) if string.find ( mapInfo.name, "[DM]", 1, true ) then startResource ( getResourceFromName ( "TEST" ) ) else stopResource ( getResourceFromName ( "TEST" ) ) end end )
h4x7o0r Posted December 31, 2012 Author Posted December 31, 2012 I've tried new code, nothing's appearing. What kind a script should this be ? i presume it's server-side. LE. i've checked again and it's appearing Map name : ..
Jaysds1 Posted December 31, 2012 Posted December 31, 2012 I've tried new code, nothing's appearing. What kind a script should this be ? i presume it's server-side.LE. i've checked again and it's appearing Map name : .. yes it is server-sided. anyways, if that event isn't called, then I'm assuming that you aren't running the Race Gamemode
h4x7o0r Posted December 31, 2012 Author Posted December 31, 2012 I'm using race gamemode and it's says for example : Map name : Cross XL DD
Jaysds1 Posted December 31, 2012 Posted December 31, 2012 yes it's stopped by default try starting a map with this in its name: "[DM]"
h4x7o0r Posted December 31, 2012 Author Posted December 31, 2012 the mistake was that my maps was kinda Cross 1 DM and not Cross 1 [DM] like. So i've modified the script and now it's working very fine . Thank you guys for all your help. Now all i need is to figure it out why isn't working that well votemanager but there's another topic. Again thank you for helping me. All the best.
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