Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.84 KB | None | 0 0
  1. mysql = exports.mysql
  2.  
  3. local birlikCol = createColSphere(1380.8447265625, -1088.904296875, 27.384355545044, 1)
  4.  
  5. function birlikKurTrigger(thePlayer, cmd)
  6. local playerTeam = getElementData(thePlayer, "faction")
  7.  
  8. if playerTeam ~= -1 then
  9. outputChatBox("[!] #FFFFFFZaten bir birliğiniz var!", thePlayer, 255, 0, 0, true)
  10. return
  11. end
  12.  
  13. if (isElementWithinColShape(thePlayer, birlikCol)) then
  14. triggerClientEvent(thePlayer,"birlikKurGUI", thePlayer)
  15. end
  16. end
  17. addCommandHandler("birlikkur", birlikKurTrigger)
  18.  
  19. function birlikSeviyeTrigger(thePlayer, cmd)
  20. if isElementWithinColShape(thePlayer, birlikCol) then
  21. local oyuncu_birlik = getPlayerTeam(thePlayer)
  22. local oyuncu_birlik_isim = getTeamName(oyuncu_birlik)
  23. local birlik_seviye = getElementData(oyuncu_birlik, "birlik_level")
  24. local birlikLider = getElementData(thePlayer, "factionleader")
  25. if birlik_seviye == 6 then
  26. outputChatBox("[!] #FFFFFFBirliğiniz son seviyedir!", thePlayer, 255, 0, 0, true)
  27. return
  28. end
  29.  
  30. if (oyuncu_birlik) and (birlikLider > 0) then
  31. triggerClientEvent(thePlayer,"birlikSeviyeGUI", thePlayer, oyuncu_birlik_isim, tostring(birlik_seviye))
  32. else
  33. outputChatBox("[!] #FFFFFFHerhangi bir birliğin lideri değilsiniz!", thePlayer, 255, 0, 0, true)
  34. end
  35. end
  36. end
  37. addCommandHandler("birlikseviye", birlikSeviyeTrigger)
  38.  
  39. function birlikYardim(thePlayer, cmd)
  40. if isElementWithinColShape(thePlayer, birlikCol) then
  41. outputChatBox("------------------------------ [[ Birlik Yardım ]] -------------------------------", thePlayer, 200, 20, 20)
  42. outputChatBox("-------- [[ Birlik kurmak için /birlikkur", thePlayer, 200, 200, 200)
  43. outputChatBox("-------- [[ Birlik seviyesini yükseltmek için /birlikseviye", thePlayer, 200, 200, 200)
  44. outputChatBox("--------------------------------------------------------------------------------------", thePlayer, 200, 20, 20)
  45. end
  46. end
  47. addCommandHandler("birlikyardim", birlikYardim)
  48.  
  49. function birlikKur(thePlayer, birlikName, birlikType)
  50. local para = exports.global:getMoney(thePlayer)
  51.  
  52. if string.len(birlikName) < 4 then
  53. outputChatBox("[!] #FFFFFFBirlik ismi en az 4 karakterden oluşmalıdır!", thePlayer, 255, 0, 0, true)
  54. return false
  55. elseif string.len(birlikName) > 36 then
  56. outputChatBox("[!] #FFFFFFBirlik ismi en fazla 36 karakterden oluşmalıdır!", 255, 0, 0, true)
  57. return false
  58. end
  59.  
  60. if para >= 10000 then
  61. factionName = birlikName
  62. factionType = tonumber(birlikType)
  63. local getrow = mysql:query("SELECT * FROM factions WHERE name='" .. factionName .. "'")
  64. local numrows = mysql:num_rows(getrow)
  65. if numrows > 0 then
  66. outputChatBox("[!] #FFFFFFMaalesef, birlik ismi kullanımda!", thePlayer, 255, 0, 0, true)
  67. return false
  68. end
  69.  
  70. local theTeam = createTeam(tostring(factionName))
  71. if theTeam then
  72. if mysql:query_free("INSERT INTO factions SET name='" .. mysql:escape_string(factionName) .. "', bankbalance='0', type='" .. mysql:escape_string(factionType) .. "', level='1'") then
  73. local id = mysql:insert_id()
  74. exports.pool:allocateElement(theTeam, id)
  75.  
  76. 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"))
  77.  
  78. exports.anticheat:changeProtectedElementDataEx(thePlayer, "faction", id, true)
  79. exports.anticheat:changeProtectedElementDataEx(theTeam, "type", tonumber(factionType))
  80. exports.anticheat:changeProtectedElementDataEx(theTeam, "id", tonumber(id))
  81. exports.anticheat:changeProtectedElementDataEx(theTeam, "birlik_level", 1)
  82. exports.anticheat:changeProtectedElementDataEx(theTeam, "birlik_onay", 0)
  83. exports.anticheat:changeProtectedElementDataEx(theTeam, "money", 0)
  84.  
  85. setPlayerTeam(thePlayer, theTeam)
  86. if id > 0 then
  87. exports.anticheat:changeProtectedElementDataEx(thePlayer, "faction", id, true)
  88. exports.anticheat:changeProtectedElementDataEx(thePlayer, "factionrank", 1, true)
  89. exports.anticheat:changeProtectedElementDataEx(thePlayer, "factionphone", nil, true)
  90. exports.anticheat:changeProtectedElementDataEx(thePlayer, "factionleader", 1, true)
  91. triggerEvent("duty:offduty", thePlayer)
  92.  
  93. triggerEvent("onPlayerJoinFaction", thePlayer, theTeam)
  94. end
  95.  
  96. exports.anticheat:changeProtectedElementDataEx(theTeam, "note", "", false)
  97. exports.anticheat:changeProtectedElementDataEx(theTeam, "fnote", "", false)
  98. exports.anticheat:changeProtectedElementDataEx(theTeam, "phone", nil, false)
  99. exports.anticheat:changeProtectedElementDataEx(theTeam, "max_interiors", 20, false, true) --Don't sync at all / Maxime
  100.  
  101. 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 .. "'")
  102. outputChatBox("[!] #FFFFFF'" .. factionName .. "' isimli birliğiniz başarıyla oluşturuldu! ID #" .. id .. ".", thePlayer, 0, 255, 0, true)
  103. exports.anticheat:changeProtectedElementDataEx(theTeam, "type", tonumber(factionType))
  104. exports.anticheat:changeProtectedElementDataEx(theTeam, "id", tonumber(id))
  105. exports.anticheat:changeProtectedElementDataEx(theTeam, "money", 0)
  106.  
  107. local factionRanks = {}
  108. local factionWages = {}
  109. for i = 1, 20 do
  110. factionRanks[i] = "Dynamic Rank #" .. i
  111. factionWages[i] = 100
  112. end
  113. exports.anticheat:changeProtectedElementDataEx(theTeam, "ranks", factionRanks, false)
  114. exports.anticheat:changeProtectedElementDataEx(theTeam, "wages", factionWages, false)
  115. exports.anticheat:changeProtectedElementDataEx(theTeam, "motd", "Birliğe hoş geldiniz.", false)
  116. exports.anticheat:changeProtectedElementDataEx(theTeam, "note", "", false)
  117. exports.logs:dbLog(thePlayer, 4, theTeam, "MAKE FACTION")
  118. exports.global:takeMoney(thePlayer, 10000)
  119. exports.global:sendMessageToAdmins("AdmWarn: " .. getPlayerName(thePlayer) .. " yeni birlik oluşturdu! Birlik Ismi: '" .. factionName .. "' Birlik ID #" .. id)
  120. else
  121. destroyElement(theTeam)
  122. outputChatBox("[!] #FFFFFFBirliğinizi oluştururken bir hata meydana geldi.", thePlayer, 255, 0, 0, true)
  123. end
  124. else
  125. outputChatBox("[!] #FFFFFF'" .. tostring(factionName) .. "' isimli birlik zaten var.", thePlayer, 255, 0, 0, true)
  126. end
  127. else
  128. outputChatBox("[!] #FFFFFFMaalesef, birlik kuracak paranız yok.", thePlayer, 255, 0, 0, true)
  129. end
  130. end
  131. addEvent("birlikKur", true)
  132. addEventHandler("birlikKur", getRootElement(), birlikKur)
  133.  
  134. function birlikSeviye(thePlayer, birlikIsmi, birlikSeviye, birlikFiyat)
  135. local para = exports.global:getMoney(thePlayer)
  136. if para >= birlikFiyat then
  137. if birlikIsmi and birlikSeviye then
  138. local theTeam = getTeamFromName(birlikIsmi)
  139. local birlikLevelArttir = exports.anticheat:changeProtectedElementDataEx(theTeam, "birlik_level", birlikSeviye, false)
  140. local result = mysql:query("UPDATE factions SET level='" .. birlikSeviye .. "' WHERE name='" .. birlikIsmi .. "'")
  141. if not result then
  142. outputChatBox("[!] #FFFFFFBirliğinizin seviyesini arttırırken bir hata meydana geldi.", thePlayer, 255, 0, 0, true)
  143. end
  144.  
  145. if result and birlikLevelArttir then
  146. outputChatBox("[!] #FFFFFFBirliğinizin seviyesi başarıyla arttırılmıştır!", thePlayer, 0, 255, 0, true)
  147. exports.global:takeMoney(thePlayer, birlikFiyat)
  148. end
  149. end
  150. else
  151. outputChatBox("[!] #FFFFFFYeterli paranız yok.", thePlayer, 255, 0, 0, true)
  152. end
  153. end
  154. addEvent("birlikSeviye", true)
  155. addEventHandler("birlikSeviye", getRootElement(), birlikSeviye)
  156.  
  157. function aracimiBirligeVer(thePlayer, cmd, vehID)
  158. if vehID then
  159. local playerID = getElementData(thePlayer, "dbid")
  160. local vehElement = exports.pool:getElement("vehicle", vehID)
  161. local vehOwner = getElementData(vehElement, "owner")
  162. local vehFaction = getElementData(vehElement, "faction")
  163. if vehFaction == -1 then
  164. if vehOwner == playerID then
  165. local playerBirlik = getElementData(thePlayer, "faction")
  166. if playerBirlik then
  167. local elementSet = setElementData(vehElement, "faction", playerBirlik)
  168. local query = mysql:query("UPDATE vehicles SET faction='" .. playerBirlik .. "' WHERE id='" .. vehID .. "'")
  169. if elementSet and query then
  170. exports["item-system"]:deleteAll(3, vehID)
  171. outputChatBox("[!] #f0f0f0Aracınız başarıyla birliğe verilmiştir!", thePlayer, 0, 255, 0, true)
  172. end
  173. else
  174. outputChatBox("[!] #f0f0f0Bir birlikte değilsiniz.", thePlayer, 255, 0, 0, true)
  175. end
  176. else
  177. outputChatBox("[!] #f0f0f0Araç size ait değil.", thePlayer, 255, 0, 0, true)
  178. end
  179. else
  180. outputChatBox("[!] #f0f0f0Araç zaten bir birliğe ait.", thePlayer, 255, 0, 0, true)
  181. end
  182. else
  183. outputChatBox("[!] #f0f0f0/"..cmd.." [Araç ID]", thePlayer, 255, 0, 0, true)
  184. end
  185. end
  186. addCommandHandler("abv", aracimiBirligeVer)
  187. addCommandHandler("aracimibirligever", aracimiBirligeVer)
  188.  
  189. function aracimiBirlikGeriVer(thePlayer, cmd, vehID)
  190. if vehID then
  191. local playerID = getElementData(thePlayer, "dbid")
  192. local vehElement = exports.pool:getElement("vehicle", vehID)
  193. local vehOwner = getElementData(vehElement, "owner")
  194. local vehFaction = getElementData(vehElement, "faction")
  195. local factionLeader = getElementData(thePlayer, "factionleader")
  196. local playerBirlik = getElementData(thePlayer, "faction")
  197. if vehOwner == playerID or vehFaction == playerBirlik and factionLeader == 1 or exports.integration:isPlayerDeveloper(thePlayer) then
  198. local elementSet = setElementData(vehElement, "faction", -1)
  199. local query = mysql:query("UPDATE vehicles SET faction='-1' WHERE id='" .. vehID .. "'")
  200. if elementSet and query then
  201. outputChatBox("[!] #f0f0f0Aracınız başarıyla sahibine geri verilmiştir!", thePlayer, 0, 255, 0, true)
  202. end
  203. else
  204. outputChatBox("[!] #f0f0f0Aracı sahibi siz olmalısınız.", thePlayer, 255, 0, 0, true)
  205. end
  206. else
  207. outputChatBox("[!] #f0f0f0/"..cmd.." [Araç ID]", thePlayer, 255, 0, 0, true)
  208. end
  209. end
  210. addCommandHandler("abg", aracimiBirlikGeriVer)
  211. addCommandHandler("aracisahibinever", aracimiBirlikGeriVer)
  212.  
  213. function aracBirlikYonetim(thePlayer, cmd, vehID, rankID)
  214. if not (vehID or rankID) then
  215. outputChatBox("[!] #f0f0f0/"..cmd.." [Araç ID] [Rank ID]", thePlayer, 255, 0, 0, true)
  216. else
  217. local playerID = getElementData(thePlayer, "dbid")
  218. local vehElement = exports.pool:getElement("vehicle", vehID)
  219. local vehOwner = getElementData(vehElement, "owner")
  220. local vehFaction = getElementData(vehElement, "faction")
  221. local vehFactRank = getElementData(vehElement, "factionrank")
  222. local factionLeader = getElementData(thePlayer, "factionleader")
  223. local playerBirlik = getElementData(thePlayer, "faction")
  224. if playerBirlik then
  225. if playerBirlik == vehFaction then
  226. if factionLeader == 1 then
  227. local elementSet = setElementData(vehElement, "factionrank", rankID)
  228. local query = mysql:query("UPDATE vehicles SET factionrank='" .. rankID .. "' WHERE id='" .. vehID .. "'")
  229. if elementSet and query then
  230. outputChatBox("[!] #f0f0f0Araç başarıyla ayarlanmıştır!", thePlayer, 0, 255, 0, true)
  231. end
  232. else
  233. outputChatBox("[!] #f0f0f0Aracı yönetebilmek için birlik lideri olmalısınız.", thePlayer, 255, 0, 0, true)
  234. end
  235. end
  236. else
  237. outputChatBox("[!] #f0f0f0Bir birlikte değilsiniz.", thePlayer, 255, 0, 0, true)
  238. end
  239. end
  240. end
  241. addCommandHandler("aby", aracBirlikYonetim)
  242. addCommandHandler("aracbirlikyonetim", aracBirlikYonetim)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement