Hello. i found this, and i dont know why it's not working. i tried fix it but maybe i'm to weak for lua
maybe anyone can help me?
in gui (i see it but when i pressed this it isn't working)
.
.
lblSetNextMapTitle = guiCreateLabel(342,189,245,16,"Set a next map",false,tabs[5])
guiLabelSetColor(lblSetNextMapTitle,255,120,0)
guiLabelSetVerticalAlign(lblSetNextMapTitle,"center")
guiLabelSetHorizontalAlign(lblSetNextMapTitle,"center",false)
guiSetFont(lblSetNextMapTitle,"default-bold-small")
lblSearchForMaps = guiCreateLabel(25,25,101,14,"Search for maps:",false,tabs[5])
guiLabelSetColor(lblSearchForMaps,255,120,0)
guiLabelSetVerticalAlign(lblSearchForMaps,"center")
guiSetFont(lblSearchForMaps,"default-bold-small")
lblSelectedMapNameTitle = guiCreateLabel(342,97,245,16,"Selected map name:",false,tabs[5])
guiLabelSetColor(lblSelectedMapNameTitle,150,255,150)
guiSetFont(lblSelectedMapNameTitle,"default-bold-small")
lblSelectedMapAuthorTitle = guiCreateLabel(342,136,245,16,"Map type:",false,tabs[5])
guiLabelSetColor(lblSelectedMapAuthorTitle,150,255,150)
guiSetFont(lblSelectedMapAuthorTitle,"default-bold-small")
lblSelectedMapName = guiCreateLabel(342,113,245,16,"N/A",false,tabs[5])
lblSelectedMapAuthor = guiCreateLabel(342,152,245,16,"N/A",false,tabs[5])
lblMapTabLine1 = guiCreateLabel(342,309,245,27,"---------------------------------------------------------------",false,tabs[5])
guiLabelSetColor(lblMapTabLine1,255,120,0)
guiLabelSetVerticalAlign(lblMapTabLine1,"center")
guiLabelSetHorizontalAlign(lblMapTabLine1,"center",false)
guiSetFont(lblMapTabLine1,"default-bold-small")
lblMapTabLine2 = guiCreateLabel(342,173,245,16,"---------------------------------------------------------------",false,tabs[5])
guiLabelSetColor(lblMapTabLine2,255,120,0)
guiLabelSetVerticalAlign(lblMapTabLine2,"center")
guiLabelSetHorizontalAlign(lblMapTabLine2,"center",false)
guiSetFont(lblMapTabLine2,"default-bold-small")
lblMapTabLine3 = guiCreateLabel(342,81,245,16,"---------------------------------------------------------------",false,tabs[5])
guiLabelSetColor(lblMapTabLine3,255,120,0)
guiLabelSetVerticalAlign(lblMapTabLine3,"center")
guiLabelSetHorizontalAlign(lblMapTabLine3,"center",false)
guiSetFont(lblMapTabLine3,"default-bold-small")
editMapSearch = guiCreateEdit(129,23,198,21,"",false,tabs[5])
btnBuyNextMap = guiCreateButton(380,265,169,44,"Buy as next map - $4000",false,tabs[5])
.
.
server.
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("onExternalNextmapRequest",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("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)
achievement31(thePlayer)
end)
addEvent("onRaceSetNextMap",true)
addEventHandler("onRaceSetNextMap",getRootElement(),
function ()
mapIsAlreadySet = true
end)
when i used other fucnktions panel (color vehicle, light, skins and more), all are working just not "map buy".
and when i pressed button in gui nothink to do.
and i see in this script thi, but i don't know what it's that
function setElementDataOnStart(source)
thePlayer = source
local a = loadPlayerData(thePlayer,"everPurchasedSkin")
local b = loadPlayerData(thePlayer,"everPurchasedNametagColor")
local c = loadPlayerData(thePlayer,"everSetCustomVehicleColor")
local d = loadPlayerData(thePlayer,"useCustomVehicleColor")
local e = loadPlayerData(thePlayer,"c1")
local f = loadPlayerData(thePlayer,"c2")
local g = loadPlayerData(thePlayer,"c3")
local h = loadPlayerData(thePlayer,"c4")
local i = loadPlayerData(thePlayer,"hlcRed")
local j = loadPlayerData(thePlayer,"hlcGreen")
local k = loadPlayerData(thePlayer,"hlcBlue")
local adminredo = loadPlayerData(thePlayer,"admin_redo")
local adminnextmap = loadPlayerData(thePlayer,"admin_nextmap")
setElementData(thePlayer,"everPurchasedSkin",a)
setElementData(thePlayer,"everPurchasedNametagColor",b)
setElementData(thePlayer,"everSetCustomVehicleColor",c)
setElementData(thePlayer,"useCustomVehicleColor",d)
setElementData(thePlayer,"c1",e)
setElementData(thePlayer,"c2",f)
setElementData(thePlayer,"c3",g)
setElementData(thePlayer,"c4",h)
setElementData(thePlayer,"hlcRed",i)
setElementData(thePlayer,"hlcGreen",j)
setElementData(thePlayer,"hlcBlue",k)
setElementData(thePlayer,"admin_redo",adminredo)
setElementData(thePlayer,"admin_nextmap",adminnextmap)
end