Anubhav Posted March 17, 2014 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.
cheez3d Posted March 17, 2014 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()
Anubhav Posted March 17, 2014 Author Posted March 17, 2014 What do you mean? I din't understood anything.
iPrestege Posted March 17, 2014 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 .
Anubhav Posted March 17, 2014 Author 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
iPrestege Posted March 17, 2014 Posted March 17, 2014 Yes it is possible : getResourceState getResourceInfo exports
Anubhav Posted March 17, 2014 Author Posted March 17, 2014 What should i do in getResourceInfo first argument what should i write in it?
iPrestege Posted March 17, 2014 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 .
Anubhav Posted March 17, 2014 Author Posted March 17, 2014 Ok. I made the function and got what to do...
Recommended Posts