Newbie Posted March 11, 2014 Share Posted March 11, 2014 (edited) I need to make it work with: triggerEvent("onBoughtMap",getRootElement(),mapName) not with: triggerServerEvent("doBuyNextMap",localPlayer,localPlayer,map) addEvent("doBuyNextMap",true) addEventHandler("doBuyNextMap",getRootElement(),function(player,mapName) if not player or not mapName then return else if not g_ForcedNextMap or g_ForcedNextMap == nil then executeCommandHandler("buyMap", player, mapName) end end end) addEvent("doBuyRedoMap",true) addEventHandler("doBuyRedoMap",getRootElement(),function(player) if not player then return else if not g_ForcedNextMap or g_ForcedNextMap == nil then local mapName = call(getResourceFromName("mapmanager"),"getRunningGamemodeMap") executeCommandHandler("buyMap", player,getMapName(mapName)) end end end) addCommandHandler("buyMap",function(player,command, ...) local query = #{...} > 0 and table.concat ( {...}, ' ' ) or nil if not query then if g_ForcedNextMap then outputDebugString ( 'Next map is ' .. getMapName ( g_ForcedNextMap ) ); else outputDebugString ( 'Next map is not set' ); end return end local map, errormsg = findMap ( query ); if not map then outputRace ( errormsg, player ); return end g_ForcedNextMap = map; outputChatBox ( "#ff6666[MAP] #ffffff"..getPlayerName ( player ) .. ' #ffffffhas bought #ff6666'..getMapName ( g_ForcedNextMap ).." #ffffffas next map", g_Root, 255, 255, 255, true ); end) Edited March 12, 2014 by Guest Link to comment
Moderators Citizen Posted March 11, 2014 Moderators Share Posted March 11, 2014 Tell us why and what you are really trying to do. Because for me it doesn't really make sense. Link to comment
Newbie Posted March 11, 2014 Author Share Posted March 11, 2014 I just cant make this viewtopic.php?f=91&t=72258 **** working.. Link to comment
Bonsai Posted March 11, 2014 Share Posted March 11, 2014 Race resource has a nextmap command. For buy map command you just have to copy that function and attach it to another command handler and maybe put some check if the player did buy a map already... Link to comment
Newbie Posted March 11, 2014 Author Share Posted March 11, 2014 For buy map command you just have to copy that function and attach it to another command handler Can someone show me an example so i can start learning. Link to comment
Moderators Citizen Posted March 11, 2014 Moderators Share Posted March 11, 2014 I just cant make this viewtopic.php?f=91&t=72258 **** working.. Modify the other code instead of the Race resource: triggerEvent("doBuyNextMap", thePlayer, thePlayer, mapName) Link to comment
Newbie Posted March 12, 2014 Author Share Posted March 12, 2014 I just cant get it omgf.. Link to comment
Moderators Citizen Posted March 12, 2014 Moderators Share Posted March 12, 2014 I just cant get it omgf.. Wow such a usefull post for us ... What's the problem ? - you didn't understand what I asked you to do ? - you understood and replaced correctly but my code isn't working ? - you didn't understand my code but it's working ? And we would like to see the errors too. Link to comment
Moderators Citizen Posted March 12, 2014 Moderators Share Posted March 12, 2014 From my PMs: omg. can you actually tell me what should i do ? Change racevoting_server or ?.. Ok I'll tell you again one more time: Here viewtopic.php?f=91&t=72258 in the 1st script, replace this line (l.23): triggerEvent("onBoughtMap",getRootElement(),mapName) by this: triggerEvent("doBuyNextMap", thePlayer, thePlayer, mapName) What's so complicated ?! Link to comment
Moderators Citizen Posted March 12, 2014 Moderators Share Posted March 12, 2014 Any error ? (/debugscript 3) Link to comment
Moderators Citizen Posted March 12, 2014 Moderators Share Posted March 12, 2014 Ok found this. Replace this: function buyMap(thePlayer,mapName,command) By this: function buyMap( thePlayer, command, mapName ) Link to comment
Newbie Posted March 13, 2014 Author Share Posted March 13, 2014 lol.. Now when i buy map it writes that i bought unknown.. http://i.imgur.com/akePWrJ.png Link to comment
Newbie Posted March 13, 2014 Author Share Posted March 13, 2014 My function: function getMapName( map ) return getResourceInfo( map, "name" ) or getResourceName( map ) or "unknown" end 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