#Paper Posted June 7, 2011 Share Posted June 7, 2011 Just the text doesn't changes to "Random" when new map starts: function onMapStart() g_dxGUI.nextmapdisplay:text("Next Map: Random") removeEventHandler("onGamemodeMapStart", getRootElement(), onMapStart) end addEvent("onNextMapSet", true) function setNextMapText(theText) g_dxGUI.nextmapdisplay:text("Next Map: "..theText) addEventHandler("onGamemodeMapStart", getRootElement(), onMapStart) end addEventHandler("onNextMapSet", getRootElement(), setNextMapText) Link to comment
Dark Dragon Posted June 7, 2011 Share Posted June 7, 2011 afaik onGamemodeMapStart is a custom event triggered by the mapmanager resource. try to add it before adding the event handler to it Link to comment
#Paper Posted June 7, 2011 Author Share Posted June 7, 2011 Mhh, no sry, same problem Another Problem: The function is like not triggered, nothing happens: addEvent("onPlayerPickUpRacePickup", true) function disableGhostmode() if info == "Destruction derby" then if pickupType == "vehiclechange" then if vehicleModel == 425 then outputChatBox("* Hunter Reached! Ghostmode will be diasbled in 10 seconds!", getRootElement(), 35, 107, 142) setTimer(gmoff, 100000, 1) end end end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),disableGhostmode) Link to comment
Aibo Posted June 7, 2011 Share Posted June 7, 2011 because you're not passing any parameters to the function: info, pickupType, vehicleModel. Link to comment
#Paper Posted June 7, 2011 Author Share Posted June 7, 2011 Nothing For the sencod problem? do you see any error? Link to comment
Aibo Posted June 7, 2011 Share Posted June 7, 2011 first one: not enough info. like where is your event triggered, is theText defined, what's the debug output? second: read my previous post. you forgot all of the event handler arguments: function disableGhostmode() Link to comment
#Paper Posted June 7, 2011 Author Share Posted June 7, 2011 ye, i inserted these parameters, but nothing. the event for pickup is triggere from recevoting_server.lua when someone sets nextmap, i inserted that trigger triggerClientEvent("onNextMapSet", getRootElement(), getMapName(map)) Link to comment
Aibo Posted June 7, 2011 Share Posted June 7, 2011 first: i'm not sure if onGamemodeMapStart event is available clientside. second: addEvent("onPlayerPickUpRacePickup", true) function disableGhostmode(_, pickupType, vehicleModel) if pickupType == "vehiclechange" and vehicleModel == "425" then outputChatBox("* Hunter Reached! Ghostmode will be diasbled in 10 seconds!", getRootElement(), 35, 107, 142) setTimer(gmoff, 100000, 1) end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),disableGhostmode) also 100000ms is not 10 seconds, it's 100 seconds. Link to comment
#Paper Posted June 7, 2011 Author Share Posted June 7, 2011 also 100000ms is not 10 seconds, it's 100 seconds. Oh, my bad... ty first: i'm not sure if onGamemodeMapStart event is available clientside. Maybe onClientGamemodeMapStart? In the resource catalougue @ Mapmanager it isn't wroten if it's just for SS... Link to comment
Discord Moderators Zango Posted June 7, 2011 Discord Moderators Share Posted June 7, 2011 getMapName returns the current server map in a string, not whatever map parsed. I'm not sure if you know this already, but it doesn't seem like it on this piece you posted: triggerClientEvent("onNextMapSet", getRootElement(), getMapName(map)) It won't break anything, but I'm not sure if it produces the output you want (if setMapName is called after that trigger it most likely wont) Maybe onClientGamemodeMapStart? In the resource catalougue @ Mapmanager it isn't wroten if it's just for SS... There isn't any clientside for the mapmanager by default, so you'll have to script one to get "onClientGamemodeMapStart" An easy solution would be to place code similar to this in mapmanager_main.lua: addEventHandler ('onGamemodeMapStart', root, function (res) local txt = getResourceName (res) if txt then triggerClientEvent ('onClientGamemodeMapStart', root, txt) end end ) and create a clientside file where you do the text stuff. Link to comment
#Paper Posted June 8, 2011 Author Share Posted June 8, 2011 Ty, it works But, for the 2nd problem? 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