fortynigguh Posted April 2, 2018 Share Posted April 2, 2018 I made userpanel, with shop... I made a code for userpanel, to buy a map for cash, but map is just adding to queue.. Like map doesnt fit.. Im an amateur on lua code, so please help me sb -- Buy a next map // wolfeens function buyMap(thePlayer,mapName,command) if not PVP[thePlayer] then local account = getPlayerAccount(thePlayer) if not (isGuestAccount(account)) then local playerCash = tonumber(getAccountData(account,"cash")) if not (mapName == "") then if playerCash >= mapCost then if command then mapName = getMapName(mapName) else mapName = tostring(mapName) end if not mapTimer[mapName] then table.insert(mapQueue,mapName) local freeMaps = tonumber(getAccountData(account,"freeMaps")) if freeMaps ~= 0 then addStat(account,"freeMaps",-1) else setAccountData(account,"cash",playerCash - mapCost) end addStat(account,"buyedMaps",1) scoreboardRefresh(thePlayer) mapTimer[mapName] = true setTimer(resetMapTimer,900000,1,mapName) if #mapQueue == 1 then triggerEvent("onUseranelWantSetMap",getRootElement(),mapQueue[1]) end callClientFunction(thePlayer,"setFreeMapPurchase",getAccountData(account,"freeMaps")) unlockAchievement(thePlayer,18) unlockAchievement(thePlayer) showServerMsg(getRootElement(),"Map queue",getPlayerName(thePlayer).." #ffffffbought and add "..mapName.." to map queue") callClientFunction(getRootElement(),"updateMapQueueList",mapQueue) else showServerMsg(thePlayer,"Buy nextmap","#FFFFFFYou can't set this map now, wait some time to set!") end else showServerMsg(thePlayer,"Buy nextmap","#FFFFFFYou don't have enough money to set a map!") end else showServerMsg(thePlayer,"Buy nextmap","#FFFFFFPlease select a map from the list first!") end end else showServerMsg(thePlayer,"Buy nextmap","#FFFFFFYou can't buy maps because you're playing a PVP match now!") end end Link to comment
Slim Posted April 2, 2018 Share Posted April 2, 2018 I don't think you made this code. Link to comment
fortynigguh Posted April 2, 2018 Author Share Posted April 2, 2018 4 hours ago, Justin|X5| said: I don't think you made this code. yupp i made this, but witta little friend help (he helped me witta functions) Link to comment
fortynigguh Posted April 2, 2018 Author Share Posted April 2, 2018 nobody can help with it? 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