Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql = exports.mysql
- local birlikCol = createColSphere(1380.8447265625, -1088.904296875, 27.384355545044, 1)
- function birlikKurTrigger(thePlayer, cmd)
- local playerTeam = getElementData(thePlayer, "faction")
- if playerTeam ~= -1 then
- outputChatBox("[!] #FFFFFFZaten bir birliğiniz var!", thePlayer, 255, 0, 0, true)
- return
- end
- if (isElementWithinColShape(thePlayer, birlikCol)) then
- triggerClientEvent(thePlayer,"birlikKurGUI", thePlayer)
- end
- end
- addCommandHandler("birlikkur", birlikKurTrigger)
- function birlikSeviyeTrigger(thePlayer, cmd)
- if isElementWithinColShape(thePlayer, birlikCol) then
- local oyuncu_birlik = getPlayerTeam(thePlayer)
- local oyuncu_birlik_isim = getTeamName(oyuncu_birlik)
- local birlik_seviye = getElementData(oyuncu_birlik, "birlik_level")
- local birlikLider = getElementData(thePlayer, "factionleader")
- if birlik_seviye == 6 then
- outputChatBox("[!] #FFFFFFBirliğiniz son seviyedir!", thePlayer, 255, 0, 0, true)
- return
- end
- if (oyuncu_birlik) and (birlikLider > 0) then
- triggerClientEvent(thePlayer,"birlikSeviyeGUI", thePlayer, oyuncu_birlik_isim, tostring(birlik_seviye))
- else
- outputChatBox("[!] #FFFFFFHerhangi bir birliğin lideri değilsiniz!", thePlayer, 255, 0, 0, true)
- end
- end
- end
- addCommandHandler("birlikseviye", birlikSeviyeTrigger)
- function birlikYardim(thePlayer, cmd)
- if isElementWithinColShape(thePlayer, birlikCol) then
- outputChatBox("------------------------------ [[ Birlik Yardım ]] -------------------------------", thePlayer, 200, 20, 20)
- outputChatBox("-------- [[ Birlik kurmak için /birlikkur", thePlayer, 200, 200, 200)
- outputChatBox("-------- [[ Birlik seviyesini yükseltmek için /birlikseviye", thePlayer, 200, 200, 200)
- outputChatBox("--------------------------------------------------------------------------------------", thePlayer, 200, 20, 20)
- end
- end
- addCommandHandler("birlikyardim", birlikYardim)
- function birlikKur(thePlayer, birlikName, birlikType)
- local para = exports.global:getMoney(thePlayer)
- if string.len(birlikName) < 4 then
- outputChatBox("[!] #FFFFFFBirlik ismi en az 4 karakterden oluşmalıdır!", thePlayer, 255, 0, 0, true)
- return false
- elseif string.len(birlikName) > 36 then
- outputChatBox("[!] #FFFFFFBirlik ismi en fazla 36 karakterden oluşmalıdır!", 255, 0, 0, true)
- return false
- end
- if para >= 10000 then
- factionName = birlikName
- factionType = tonumber(birlikType)
- local getrow = mysql:query("SELECT * FROM factions WHERE name='" .. factionName .. "'")
- local numrows = mysql:num_rows(getrow)
- if numrows > 0 then
- outputChatBox("[!] #FFFFFFMaalesef, birlik ismi kullanımda!", thePlayer, 255, 0, 0, true)
- return false
- end
- local theTeam = createTeam(tostring(factionName))
- if theTeam then
- if mysql:query_free("INSERT INTO factions SET name='" .. mysql:escape_string(factionName) .. "', bankbalance='0', type='" .. mysql:escape_string(factionType) .. "', level='1'") then
- local id = mysql:insert_id()
- exports.pool:allocateElement(theTeam, id)
- mysql:query_free("UPDATE characters SET faction_leader = 1, faction_id = " .. id .. ", faction_rank = 1, faction_phone = NULL, duty = 0 WHERE id = " .. getElementData(thePlayer, "dbid"))
- exports.anticheat:changeProtectedElementDataEx(thePlayer, "faction", id, true)
- exports.anticheat:changeProtectedElementDataEx(theTeam, "type", tonumber(factionType))
- exports.anticheat:changeProtectedElementDataEx(theTeam, "id", tonumber(id))
- exports.anticheat:changeProtectedElementDataEx(theTeam, "birlik_level", 1)
- exports.anticheat:changeProtectedElementDataEx(theTeam, "birlik_onay", 0)
- exports.anticheat:changeProtectedElementDataEx(theTeam, "money", 0)
- setPlayerTeam(thePlayer, theTeam)
- if id > 0 then
- exports.anticheat:changeProtectedElementDataEx(thePlayer, "faction", id, true)
- exports.anticheat:changeProtectedElementDataEx(thePlayer, "factionrank", 1, true)
- exports.anticheat:changeProtectedElementDataEx(thePlayer, "factionphone", nil, true)
- exports.anticheat:changeProtectedElementDataEx(thePlayer, "factionleader", 1, true)
- triggerEvent("duty:offduty", thePlayer)
- triggerEvent("onPlayerJoinFaction", thePlayer, theTeam)
- end
- exports.anticheat:changeProtectedElementDataEx(theTeam, "note", "", false)
- exports.anticheat:changeProtectedElementDataEx(theTeam, "fnote", "", false)
- exports.anticheat:changeProtectedElementDataEx(theTeam, "phone", nil, false)
- exports.anticheat:changeProtectedElementDataEx(theTeam, "max_interiors", 20, false, true) --Don't sync at all / Maxime
- mysql:query_free("UPDATE factions SET rank_1='Dynamic Rank #1', rank_2='Dynamic Rank #2', rank_3='Dynamic Rank #3', rank_4='Dynamic Rank #4', rank_5='Dynamic Rank #5', rank_6='Dynamic Rank #6', rank_7='Dynamic Rank #7', rank_8='Dynamic Rank #8', rank_9='Dynamic Rank #9', rank_10='Dynamic Rank #10', rank_11='Dynamic Rank #11', rank_12='Dynamic Rank #12', rank_13='Dynamic Rank #13', rank_14='Dynamic Rank #14', rank_15='Dynamic Rank #15', rank_16='Dynamic Rank #16', rank_17='Dynamic Rank #17', rank_18='Dynamic Rank #18', rank_19='Dynamic Rank #19', rank_20='Dynamic Rank #20', motd='Birliğe hoş geldiniz.', note = '' WHERE id='" .. id .. "'")
- outputChatBox("[!] #FFFFFF'" .. factionName .. "' isimli birliğiniz başarıyla oluşturuldu! ID #" .. id .. ".", thePlayer, 0, 255, 0, true)
- exports.anticheat:changeProtectedElementDataEx(theTeam, "type", tonumber(factionType))
- exports.anticheat:changeProtectedElementDataEx(theTeam, "id", tonumber(id))
- exports.anticheat:changeProtectedElementDataEx(theTeam, "money", 0)
- local factionRanks = {}
- local factionWages = {}
- for i = 1, 20 do
- factionRanks[i] = "Dynamic Rank #" .. i
- factionWages[i] = 100
- end
- exports.anticheat:changeProtectedElementDataEx(theTeam, "ranks", factionRanks, false)
- exports.anticheat:changeProtectedElementDataEx(theTeam, "wages", factionWages, false)
- exports.anticheat:changeProtectedElementDataEx(theTeam, "motd", "Birliğe hoş geldiniz.", false)
- exports.anticheat:changeProtectedElementDataEx(theTeam, "note", "", false)
- exports.logs:dbLog(thePlayer, 4, theTeam, "MAKE FACTION")
- exports.global:takeMoney(thePlayer, 10000)
- exports.global:sendMessageToAdmins("AdmWarn: " .. getPlayerName(thePlayer) .. " yeni birlik oluşturdu! Birlik Ismi: '" .. factionName .. "' Birlik ID #" .. id)
- else
- destroyElement(theTeam)
- outputChatBox("[!] #FFFFFFBirliğinizi oluştururken bir hata meydana geldi.", thePlayer, 255, 0, 0, true)
- end
- else
- outputChatBox("[!] #FFFFFF'" .. tostring(factionName) .. "' isimli birlik zaten var.", thePlayer, 255, 0, 0, true)
- end
- else
- outputChatBox("[!] #FFFFFFMaalesef, birlik kuracak paranız yok.", thePlayer, 255, 0, 0, true)
- end
- end
- addEvent("birlikKur", true)
- addEventHandler("birlikKur", getRootElement(), birlikKur)
- function birlikSeviye(thePlayer, birlikIsmi, birlikSeviye, birlikFiyat)
- local para = exports.global:getMoney(thePlayer)
- if para >= birlikFiyat then
- if birlikIsmi and birlikSeviye then
- local theTeam = getTeamFromName(birlikIsmi)
- local birlikLevelArttir = exports.anticheat:changeProtectedElementDataEx(theTeam, "birlik_level", birlikSeviye, false)
- local result = mysql:query("UPDATE factions SET level='" .. birlikSeviye .. "' WHERE name='" .. birlikIsmi .. "'")
- if not result then
- outputChatBox("[!] #FFFFFFBirliğinizin seviyesini arttırırken bir hata meydana geldi.", thePlayer, 255, 0, 0, true)
- end
- if result and birlikLevelArttir then
- outputChatBox("[!] #FFFFFFBirliğinizin seviyesi başarıyla arttırılmıştır!", thePlayer, 0, 255, 0, true)
- exports.global:takeMoney(thePlayer, birlikFiyat)
- end
- end
- else
- outputChatBox("[!] #FFFFFFYeterli paranız yok.", thePlayer, 255, 0, 0, true)
- end
- end
- addEvent("birlikSeviye", true)
- addEventHandler("birlikSeviye", getRootElement(), birlikSeviye)
- function aracimiBirligeVer(thePlayer, cmd, vehID)
- if vehID then
- local playerID = getElementData(thePlayer, "dbid")
- local vehElement = exports.pool:getElement("vehicle", vehID)
- local vehOwner = getElementData(vehElement, "owner")
- local vehFaction = getElementData(vehElement, "faction")
- if vehFaction == -1 then
- if vehOwner == playerID then
- local playerBirlik = getElementData(thePlayer, "faction")
- if playerBirlik then
- local elementSet = setElementData(vehElement, "faction", playerBirlik)
- local query = mysql:query("UPDATE vehicles SET faction='" .. playerBirlik .. "' WHERE id='" .. vehID .. "'")
- if elementSet and query then
- exports["item-system"]:deleteAll(3, vehID)
- outputChatBox("[!] #f0f0f0Aracınız başarıyla birliğe verilmiştir!", thePlayer, 0, 255, 0, true)
- end
- else
- outputChatBox("[!] #f0f0f0Bir birlikte değilsiniz.", thePlayer, 255, 0, 0, true)
- end
- else
- outputChatBox("[!] #f0f0f0Araç size ait değil.", thePlayer, 255, 0, 0, true)
- end
- else
- outputChatBox("[!] #f0f0f0Araç zaten bir birliğe ait.", thePlayer, 255, 0, 0, true)
- end
- else
- outputChatBox("[!] #f0f0f0/"..cmd.." [Araç ID]", thePlayer, 255, 0, 0, true)
- end
- end
- addCommandHandler("abv", aracimiBirligeVer)
- addCommandHandler("aracimibirligever", aracimiBirligeVer)
- function aracimiBirlikGeriVer(thePlayer, cmd, vehID)
- if vehID then
- local playerID = getElementData(thePlayer, "dbid")
- local vehElement = exports.pool:getElement("vehicle", vehID)
- local vehOwner = getElementData(vehElement, "owner")
- local vehFaction = getElementData(vehElement, "faction")
- local factionLeader = getElementData(thePlayer, "factionleader")
- local playerBirlik = getElementData(thePlayer, "faction")
- if vehOwner == playerID or vehFaction == playerBirlik and factionLeader == 1 or exports.integration:isPlayerDeveloper(thePlayer) then
- local elementSet = setElementData(vehElement, "faction", -1)
- local query = mysql:query("UPDATE vehicles SET faction='-1' WHERE id='" .. vehID .. "'")
- if elementSet and query then
- outputChatBox("[!] #f0f0f0Aracınız başarıyla sahibine geri verilmiştir!", thePlayer, 0, 255, 0, true)
- end
- else
- outputChatBox("[!] #f0f0f0Aracı sahibi siz olmalısınız.", thePlayer, 255, 0, 0, true)
- end
- else
- outputChatBox("[!] #f0f0f0/"..cmd.." [Araç ID]", thePlayer, 255, 0, 0, true)
- end
- end
- addCommandHandler("abg", aracimiBirlikGeriVer)
- addCommandHandler("aracisahibinever", aracimiBirlikGeriVer)
- function aracBirlikYonetim(thePlayer, cmd, vehID, rankID)
- if not (vehID or rankID) then
- outputChatBox("[!] #f0f0f0/"..cmd.." [Araç ID] [Rank ID]", thePlayer, 255, 0, 0, true)
- else
- local playerID = getElementData(thePlayer, "dbid")
- local vehElement = exports.pool:getElement("vehicle", vehID)
- local vehOwner = getElementData(vehElement, "owner")
- local vehFaction = getElementData(vehElement, "faction")
- local vehFactRank = getElementData(vehElement, "factionrank")
- local factionLeader = getElementData(thePlayer, "factionleader")
- local playerBirlik = getElementData(thePlayer, "faction")
- if playerBirlik then
- if playerBirlik == vehFaction then
- if factionLeader == 1 then
- local elementSet = setElementData(vehElement, "factionrank", rankID)
- local query = mysql:query("UPDATE vehicles SET factionrank='" .. rankID .. "' WHERE id='" .. vehID .. "'")
- if elementSet and query then
- outputChatBox("[!] #f0f0f0Araç başarıyla ayarlanmıştır!", thePlayer, 0, 255, 0, true)
- end
- else
- outputChatBox("[!] #f0f0f0Aracı yönetebilmek için birlik lideri olmalısınız.", thePlayer, 255, 0, 0, true)
- end
- end
- else
- outputChatBox("[!] #f0f0f0Bir birlikte değilsiniz.", thePlayer, 255, 0, 0, true)
- end
- end
- end
- addCommandHandler("aby", aracBirlikYonetim)
- addCommandHandler("aracbirlikyonetim", aracBirlikYonetim)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement