Snake Posted July 20, 2012 Share Posted July 20, 2012 Here's the code. I buy a card, takes my money but does not operate a network of set maps(next maps) function buyMap(thePlayer,mapName) if mapIsAlreadySet == false then if not (mapName == "") then local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) if playerCash >= mapCost then executeCommandHandler("pnfnsdhasd3w7432jhdsbw3ersdncsdir",thePlayer,mapName) savePlayerData(thePlayer,"cash",playerCash-mapCost) outputChatBox("#FFFFFFNextmap: "..getPlayerName(thePlayer).."#FFFFFF has bought a next map!",getRootElement(),255,255,255,true) outputChatBox("#FFFFFFNextmap: #00AAFF"..mapName,getRootElement(),255,255,255,true) mapIsAlreadySet = thePlayer local oldmapbuys = loadPlayerData(thePlayer,"mapBuys") savePlayerData(thePlayer,"mapBuys", oldmapbuys + 1) CheckAchievement(thePlayer,13) scoreboardRefresh(thePlayer) else outputChatBox("#00AAFF# #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) end else outputChatBox("#00AAFF# #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("#00AAFF# #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) end end function unbuyMap(thePlayer) if mapIsAlreadySet ~= false then if mapIsAlreadySet == thePlayer then executeCommandHandler("pnfnsdhasd3w7432jhdsbw3ersdncsdir",thePlayer,nil) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) savePlayerData(thePlayer,"cash",playerCash+(mapCost/4)*3) outputChatBox("#FFFFFFNextmap: "..getPlayerName(thePlayer).."#FFFFFF has unbought a next map!",getRootElement(),255,255,255,true) mapIsAlreadySet = false local oldmapbuys = loadPlayerData(thePlayer,"mapBuys") savePlayerData(thePlayer,"mapBuys", oldmapbuys - 1) CheckAchievement(thePlayer,13) scoreboardRefresh(thePlayer) else outputChatBox("#00AAFF# #FFFFFFYou didn't buy that map!",thePlayer,255,255,255,true) end else outputChatBox("#00AAFF# #FFFFFFNo map has been bought!",thePlayer,255,255,255,true) end end I tried the following code: But this set maps work (next maps work). But I have not deducted the money function buyMap(thePlayer,mapName) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) if mapIsAlreadySet == false then if not (mapName == "") then if playerCash >= mapCost then executeCommandHandler("nextmap",thePlayer,mapName) else outputChatBox("#0095FF* #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) end else outputChatBox("#0095FF* #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("#0095FF* #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("onScriptSetNextMap",true) addEventHandler("onScriptSetNextMap",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) end) addEvent("onRaceSetNextMap",true) addEventHandler("onRaceSetNextMap",getRootElement(), function () mapIsAlreadySet = true end) function unbuyMap(thePlayer) if mapIsAlreadySet ~= false then if mapIsAlreadySet == thePlayer then executeCommandHandler("nextmap",thePlayer,mapName) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) savePlayerData(thePlayer,"cash",playerCash+(mapCost/4)*3) outputChatBox("#FFFFFFNextmap: "..getPlayerName(thePlayer).."#FFFFFF has unbought a next map!",getRootElement(),255,255,255,true) mapIsAlreadySet = false local oldmapbuys = loadPlayerData(thePlayer,"mapBuys") savePlayerData(thePlayer,"mapBuys", oldmapbuys - 1) CheckAchievement(thePlayer,13) scoreboardRefresh(thePlayer) else outputChatBox("#00AAFF# #FFFFFFYou didn't buy that map!",thePlayer,255,255,255,true) end else outputChatBox("#00AAFF# #FFFFFFNo map has been bought!",thePlayer,255,255,255,true) end end function resetMapSetStatus() mapIsAlreadySet = false end addEventHandler("onMapStarting",getRootElement(),resetMapSetStatus) Help me pls. thanks in advance.. Link to comment
Tete omar Posted July 21, 2012 Share Posted July 21, 2012 What's wrong here ? or what your objective ? Link to comment
Snake Posted July 21, 2012 Author Share Posted July 21, 2012 In general in the first code does not work setmaps (next maps) Link to comment
Snake Posted July 21, 2012 Author Share Posted July 21, 2012 Thank you very much that he wanted to help! I've already done Link to comment
Tete omar Posted July 21, 2012 Share Posted July 21, 2012 you're welcome good luck anyway 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