local Count = getPlayerCount ( )/ 2
local mapName = exports.mapmanager:getRunningGamemodeMap()
local CountCommand = 0
local i = CountCommand + 0+0
addEventHandler("onResourceStart",resourceRoot,
function()
setElementData (root, "JB", true )
end)
addEvent("onRaceStateChanging", true)
addEventHandler("onRaceStateChanging", getRootElement(),
function(newState, oldState)
if(newState == "Running")then
for _,v in ipairs(getElementsByType("player")) do
setElementData ( v, "voteRedo", false )
end
end
end)
addEvent("onRaceStateChanging", true)
addEventHandler("onRaceStateChanging",root,
function(newState, oldState)
for _,v in ipairs(getElementsByType("player")) do
if newState == "LoadingMap" then
setElementData(v ,"mapLo",false)
elseif newState == "Running" then
setElementData(v ,"mapLo",true)
end
end
end)
addCommandHandler("vr",
function(source)
if getElementData ( source, "mapLo" ) == false then return outputChatBox("#629632[VoteRedo]#FFFFFFWait for start map",source,225,225,225,true) end
if i == math.ceil(Count) then return outputChatBox("#629632[VoteRedo]#FFFFFFMap Will Be restarted",source,225,225,225,true) end
if getElementData ( source, "voteRedo" ) == true then return outputChatBox("#629632[VoteRedo]#FFFFFFYou Already Vote",source,225,225,225,true) end
if getElementData ( source, "JB" ) == false then return outputChatBox("#629632[VoteRedo]#FFFFFFU can't",source,225,225,225,true) end
setElementData (source, "voteRedo", true)
i = i+1
outputChatBox("#629632[VoteRedo]#FFFFFF"..getPlayerName(source).."#FFFFFF Has Voted For redo #629632["..i.."/"..math.ceil(Count).."]",root,225,225,225,true)
if i == math.ceil(Count) then
outputChatBox("#629632[VoteRedo]#FFFFFFMap Will Be restarted",root ,5,5,5,true)
end
end)
addEvent("onRaceStateChanging", true)
addEventHandler("onRaceStateChanging", root,
function(newState, oldState)
if i == math.ceil(Count) then
if(newState == "PostFinish")then
exports.mapmanager:changeGamemodeMap(mapName)
if (exports.mapmanager:changeGamemodeMap(mapName)) then
setElementData (root, "JB", false )
outputChatBox("#629632[VoteRedo]#FFFFFFMap Has Been Restarted",root ,5,5,5,true)
i = i - i
end
end
end
end)
addEvent("onRaceStateChanging", true)
addEventHandler("onRaceStateChanging", root,
function(newState, oldState)
if(newState == "PostFinish")then
if getElementData (root, "JB" ) == false then
if (newState == "Running" ) then
removeElementData(root,"JB")
end
end
end
end)
هو الماب مايتكرر مرتين
JB ابي اذا بدا ماب جديد على الالمنت داتا
false or true او ينحذف يصير
الاخطاء في التحققات
ادري مافهمتوا شيء جربوا المود عشان تفهموا ان شاء الله تجربوه في ماب بدون ريسباون عشا ن يشتغل