.:HyPeX:. Posted March 3, 2012 Share Posted March 3, 2012 Hi all Guyz, well, for long time i have been triyng to fix this, when i click the button nothing happens, i think im missing something, but i cant find it... Server Side: -- Buy a next map function buyMap(thePlayer,mapName) --local playerLevel = tonumber(loadPlayerData(thePlayer,"level")) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) if mapIsAlreadySet == false then if not (mapName == "") then --if playerLevel >= mapLevel then if playerCash >= mapCost then triggerEvent("onNextmapRequest",thePlayer,thePlayer,mapName) else outputChatBox("#FF6600* #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) end --else --outputChatBox("#FF6600* #FFFFFFYou need to be level #ABCDEF"..mapLevel.." #FFFFFFor higher to set maps!",thePlayer,255,255,255,true) --end else outputChatBox("#FF6600* #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("#FF6600* #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) end end function resetMapSetStatus() mapIsAlreadySet = false end addEventHandler("onMapStarting",getRootElement(),resetMapSetStatus) addEvent("onSetNextMap",true) addEventHandler("onSetNextMap",getRootElement(), function (mapName) thePlayer = source local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) savePlayerData(thePlayer,"cash",playerCash-mapCost) outputChatBox("#FFFFFFNextmap: "..getPlayerName(thePlayer).."#FFFFFF has bought a next map!",getRootElement(),255,255,255,true) outputChatBox("#FFFFFFNextmap: #FF8800"..mapName,getRootElement(),255,255,255,true) mapIsAlreadySet = true scoreboardRefresh(thePlayer) achievement31(thePlayer) end) addEvent("onSetNextMap",true) addEventHandler("onSetNextMap",getRootElement(), function () mapIsAlreadySet = true end) Client Side: function buyNextMap() local selectedMap = guiGridListGetSelectedItem(gridMaps) if selectedMap == -1 then outputChatBox("#FF6600* #FFFFFFERROR! Please select a Map to buy!",255,255,255,true) local row,column = guiGridListGetSelectedItem(gridMaps) local mapName = guiGridListGetItemText(gridMaps,row,1) addEventHandler("onClientGUIClick",btn_buyNextMap, buyNextMap, buyMap, true) callServerfunction("buyMap",getLocalPlayer(),mapName,getPlayerName, onClientGUIClick) end end This is an image of tab related to this: (its on KN3 so wont drop) Link to comment
drk Posted March 3, 2012 Share Posted March 3, 2012 (edited) Try: Server Side: addEvent("onMapStarting",true) function buyMap(thePlayer,mapName) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) if ( mapIsAlreadySet == false ) then if ( not mapName == "" ) then if ( playerCash >= mapCost ) then triggerEvent("onSetNextMap",thePlayer,thePlayer,mapName) else outputChatBox("#FF6600* #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) end else outputChatBox("#FF6600* #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("#FF6600* #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) end end function resetMapSetStatus() mapIsAlreadySet = false end addEventHandler("onMapStarting",getRootElement(),resetMapSetStatus) addEvent("onSetNextMap",true) addEventHandler("onSetNextMap",getRootElement(), function (thePlayer,mapName) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) savePlayerData(thePlayer,"cash",playerCash-mapCost) outputChatBox("#FFFFFFNextmap: "..getPlayerName(thePlayer).."#FFFFFF has bought a next map!",getRootElement(),255,255,255,true) outputChatBox("#FFFFFFNextmap: #FF8800"..mapName,getRootElement(),255,255,255,true) mapIsAlreadySet = true scoreboardRefresh(thePlayer) achievement31(thePlayer) end ) Client Side: function buyNextMap() local selectedMap, column = guiGridListGetSelectedItem(gridMaps) if not selectedMap and not column and selectedMap == -1 and column == -1 then outputChatBox("#FF6600* #FFFFFFERROR! Please select a Map to buy!",255,255,255,true) -- you can't use color codes in client-side else local mapName = guiGridListGetItemText(gridMaps,colName,1) --change colName by your column name. triggerServerEvent("buyMap",getLocalPlayer(),mapName,getPlayerName(localPlayer)) end end addEventHandler("onClientGUIClick",btn_buyNextMap, buyNextMap, true) Updated. Verify if btn_buyNextMap exists !! Edited March 3, 2012 by Guest Link to comment
.:HyPeX:. Posted March 3, 2012 Author Share Posted March 3, 2012 Still, nothing happens... Link to comment
Kenix Posted March 3, 2012 Share Posted March 3, 2012 Draken, You not add event buyMap and handler. 1 argument is string( not element ), 2 argument is string in function buyMap. Link to comment
.:HyPeX:. Posted March 3, 2012 Author Share Posted March 3, 2012 My bad.. Copy my code again Still not work. Link to comment
.:HyPeX:. Posted March 4, 2012 Author Share Posted March 4, 2012 No one has idea?... i cant find any fix. Link to comment
drk Posted March 4, 2012 Share Posted March 4, 2012 Server Side: addEvent("onMapStarting",true) addEvent('buyMap',true) function buyMap(thePlayer,mapName) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) if ( mapIsAlreadySet == false ) then if ( not mapName == "" ) then if ( playerCash >= mapCost ) then triggerEvent("onSetNextMap",thePlayer,thePlayer,mapName) else outputChatBox("#FF6600* #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) end else outputChatBox("#FF6600* #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("#FF6600* #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) end end addEventHandler('buyMap',root,buyMap) function resetMapSetStatus() mapIsAlreadySet = false end addEventHandler("onMapStarting",getRootElement(),resetMapSetStatus) addEvent("onSetNextMap",true) addEventHandler("onSetNextMap",getRootElement(), function (thePlayer,mapName) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) savePlayerData(thePlayer,"cash",playerCash-mapCost) outputChatBox("#FFFFFFNextmap: "..getPlayerName(thePlayer).."#FFFFFF has bought a next map!",getRootElement(),255,255,255,true) outputChatBox("#FFFFFFNextmap: #FF8800"..mapName,getRootElement(),255,255,255,true) mapIsAlreadySet = true scoreboardRefresh(thePlayer) achievement31(thePlayer) end ) Client Side: function buyNextMap() local selectedMap, column = guiGridListGetSelectedItem(gridMaps) if not selectedMap and not column and selectedMap == -1 and column == -1 then outputChatBox("#FF6600* #FFFFFFERROR! Please select a Map to buy!",255,255,255,true) -- you can't use color codes in client-side else local mapName = guiGridListGetItemText(gridMaps,colName,1) --change colName by your column name. triggerServerEvent("buyMap",localPlayer,localPlayer,mapName) end end addEventHandler("onClientGUIClick",btn_buyNextMap, buyNextMap, true) Link to comment
.:HyPeX:. Posted March 14, 2012 Author Share Posted March 14, 2012 Still Not Working!!!!!!!!!!!!... Link to comment
TwiX! Posted March 15, 2012 Share Posted March 15, 2012 1)This map never will set, because its not your script, You stole script in NexTrime panel. 2)You need trigger 'racevoting_server.lua' (Function Nextmap) Link to comment
GanJaRuleZ Posted March 15, 2012 Share Posted March 15, 2012 *facepalm* Dude , you make ur own nextmap , just trigger an event when a button is double clicked , and then simply do executeCommandHandler("nextmap",source,map) or smth like that. Link to comment
.:HyPeX:. Posted March 15, 2012 Author Share Posted March 15, 2012 1)This map never will set, because its not your script,You stole script in NexTrime panel. 2)You need trigger 'racevoting_server.lua' (Function Nextmap) i didnt stole the script, i have it and im trying to fix it. okay, i thanks, thats what i forgot, the racevoting. 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