Anubhav Posted March 17, 2014 Share Posted March 17, 2014 Is it possible to check if map is started? Or i need to make a event. I don't need it for race . I need for my gamemode of rhino TDM. Please help. Remember if you know how to do then please show a example code. Link to comment
cheez3d Posted March 17, 2014 Share Posted March 17, 2014 You can use addEvent, addEventHandler and triggerEvent. EXAMPLE: local map = { info = {name = "Map",author = "Someone"} } map.creation_handler = function() createObject(...) createObject(...) triggerEvent("onMapLoad",resourceRoot,map.info.name,map.info.author) end addEvent("onMapLoad",true) addEventHandler("onMapLoad",resourceRoot,function(name,author) -- your stuff end) -- and to create the map you call the creation_handler function map.creation_handler() Link to comment
Anubhav Posted March 17, 2014 Author Share Posted March 17, 2014 What do you mean? I din't understood anything. Link to comment
iPrestege Posted March 17, 2014 Share Posted March 17, 2014 You can make it more simply : addEvent ( 'onServerMapStart',true ) addEventHandler ( 'onResourceStart',root, function ( resource ) if getResourceInfo ( resource,'type' ) == 'map' then triggerEvent ( 'onServerMapStart',resourceRoot ) end end ) In the other resource or any resource : addEventHandler ( 'onServerMapStart',root, function ( ) outputChatBox ( 'Map Started',root ) end ) Now you can use 'onServerMapStart' Event when want . Link to comment
Anubhav Posted March 17, 2014 Author Share Posted March 17, 2014 Hmm. Is it possible to make a exported function to check if map start. Like : If its true then its started else if its false then not local map = exports.resourcename:isMapStart() if map == false then --My code end Link to comment
iPrestege Posted March 17, 2014 Share Posted March 17, 2014 Yes it is possible : getResourceState getResourceInfo exports Link to comment
Anubhav Posted March 17, 2014 Author Share Posted March 17, 2014 What should i do in getResourceInfo first argument what should i write in it? Link to comment
iPrestege Posted March 17, 2014 Share Posted March 17, 2014 What should i do in getResourceInfo first argument what should i write in it? The resource that you want to get info about. I suggest you to use the event better such i posted above . Link to comment
Anubhav Posted March 17, 2014 Author Share Posted March 17, 2014 Ok. I made the function and got what to do... Link to comment
iPrestege Posted March 17, 2014 Share Posted March 17, 2014 Glad to hear it! Good luck dude! Link to comment
Anubhav Posted March 17, 2014 Author Share Posted March 17, 2014 Ty.... Lockthistopicpls Link to comment
Recommended Posts