veritaban = dbConnect("sqlite","maps.db") -- sql veri tabanı oluşumu
dbQuery(veritaban, "CREATE TABLE IF NOT EXISTS verifymaps(mapname TEXT, state INT)")
if veritaban then
outputDebugString ('baglanti basarili')
else
outputDebugString ("baglanti basarisiz")
end
function verifyAllMaps(player, command)
if not isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(player)) , aclGetGroup("Admin")) then
outputChatBox("Yetkili değilsin",player,255,0,0,true)
return
end
local resources = getResources()
for i,v in ipairs(resources) do
local name = getResourceName(v, "name")
local type = getResourceInfo(v, "type")
if type == "map" then
local q = dbQuery( veritaban, "INSERT INTO verifymaps ( mapname,state ) VALUES ( ?, ?)", name, 0)
dbFree(q)
end
end
outputChatBox("Tüm haritalar veritabanına eklendi.")
end
addCommandHandler("verifyall", verifyAllMaps)
function giveVerify(player, command)
--yetkili ise
if not isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(player)) , aclGetGroup("Admin")) then
outputChatBox("Yetkili değilsin",player,255,0,0,true)
return
end
local mapname = getResourceName ( exports['mapmanager']:getRunningGamemodeMap ( ) )
local result = dbQuery ( veritaban ,"SELECT * FROM verifymaps WHERE mapname = ?", mapname)
local sutun = dbPoll(result, -1)
if sutun[1]["state"] == 1 then
outputChatBox("Bu harita zaten en iyiler arasında!", player, 255, 100, 100, true)
return
end
dbExec( veritaban, "UPDATE verifymaps SET state = 1 WHERE mapname = ?", mapname)
outputChatBox("[BİLGİ] #ffffffBu harita #ff8717en iyiler #ffffffarasına eklendi by #ffffff"..getPlayerName(player), root, 255, 100, 100, true)
end
addCommandHandler("verify", giveVerify)
addEvent("onMapStarting", true)
addEventHandler("onMapStarting", getRootElement(),
function()
local mapname = getResourceName ( exports['mapmanager']:getRunningGamemodeMap ( ) )
local result = dbQuery ( veritaban ,"SELECT * FROM verifymaps WHERE mapname = ?", mapname)
local sutun = dbPoll(result, -1)
if sutun[1]["state"] == 1 then
outputChatBox("[BİLGİ] #ffffffBu harita #ff8717en iyiler #ffffffarasında.", root, 255, 100, 100, true)
return
end
end)