- Moin, ich habe folgendes Problem.
- Wenn bei Race eine Map läuft, und ich Kaufe im Userpanel eine, und die Map die schon läuft wird mit dem Befehl /redo neugestartet, wird die Map Normal neugestartet. Aber sobald dann einer eine Map kauft wird die vorher gekaufte Map einfach übergesetted. :C
Lua
-- Buy a next map
function buyMap(thePlayer,mapName,command)
local account = getPlayerAccount(thePlayer)
if not (isGuestAccount(account)) then
local playerCash = tonumber(getAccountData(account,"cash"))
if #mapQueue == 1 then
outputChatBox("#FFFFFF[#0080ffSERVER#FFFFFF] #FFFFFFQueue is full, please wait.",thePlayer,255,255,255,true)
return
end
if not mapShopState then
outputChatBox("#FFFFFF[#0080FFSERVER#FFFFFF] #FFFFFFMap shop is Currently #FF0000Disabled",thePlayer,255,255,255,true)
return
end
if not (mapName == "") then
if playerCash >= mapCost then
if command then
mapName = getMapName(mapName)
else
mapName = tostring(mapName)
end
if not mapTimer[mapName] then
if not tableFind(mapQueue,mapName) then
table.insert(mapQueue,mapName)
outputChatBox("#FFFFFF[#0080FFSERVER#FFFFFF] #ffffff"..getPlayerName(thePlayer).."#FFFFFF has bought #FFFFFF"..tostring(mapName).."#ffffff!",getRootElement(),255,255,255,true)
--outputChatBox("#FFFFFF[#0080FFMAPSHOP#FFFFFF] #ffffff"..tostring(mapName).."#ffffff successfully added to map queue!",getRootElement(),255,255,255,true)
addStat(account,"buyedMaps",1)
setAccountData(account,"cash",playerCash - mapCost)
scoreboardRefresh(thePlayer)
mapTimer[mapName] = setTimer(resetMapTimer,60000*35,1,mapName)
if #mapQueue <= 1 then
triggerEvent("onBoughtMap",getRootElement(),mapName)
end
callClientFunction(getRootElement(),"setMapQueue",mapQueue)
else
outputChatBox("#FFFFFF[#0080FFSERVER#FFFFFF] #FFFFFFMap "..mapName.." is already in map queue.",thePlayer,255,255,255,true)
end
else
local remaining, executesRemaining, totalExecutes = getTimerDetails(mapTimer[mapName])
if remaining < 60000 then
remaining = math.floor(remaining/1000).."#ffffff second"
else
minutes = math.floor(remaining/60000)
remaining = string.format('%02d',minutes).."#ffffff minutes"
end
outputChatBox("#FFFFFF[#0080FFSERVER#FFFFFF] #FFFFFFYou have to wait #FFFFFF"..remaining.." to set this map!",thePlayer,255,255,255,true)
end
else
outputChatBox("#FFFFFF[#0080FFSERVER#FFFFFF] #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true)
end
else
outputChatBox("#FFFFFF[#0080FFSERVER#FFFFFF] #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true)
end
else
outputChatBox("#FFFFFF[#0080FFSERVER#FFFFFF] #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true)
end
end
function resetMapSetStatus(g_MapInfo)
if #mapQueue >= 1 then
if g_MapInfo.name ~= mapQueue[1] then
triggerEvent("onBoughtMap",getRootElement(),mapQueue[1])
removeFromTable(mapQueue,mapQueue[1])
else
removeFromTable(mapQueue,mapQueue[1])
if mapQueue[1] then
triggerEvent("onBoughtMap",getRootElement(),mapQueue[1])
end
end
end
for i,player in pairs(getElementsByType("player")) do
respawnFix[player] = false
end
respawnFix = {}
callClientFunction(getRootElement(),"setMapQueue",mapQueue)
end
addEvent("onMapStarting",true)
addEventHandler("onMapStarting",getRootElement(),resetMapSetStatus)
Alles anzeigen