├── .gitignore
├── LICENSE
├── README.md
├── resources
├── [in-game]
│ ├── account
│ │ ├── client.lua
│ │ ├── libs
│ │ │ └── class.lua
│ │ ├── meta.xml
│ │ ├── server.lua
│ │ └── ui
│ │ │ ├── events.lua
│ │ │ └── index.lua
│ ├── admins
│ │ ├── commands.lua
│ │ ├── meta.xml
│ │ └── src
│ │ │ ├── client.lua
│ │ │ └── server.lua
│ ├── cache
│ │ ├── libs
│ │ │ ├── async.lua
│ │ │ └── class.lua
│ │ ├── meta.xml
│ │ └── server.lua
│ ├── chat
│ │ ├── assets
│ │ │ └── pmEffect.mp3
│ │ ├── client.lua
│ │ ├── meta.xml
│ │ └── server.lua
│ ├── cursor
│ │ ├── assets
│ │ │ ├── arrow.png
│ │ │ ├── hand.png
│ │ │ └── text.png
│ │ ├── client.lua
│ │ └── meta.xml
│ ├── dxlibrary
│ │ ├── library.lua
│ │ └── meta.xml
│ ├── essantials
│ │ ├── client.lua
│ │ ├── libs
│ │ │ └── classlib.lua
│ │ ├── meta.xml
│ │ ├── server.lua
│ │ └── ui
│ │ │ └── index.lua
│ ├── factions
│ │ ├── libs
│ │ │ ├── async.lua
│ │ │ └── class.lua
│ │ ├── meta.xml
│ │ ├── server.lua
│ │ ├── shared.lua
│ │ └── ui
│ │ │ ├── dashboard
│ │ │ └── index.lua
│ │ │ ├── finance
│ │ │ └── index.lua
│ │ │ ├── index.lua
│ │ │ ├── inventory
│ │ │ └── index.lua
│ │ │ ├── leave
│ │ │ └── index.lua
│ │ │ ├── members
│ │ │ └── index.lua
│ │ │ └── ranks
│ │ │ └── index.lua
│ ├── fonts
│ │ ├── assets
│ │ │ ├── FontAwesomeRegular.otf
│ │ │ ├── FontAwesomeSolid.otf
│ │ │ ├── Oswald.ttf
│ │ │ ├── Raleway.ttf
│ │ │ ├── Roboto.ttf
│ │ │ └── RobotoB.ttf
│ │ ├── get.lua
│ │ └── meta.xml
│ ├── global
│ │ ├── meta.xml
│ │ ├── s_chat.lua
│ │ ├── s_player.lua
│ │ ├── s_vehicle.lua
│ │ └── shared.lua
│ ├── identity
│ │ ├── libs
│ │ │ └── class.lua
│ │ ├── meta.xml
│ │ └── server.lua
│ ├── items
│ │ ├── assets
│ │ │ ├── audio
│ │ │ │ └── bag.wav
│ │ │ └── images
│ │ │ │ ├── gun.png
│ │ │ │ ├── items
│ │ │ │ ├── 1.png
│ │ │ │ ├── 2.png
│ │ │ │ ├── 3.png
│ │ │ │ ├── 4.png
│ │ │ │ ├── 5.png
│ │ │ │ ├── 6.png
│ │ │ │ ├── 7.png
│ │ │ │ ├── 8.png
│ │ │ │ └── 9.png
│ │ │ │ ├── key.png
│ │ │ │ ├── null.png
│ │ │ │ ├── pack.png
│ │ │ │ └── wallet.png
│ │ ├── items.lua
│ │ ├── libs
│ │ │ └── classlib.lua
│ │ ├── meta.xml
│ │ ├── src
│ │ │ ├── client.lua
│ │ │ └── server.lua
│ │ └── ui
│ │ │ ├── index.lua
│ │ │ └── use.lua
│ ├── living
│ │ ├── libs
│ │ │ └── classlib.lua
│ │ ├── meta.xml
│ │ ├── server.lua
│ │ └── ui
│ │ │ └── index.lua
│ ├── mysql
│ │ ├── connection.lua
│ │ └── meta.xml
│ ├── scoreboard
│ │ ├── index.lua
│ │ ├── libs
│ │ │ └── classlib.lua
│ │ └── meta.xml
│ ├── vehicles
│ │ ├── assets
│ │ │ ├── engine.wav
│ │ │ ├── lock.wav
│ │ │ └── window.wav
│ │ ├── client.lua
│ │ ├── fuel
│ │ │ ├── client.lua
│ │ │ └── server.lua
│ │ ├── libs
│ │ │ └── async.lua
│ │ ├── meta.xml
│ │ ├── server.lua
│ │ └── tax
│ │ │ ├── client.lua
│ │ │ └── server.lua
│ ├── vehicleshop
│ │ ├── client.lua
│ │ ├── libs
│ │ │ └── classlib.lua
│ │ ├── meta.xml
│ │ └── server.lua
│ └── vehicleslibrary
│ │ ├── client.lua
│ │ ├── editveh
│ │ ├── client.lua
│ │ └── server.lua
│ │ ├── handling
│ │ ├── client.lua
│ │ └── server.lua
│ │ ├── meta.xml
│ │ └── server.lua
└── launcher
│ ├── meta.xml
│ └── resources.lua
└── roleplay.sql
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Lua sources
2 | luac.out
3 |
4 | # luarocks build files
5 | *.src.rock
6 | *.zip
7 | *.tar.gz
8 |
9 | # Object files
10 | *.o
11 | *.os
12 | *.ko
13 | *.obj
14 | *.elf
15 |
16 | # Precompiled Headers
17 | *.gch
18 | *.pch
19 |
20 | # Libraries
21 | *.lib
22 | *.a
23 | *.la
24 | *.lo
25 | *.def
26 | *.exp
27 |
28 | # Shared objects (inc. Windows DLLs)
29 | *.dll
30 | *.so
31 | *.so.*
32 | *.dylib
33 |
34 | # Executables
35 | *.exe
36 | *.out
37 | *.app
38 | *.i*86
39 | *.x86_64
40 | *.hex
41 |
42 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 projectQ
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # projectQ
2 | With the contribution of Turkish developers, first detailed mta:sa roleplay gamemode.
3 |
--------------------------------------------------------------------------------
/resources/[in-game]/account/client.lua:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/account/client.lua
--------------------------------------------------------------------------------
/resources/[in-game]/account/libs/class.lua:
--------------------------------------------------------------------------------
1 | function class(name)
2 | local c = {}
3 | c[0] = {}
4 | c.__index = c
5 | c.__type = name
6 | c.databaseLoaded = false
7 |
8 | function c:new(...)
9 | local instance = setmetatable({}, self)
10 | instance:init(...)
11 | return instance
12 | end
13 |
14 | function c:addMethod(name, fn)
15 | self[name] = fn
16 | end
17 |
18 | function c:extend(name)
19 | local subclass = class(name)
20 | setmetatable(subclass, { __index = self })
21 | return subclass
22 | end
23 |
24 | return c
25 | end
--------------------------------------------------------------------------------
/resources/[in-game]/account/meta.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/resources/[in-game]/account/server.lua:
--------------------------------------------------------------------------------
1 | local tonumber = tonumber
2 | local exports = exports
3 | local addEvent = addEvent
4 | local ipairs = ipairs
5 | local pairs = pairs
6 | local addEventHandler = addEventHandler
7 | local triggerClientEvent = triggerClientEvent
8 | local conn = exports.mysql:getConn()
9 | local cache = exports.cache
10 |
11 | addEventHandler('onPlayerChangeNick', root, function(oldNick,newNick)
12 | if not source:getData('name.access') then
13 | cancelEvent()
14 | source.name = tostring(oldNick)
15 | end
16 | end)
17 |
18 | addEventHandler('onPlayerCommand', root, function(command)
19 | if not source:getData('online') then
20 | cancelEvent()
21 | end
22 | end)
23 |
24 | function spawn(dbid)
25 | source:setData("online", true)
26 | local dbid = tonumber(dbid)
27 | source:setData("dbid", dbid)
28 | local x, y, z, int, dim = unpack(split(cache:getCharacterData(dbid, "pos"), ","))
29 | local characterModel = cache:getCharacterData(dbid, "model")
30 | local characterName = cache:getCharacterData(dbid, "name")
31 | local walk = cache:getCharacterData(dbid, "walk")
32 | local hunger = cache:getCharacterData(dbid, "hunger")
33 | local thirst = cache:getCharacterData(dbid, "thirst")
34 | local money = cache:getCharacterData(dbid, "money")
35 | local hp = cache:getCharacterData(dbid, "health")
36 | local arm = cache:getCharacterData(dbid, "armor")
37 | source:setData("money", tonumber(money))
38 | source:setData("hunger", tonumber(hunger))
39 | source:setData("thirst", tonumber(thirst))
40 | source:spawn(x,y,z)
41 | source:setInterior(tonumber(int))
42 | source:setDimension(tonumber(dim))
43 | source.cameraTarget = source
44 | source.gravity = 0.008
45 | source.model = tonumber(characterModel)
46 | source.name = tostring(characterName)
47 | source.walkingStyle = walk
48 | source.health = hp
49 | source.armor = arm
50 | triggerEvent("death.check", source)
51 | triggerEvent("load.items.server", source)
52 | cache:setCharacterData(source, "lastlogin", exports.global:getTimeStamp())
53 | end
54 | addEvent("auth.spawn.character", true)
55 | addEventHandler("auth.spawn.character", root, spawn)
56 |
57 | function createCharacter(name, height, weight, age, gender)
58 | local model
59 | local walk
60 | if tonumber(gender) == 1 then
61 | model = 59
62 | walk = 128
63 | else
64 | model = 93
65 | walk = 131
66 | end
67 | local nextID = exports.mysql:getNewID("characters")
68 | dbExec(conn, "INSERT INTO characters SET id='"..(nextID).."', account='"..(source:getData('account.id')).."', name='"..(name).."', age='"..(tonumber(age)).."', height='"..(tonumber(height)).."', weight='"..(tonumber(weight)).."', gender='"..(tonumber(gender)).."', model='"..(tonumber(model)).."', walk='"..(tonumber(walk)).."', lastlogin='"..exports.global:getTimeStamp().."'")
69 | dbQuery(
70 | function(qh)
71 | local res, rows, err = dbPoll(qh, 0)
72 | if rows > 0 then
73 | for index, row in ipairs(res) do
74 | local dbid = tonumber(row.id)
75 | for column, value in pairs(row) do
76 | cache:setCharacterData(dbid, column, value)
77 | end
78 | end
79 | end
80 | end,
81 | conn, "SELECT * FROM characters WHERE id = ?", nextID)
82 | loginStep(source)
83 | end
84 | addEvent("auth.create.character", true)
85 | addEventHandler("auth.create.character", root, createCharacter)
86 |
87 | function loginStep(player)
88 | dbQuery(
89 | function(qh,player)
90 | local res, rows, err = dbPoll(qh, 0)
91 | local data = {}
92 | if rows > 0 then
93 | for index, row in ipairs(res) do
94 | local dbid = tonumber(row.id)
95 | local x, y, z, int, dim = unpack(split(cache:getCharacterData(dbid, "pos"), ","))
96 | local i = #data + 1
97 | if not data[i] then
98 | data[i] = {}
99 | end
100 | data[i][1] = dbid
101 | data[i][2] = cache:getCharacterData(dbid, "name")
102 | data[i][3] = cache:getCharacterData(dbid, "gender")
103 | data[i][4] = getZoneName(x, y, z)
104 | data[i][5] = cache:getCharacterData(dbid, "active")
105 | end
106 | end
107 | triggerClientEvent(player, "auth.login.step", player, data)
108 | end,
109 | {player}, conn, "SELECT id FROM characters WHERE account = ?", player:getData('account.id'))
110 | end
111 |
112 | function login(username, password)
113 | if username == "kullanıcı adı" then return triggerClientEvent(source, "auth.notify", source, "Lütfen geçerli bir kullanıcı adı girin.") end
114 | if password == "şifre" then return triggerClientEvent(source, "auth.notify", source, "Lütfen geçerli bir şifre girin.") end
115 | dbQuery(
116 | function(qh,player)
117 | local res, rows, err = dbPoll(qh, 0)
118 | if rows > 0 then
119 | for index, row in ipairs(res) do
120 | if row.password == password then
121 | player:setData("account.id", tonumber(row.id))
122 | cache:setAccountData(player, "lastlogin", exports.global:getTimeStamp())
123 | loginStep(player)
124 | else
125 | triggerClientEvent(player, "auth.notify", player, ""..username.." hesabının şifresi yanlış, lütfen şifrenizi kontrol edin.")
126 | end
127 | end
128 | else
129 | triggerClientEvent(player, "auth.notify", player, "böyle bir hesap bulunamadı, ("..username..")")
130 | end
131 | end,
132 | {source}, conn, "SELECT password,name,id FROM accounts WHERE name = ?", username)
133 | end
134 | addEvent("auth.login", true)
135 | addEventHandler("auth.login", root, login)
136 |
137 | function register(username, password, mail)
138 | if username == "kullanıcı adı" then return triggerClientEvent(source, "auth.notify", source, "Lütfen geçerli bir kullanıcı adı belirleyin.") end
139 | if password == "şifre" then return triggerClientEvent(source, "auth.notify", source, "Lütfen geçerli bir şifre belirleyin.") end
140 | if mail == "youremail@icloud.com" then return triggerClientEvent(source, "auth.notify", source, "Lütfen geçerli e posta adresi belirleyin.") end
141 | dbQuery(
142 | function(qh,player)
143 | local res, rows, err = dbPoll(qh, 0)
144 | if rows > 0 then
145 | for index, row in ipairs(res) do
146 | triggerClientEvent(player, "auth.notify", player, "zaten bir hesabınız var, ("..row['name']..")")
147 | end
148 | else
149 | dbQuery(
150 | function(qh,player)
151 | local res, rows, err = dbPoll(qh, 0)
152 | if rows > 0 then
153 | for index, row in ipairs(res) do
154 | triggerClientEvent(player, "auth.notify", player, "bu hesap ismi kullanılıyor, ("..row['name']..")")
155 | end
156 | else
157 | local nextID = exports.mysql:getNewID("accounts")
158 | dbExec(conn, "INSERT INTO accounts SET id='"..(nextID).."', name='"..(username).."', password='"..(password).."', serial='"..(player.serial).."', lastlogin='"..exports.global:getTimeStamp().."'")
159 | dbQuery(
160 | function(qh)
161 | local res, rows, err = dbPoll(qh, 0)
162 | if rows > 0 then
163 | for index, row in ipairs(res) do
164 | local dbid = tonumber(row.id)
165 | for column, value in pairs(row) do
166 | cache:setAccountData(dbid, column, value)
167 | end
168 | end
169 | end
170 | end,
171 | conn, "SELECT * FROM accounts WHERE id = ?", nextID)
172 | triggerClientEvent(player, "auth.notify", player, "başarıyla kayıt oldunuz, ("..username..")")
173 | end
174 | end,
175 | {player}, conn, "SELECT name FROM accounts WHERE name = ?", username)
176 | end
177 | end,
178 | {source}, conn, "SELECT name FROM accounts WHERE serial = ?", source.serial)
179 | end
180 | addEvent("auth.register", true)
181 | addEventHandler("auth.register", root, register)
182 |
183 | function remember()
184 | dbQuery(
185 | function(qh,player)
186 | local res, rows, err = dbPoll(qh, 0)
187 | if rows > 0 then
188 | for index, row in ipairs(res) do
189 | triggerClientEvent(player, "auth.remembered", player, row.name, row.password)
190 | end
191 | end
192 | end,
193 | {source}, conn, "SELECT name,password FROM accounts WHERE serial = ?", source.serial)
194 | end
195 | addEvent("auth.remember.me", true)
196 | addEventHandler("auth.remember.me", root, remember)
197 |
198 | function checkCharacterName(result)
199 | dbQuery(
200 | function(qh,player)
201 | local res, rows, err = dbPoll(qh, 0)
202 | if rows > 0 then
203 | triggerClientEvent(player, "auth.notify", player, "Bu karakter ismi kullanılıyor, başka bir tane deneyin.")
204 | else
205 | local oldName = player.name
206 | local successName = player:setName(result)
207 | if (successName) then
208 | player:setName(oldName)
209 | triggerClientEvent(player, "auth.next.step", player)
210 | else
211 | triggerClientEvent(player, "auth.notify", player, "Seçtiğiniz karakter isminde bir sorun bulundu, başka bir tane deneyin.")
212 | end
213 | end
214 | end,
215 | {source}, conn, "SELECT name FROM characters WHERE name = ?", result)
216 | end
217 | addEvent("auth.check.character.name", true)
218 | addEventHandler("auth.check.character.name", root, checkCharacterName)
--------------------------------------------------------------------------------
/resources/[in-game]/account/ui/events.lua:
--------------------------------------------------------------------------------
1 | setGameType('Roleplay')
--------------------------------------------------------------------------------
/resources/[in-game]/admins/meta.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/resources/[in-game]/admins/src/client.lua:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/admins/src/client.lua
--------------------------------------------------------------------------------
/resources/[in-game]/admins/src/server.lua:
--------------------------------------------------------------------------------
1 | local cache = exports.cache
2 |
3 | function command_function(player, command, ...)
4 | local cmd
5 | for _, v in ipairs(commands) do
6 | if v.command == command then
7 | cmd = v
8 | break
9 | end
10 | end
11 | if not cmd then return end
12 | local username = cache:getAccountData(player:getData("account.id"), "name")
13 | local serial = player.serial
14 | local level = cache:getAccountData(player:getData("account.id"), "admin") or 0
15 |
16 | if cmd.access and level < cmd.access then return end
17 | if cmd.account and cmd.account:match(username) ~= username then return end
18 | if cmd.serial and cmd.serial:match(serial) ~= serial then return end
19 |
20 | cmd.func(player, {...})
21 | end
22 |
23 | function process()
24 | for index, value in ipairs(commands) do
25 | local cmd = split(value.command, ",")
26 | for _, command in ipairs(cmd) do
27 | addCommandHandler(command, command_function, false, false)
28 | end
29 | end
30 | end
31 |
32 | addEventHandler("onResourceStart",resourceRoot,function()
33 | process()
34 | end)
35 |
--------------------------------------------------------------------------------
/resources/[in-game]/cache/libs/class.lua:
--------------------------------------------------------------------------------
1 | conn = exports.mysql:newConnect("cache","suppress=1060,1062")
2 | tables_cache = {} --// Tüm verilerin tutulcağı tablo. tables_cache["accounts"]
3 |
4 | function class(name)
5 | local c = {}
6 | c[0] = {}
7 | c.pool = {}
8 | c.__index = c
9 | c.__type = name
10 | c.databaseLoaded = false
11 |
12 | function c:new(...)
13 | local instance = setmetatable({}, self)
14 | instance:init(...)
15 | return instance
16 | end
17 |
18 | function c:addMethod(name, fn)
19 | self[name] = fn
20 | end
21 |
22 | function c:extend(name)
23 | local subclass = class(name)
24 | setmetatable(subclass, { __index = self })
25 | return subclass
26 | end
27 |
28 | function c:find(target)
29 | if self[target] == nil then
30 | self[target] = target
31 | end
32 | return self[target]
33 | end
34 |
35 | function c:set(target, key, value, noSql)
36 | if (not self.databaseLoaded) then table.insert(self.pool,{target,key,value,noSql}) return false end
37 | if (not target or not key) then return false end
38 |
39 | if not self[target] then
40 | self[target] = {}
41 | if not noSql then dbExec(conn, "INSERT INTO `"..(self.__type).."` (id) VALUES(?)", target) end
42 | end
43 | if (self[0] and self[0][key] == nil) then
44 | self[0][key] = true
45 | if not noSql then dbExec(conn, "ALTER TABLE `"..(self.__type).."` ADD `??` text", key) end
46 | end
47 | if not noSql then dbExec(conn, "UPDATE `"..(self.__type).."` SET `??`=? WHERE id=?", key, value==nil and "NULL" or tostring(value), target) end
48 |
49 | self[target][key] = value
50 | return true
51 | end
52 |
53 | function c:get(target, key)
54 | if (not self.databaseLoaded) then return false end
55 | if (not target or not key) then return nil end
56 | if (self[target] == nil) then return nil end
57 | return tonumber(self[target][key]) or self[target][key]
58 | end
59 |
60 | function c:remove(target, key)
61 | self[target][key] = nil
62 | collectgarbage("collect")
63 | end
64 |
65 | function c:clear(target)
66 | self[target] = nil
67 | collectgarbage("collect")
68 | end
69 |
70 | return c
71 | end
--------------------------------------------------------------------------------
/resources/[in-game]/cache/meta.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/resources/[in-game]/cache/server.lua:
--------------------------------------------------------------------------------
1 | All = class("All")
2 | cached_tables = { --// cache yapılcak mysql table isimleri.
3 | "accounts","characters","vehicles"
4 | }
5 | addEvent("onDatabaseLoaded",true)
6 |
7 | function All:init()
8 | local tonumber = tonumber
9 | local ipairs = ipairs
10 | local pairs = pairs
11 | local dbQuery = dbQuery
12 | local dbPoll = dbPoll
13 |
14 | function loadCache(i)
15 | local v = cached_tables[i]
16 | if not v then print("! CACHE IS FINISHED") return end
17 | tables_cache[v] = All:extend(v)
18 | dbQuery(function(qh,tablename,tableindex)
19 | local res = dbPoll(qh, 0)
20 | Async:foreach(res, function(row)
21 | local dbid = tonumber(row.id)
22 | tables_cache[tablename][dbid] = {}
23 | for column, value in pairs(row) do
24 | if not tables_cache[tablename][0][column] then tables_cache[tablename][0][column] = true end
25 | if value then
26 | tables_cache[tablename][dbid][column]=value
27 | end
28 | end
29 | end, function()
30 | tables_cache[tablename].databaseLoaded = true
31 | triggerEvent("onDatabaseLoaded",root,tablename)
32 | loadCache(tableindex+1)
33 | end)
34 | end,{v,i},conn,"SELECT * FROM "..v)
35 | end
36 | loadCache(1)
37 |
38 | addEventHandler("onDatabaseLoaded",root,function(tablename)
39 | if #tables_cache[tablename].pool > 0 then
40 | for i,v in ipairs(tables_cache[tablename].pool) do tables_cache[tablename]:set(unpack(v)) end
41 | print(tablename.."'s pool set and cleared.")
42 | tables_cache[tablename].pool = {}
43 | end
44 | end)
45 |
46 | --// set, get, remove and clear functions
47 |
48 | function getID(target)
49 | return isElement(target) and target:getData("dbid") or target
50 | end
51 |
52 | --// ACCOUNTS
53 | function getAccountData(target, key)
54 | return tables_cache["accounts"]:get(getID(target), key)
55 | end
56 | function setAccountData(target, key, value, noSql)
57 | return tables_cache["accounts"]:set(getID(target), key, value, noSql)
58 | end
59 | function removeAccountData(target, key)
60 | return tables_cache["accounts"]:remove(getID(target), key)
61 | end
62 | function clearAccountAllData(target)
63 | return tables_cache["accounts"]:clear(getID(target))
64 | end
65 |
66 | --// CHARACTERS
67 | function getCharacterData(target, key)
68 | return tables_cache["characters"]:get(getID(target), key)
69 | end
70 | function setCharacterData(target, key, value, noSql)
71 | return tables_cache["characters"]:set(getID(target), key, value, noSql)
72 | end
73 | function removeCharacterData(target, key)
74 | return tables_cache["characters"]:remove(getID(target), key)
75 | end
76 | function clearCharacterAllData(target)
77 | return tables_cache["characters"]:clear(getID(target))
78 | end
79 |
80 | --// INTERIORS
81 | function getInteriorData(taget, key)
82 | return tables_cache["interiors"]:get(getID(target), key)
83 | end
84 | function setInteriorData(target, key, value, noSql)
85 | return tables_cache["interiors"]:set(getID(target), key, value, noSql)
86 | end
87 | function removeInteriorData(target, key)
88 | return tables_cache["interiors"]:remove(getID(target), key)
89 | end
90 | function clearInteriorAllData(target)
91 | return tables_cache["interiors"]:clear(getID(target))
92 | end
93 |
94 | --// VEHICLES
95 | function getVehicleData(target, key)
96 | return tables_cache["vehicles"]:get(getID(target), key)
97 | end
98 | function setVehicleData(target, key, value, noSql)
99 | return tables_cache["vehicles"]:set(getID(target), key, value, noSql)
100 | end
101 | function removeVehicleData(target, key)
102 | return tables_cache["vehicles"]:remove(getID(target), key)
103 | end
104 | function clearVehicleAllData(target)
105 | return tables_cache["vehicles"]:clear(getID(target))
106 | end
107 |
108 | end
109 |
110 | All:new()
--------------------------------------------------------------------------------
/resources/[in-game]/chat/assets/pmEffect.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/chat/assets/pmEffect.mp3
--------------------------------------------------------------------------------
/resources/[in-game]/chat/client.lua:
--------------------------------------------------------------------------------
1 | localPlayer:setData("message.target", nil)
2 |
3 | bindKey("b", "down", "chatbox", "LocalOOC")
4 | bindKey("u" , "down" , "chatbox", "quickreply")
5 |
6 | addEventHandler("onClientKey", root,
7 | function(button)
8 | if button == "y" then
9 | cancelEvent()
10 | end
11 | end
12 | )
13 |
14 | addEvent("play.effectPM", true)
15 | addEventHandler("play.effectPM", root,
16 | function()
17 | Sound("assets/pmEffect.mp3")
18 | end
19 | )
20 |
21 | addCommandHandler("clearchat",clearChatBox)
--------------------------------------------------------------------------------
/resources/[in-game]/chat/meta.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/resources/[in-game]/chat/server.lua:
--------------------------------------------------------------------------------
1 | local keyWords = {
2 | [":)"] = "gülümser.",
3 | [":D"] = "kahkaha atar.",
4 | [";)"] = "göz kırpar.",
5 | ["O.o"] = "sol kaşını havaya kaldırır.",
6 | ["o.O"] = "sağ kaşını havaya kaldırır.",
7 | }
8 |
9 | addEventHandler("onPlayerChat", root,
10 | function(message, messageType)
11 | if source:getData("online") then
12 | if messageType == 0 then
13 | if keyWords[message] then
14 | exports.global:sendLocalMeAction(source, keyWords[message])
15 | else
16 | exports.global:sendLocalICText(source, message)
17 | end
18 | elseif messageType == 1 then
19 | exports.global:sendLocalMeAction(source, message)
20 | end
21 | end
22 | cancelEvent()
23 | end
24 | )
25 |
26 | addCommandHandler("do",
27 | function(player, command, ...)
28 | if player:getData("online") then
29 | if (...) then
30 | local message = table.concat({...}, " ")
31 | exports.global:sendLocalDoAction(player, message)
32 | end
33 | end
34 | end, false, false
35 | )
36 |
37 | addCommandHandler("me",
38 | function(player, command, ...)
39 | if player:getData("online") then
40 | if (...) then
41 | local message = table.concat({...}, " ")
42 | exports.global:sendLocalMeAction(player, message)
43 | end
44 | end
45 | end, false, false
46 | )
47 |
48 | addCommandHandler("pm",
49 | function(player, command, target, ...)
50 | if player:getData("online") then
51 | if target and (...) then
52 | local targetPlayer = exports.global:findPlayer(target)
53 | if targetPlayer then
54 | local message = table.concat({...}, " ")
55 | triggerClientEvent(targetPlayer, "play.effectPM", targetPlayer)
56 | targetPlayer:setData("message.target", player)
57 | player:outputChat("Giden PM: "..message.." ("..targetPlayer.name:gsub("_", " ")..")", 206, 172, 61)
58 | targetPlayer:outputChat("Gelen PM: "..message.." ("..player.name:gsub("_", " ")..")", 206, 172, 61)
59 | else
60 | player:outputChat("[!] Oyuncu giriş yapmamış veya yanlış ID tuşladınız.", 206, 172, 61)
61 | end
62 | else
63 | player:outputChat("Kullanım: /"..(command).." [ID] [İleti]", 206, 172, 61)
64 | end
65 | end
66 | end, false, false
67 | )
68 |
69 | addCommandHandler("a",
70 | function(player, command, ...)
71 | local level = exports.cache:getAccountData(player:getData("account.id"), "admin") or 0
72 | local username = exports.cache:getAccountData(player:getData("account.id"), "name") or "nil"
73 | if level >= 2 and (...) then
74 | local message = table.concat({...}, " ")
75 | for _, admin in ipairs(Element.getAllByType("player")) do
76 | local level = exports.cache:getAccountData(admin:getData("account.id"), "admin") or 0
77 | if level >= 2 then
78 | admin:outputChat("[Yetkili Sohbet] "..player.name:gsub("_", " ").." ("..username..") : "..message.." ", 225, 85, 85)
79 | end
80 | end
81 | end
82 | end, false, false
83 | )
84 |
85 | addCommandHandler("g",
86 | function(player, command, ...)
87 | local level = exports.cache:getAccountData(player:getData("account.id"), "admin") or 0
88 | local username = exports.cache:getAccountData(player:getData("account.id"), "name") or "nil"
89 | if level >= 1 and (...) then
90 | local message = table.concat({...}, " ")
91 | for _, supporter in ipairs(Element.getAllByType("player")) do
92 | local level = exports.cache:getAccountData(supporter:getData("account.id"), "admin") or 0
93 | if level >= 1 then
94 | supporter:outputChat("[Rehber Sohbet] "..player.name:gsub("_", " ").." ("..username..") : "..message.." ", 125, 225, 125)
95 | end
96 | end
97 | end
98 | end, false, false
99 | )
100 |
101 | function quickReply(player, command, ...)
102 | if player:getData("online") then
103 | if (...) then
104 | local targetPlayer = player:getData("message.target") or nil
105 | if targetPlayer then
106 | local message = table.concat({...}, " ")
107 | triggerClientEvent(targetPlayer, "play.effectPM", targetPlayer)
108 | targetPlayer:setData("message.target", player)
109 | player:outputChat("Giden PM: "..message.." ("..targetPlayer.name:gsub("_", " ")..")", 206, 172, 61)
110 | targetPlayer:outputChat("Gelen PM: "..message.." ("..player.name:gsub("_", " ")..")", 206, 172, 61)
111 | else
112 | player:outputChat("Kimse sana PM atmamış :(", 206, 172, 61)
113 | end
114 | end
115 | end
116 | end
117 | addCommandHandler("qr", quickReply, false, false)
118 | addCommandHandler("quickreply", quickReply)
119 |
120 | function localOOC(player, command, ...)
121 | if player:getData("online") then
122 | local message = table.concat({...}, " ")
123 | exports.global:sendLocalOOCText(player, message)
124 | end
125 | end
126 | addCommandHandler("b", localOOC, false, false)
127 | addCommandHandler("LocalOOC", localOOC)
--------------------------------------------------------------------------------
/resources/[in-game]/cursor/assets/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/cursor/assets/arrow.png
--------------------------------------------------------------------------------
/resources/[in-game]/cursor/assets/hand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/cursor/assets/hand.png
--------------------------------------------------------------------------------
/resources/[in-game]/cursor/assets/text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/cursor/assets/text.png
--------------------------------------------------------------------------------
/resources/[in-game]/cursor/client.lua:
--------------------------------------------------------------------------------
1 | local cursor = "arrow"
2 | local screen = Vector2(guiGetScreenSize())
3 | local active_gui = nil
4 | local gui_cursor_types={
5 | ["gui-edit"]="text",
6 | ["gui-memo"]="text",
7 | ["gui-button"]="hand",
8 | ["gui-checkbox"]="hand",
9 | }
10 |
11 | setCursorAlpha(0)
12 |
13 | function setPointer(pointer)
14 | if pointer then
15 | cursor = pointer
16 | end
17 | end
18 |
19 | bindKey("m", "down", function()
20 | local state = not isCursorShowing()
21 | showCursor(state)
22 | if state then
23 | cursor, active_gui = "arrow", nil
24 | setCursorPosition(screen.x / 2, screen.y / 2)
25 | end
26 | end)
27 |
28 | addEventHandler("onClientMouseEnter",root,function()
29 | local type = getElementType(source)
30 | if gui_cursor_types[type] then
31 | active_gui,cursor=source,gui_cursor_types[type]
32 | end
33 | end)
34 |
35 | addEventHandler("onClientMouseLeave",root,function()
36 | local type = getElementType(source)
37 | if gui_cursor_types[type] then
38 | active_gui,cursor=nil,"arrow"
39 | end
40 | end)
41 |
42 | addEventHandler("onClientRender", root, function()
43 | if (isCursorShowing()) then
44 | local cursorX, cursorY = getCursorPosition()
45 | cursorX, cursorY = cursorX * screen.x, cursorY * screen.y
46 | dxDrawImage(cursorX, cursorY, 32, 32, "assets/"..(cursor or "arrow")..".png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
47 | if cursor ~= "arrow" and not isElement(active_gui) then
48 | cursor = "arrow"
49 | end
50 | end
51 | end, true, "low-9999")
52 |
--------------------------------------------------------------------------------
/resources/[in-game]/cursor/meta.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | true
10 |
--------------------------------------------------------------------------------
/resources/[in-game]/dxlibrary/library.lua:
--------------------------------------------------------------------------------
1 | _functions = [[
2 | screen = Vector2(guiGetScreenSize())
3 | tick = getTickCount()
4 |
5 | function isInBox(x, y, w, h, type)
6 | if isCursorShowing() then
7 | local cx, cy = getCursorPosition()
8 | cx, cy = cx*screen.x, cy*screen.y
9 | if (cx >= x and cx <= x+w and cy >= y and cy <= y+h) then
10 | if type then
11 | exports.cursor:setPointer(type)
12 | end
13 | return true
14 | end
15 | end
16 | return false
17 | end
18 |
19 | function dxDrawShadowedText(text, leftX, topY, rightX, bottomY, color, scale, font, ...)
20 | local black = tocolor(5, 5, 5, 155)
21 | dxDrawText(text, leftX+1, topY, rightX+1, bottomY, black, scale, font, ...)
22 | dxDrawText(text, leftX-1, topY, rightX-1, bottomY, black, scale, font, ...)
23 | dxDrawText(text, leftX, topY+1, rightX, bottomY+1, black, scale, font, ...)
24 | dxDrawText(text, leftX, topY-1, rightX, bottomY-1, black, scale, font, ...)
25 | dxDrawText(text, leftX, topY, rightX, bottomY, color, scale, font, ...)
26 | end
27 |
28 | function dxDrawRoundedRectangle(x, y, width, height, radius, color)
29 | local diameter = radius * 2
30 | dxDrawCircle(x + radius, y + radius, radius, 180, 270, color)
31 | dxDrawCircle(x + width - radius, y + radius, radius, 270, 360, color)
32 | dxDrawCircle(x + radius, y + height - radius, radius, 90, 180, color)
33 | dxDrawCircle(x + width - radius, y + height - radius, radius, 0, 90, color)
34 | dxDrawRectangle(x + radius, y, width - diameter, height, color)
35 | dxDrawRectangle(x, y + radius, radius, height - diameter, color)
36 | dxDrawRectangle(x + width - radius, y + radius, radius, height - diameter, color)
37 | dxDrawRectangle(x + radius, y + radius, width - diameter, height - diameter, tocolor(0, 0, 0, 0))
38 | return isInBox(x, y, width, height)
39 | end
40 |
41 | function dxDrawCustomRoundedRectangle(radius,x,y,w,h,color,postGUI,subPixel,noTL,noTR,noBL,noBR)
42 | local noTL = not noTL and dxDrawCircle(x+radius,y+radius,radius,180,270,color,color,9,1,postGUI) -- top left corner
43 | local noTR = not noTR and dxDrawCircle(x+w-radius,y+radius,radius,270,360,color,color,9,1,postGUI) -- top right corner
44 | local noBL = not noBL and dxDrawCircle(x+radius,y+h-radius,radius,90,180,color,color,9,1,postGUI) -- bottom left corner
45 | local noBR = not noBR and dxDrawCircle(x+w-radius,y+h-radius,radius,0,90,color,color,9,1,postGUI) -- bottom right corner
46 | dxDrawRectangle(x+radius-(not noTL and radius or 0),y,w-2*radius+(not noTL and radius or 0)+(not noTR and radius or 0),radius,color,postGUI,subPixel) -- top rectangle
47 | dxDrawRectangle(x,y+radius,w,h-2*radius,color,postGUI,subPixel) -- center rectangle
48 | dxDrawRectangle(x+radius-(not noBL and radius or 0),y+h-radius,w-2*radius+(not noBL and radius or 0)+(not noBR and radius or 0),radius,color,postGUI,subPixel)-- bottom rectangle
49 | end
50 |
51 | function dxDrawOuterBorder(x, y, w, h, borderSize, borderColor, postGUI)
52 | borderSize = borderSize or 2
53 | borderColor = borderColor or tocolor(0, 0, 0, 255)
54 | dxDrawRectangle(x - borderSize, y - borderSize, w + (borderSize * 2), borderSize, borderColor, postGUI)
55 | dxDrawRectangle(x, y + h, w, borderSize, borderColor, postGUI)
56 | dxDrawRectangle(x - borderSize, y, borderSize, h + borderSize, borderColor, postGUI)
57 | dxDrawRectangle(x + w, y, borderSize, h + borderSize, borderColor, postGUI)
58 | end
59 |
60 | function isClicked()
61 | if getKeyState("mouse1") and tick < getTickCount() then
62 | tick = getTickCount()+500
63 | return true
64 | end
65 | return false
66 | end
67 |
68 | ]]
69 |
70 | --// assert(loadstring(exports.dxlibrary:loadFunctions()))()
71 | function loadFunctions()
72 | return _functions
73 | end
74 |
--------------------------------------------------------------------------------
/resources/[in-game]/dxlibrary/meta.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 |
--------------------------------------------------------------------------------
/resources/[in-game]/essantials/client.lua:
--------------------------------------------------------------------------------
1 | triggerServerEvent("death.check", localPlayer)
2 |
3 | Timer(function()
4 | if localPlayer:getData("injured") == 1 then
5 | triggerServerEvent("death.injured", localPlayer)
6 | end
7 | end, 300000, 0)
8 |
9 | addEvent("death.injure", true)
10 | addEventHandler("death.injure", root, function()
11 | setPedFootBloodEnabled(localPlayer, true)
12 | end)
13 |
14 | addEventHandler("onClientPlayerDamage", localPlayer, function()
15 | if localPlayer:getData("injured") == 0 then
16 | local chance = math.random(1, 4) --// %25 yaralanma şansı
17 | if chance == 1 then
18 | triggerServerEvent("death.damaged", localPlayer)
19 | end
20 | end
21 | end)
22 |
--------------------------------------------------------------------------------
/resources/[in-game]/essantials/libs/classlib.lua:
--------------------------------------------------------------------------------
1 | function class(name)
2 | local c = {}
3 | c.__index = c
4 | c.__type = name
5 |
6 | function c:new(...)
7 | local instance = setmetatable({}, self)
8 | instance:init(...)
9 | return instance
10 | end
11 |
12 | function c:addMethod(name, fn)
13 | self[name] = fn
14 | end
15 |
16 | function c:extend(name)
17 | local subclass = class(name)
18 | setmetatable(subclass, { __index = self })
19 | return subclass
20 | end
21 |
22 | return c
23 | end
24 |
--------------------------------------------------------------------------------
/resources/[in-game]/essantials/meta.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/resources/[in-game]/essantials/server.lua:
--------------------------------------------------------------------------------
1 | local cache = exports.cache
2 |
3 | function respawnPlayer(player)
4 | local dbid = player:getData("dbid")
5 | local state = cache:getCharacterData(dbid, "dead") or 0
6 | if state == 1 then
7 | cache:setCharacterData(dbid, "dead", 0)
8 | cache:setCharacterData(dbid, "injured", 0)
9 | player:setData("injured", 0)
10 | player.frozen = false
11 | player:setAnimation()
12 | triggerClientEvent(player, "death.finish", player)
13 | return true
14 | end
15 | return false
16 | end
17 |
18 | addEvent("death.spawn", true)
19 | addEventHandler("death.spawn", root, function()
20 | respawnPlayer(source)
21 | end)
22 |
23 | addEvent("death.check", true)
24 | addEventHandler("death.check", root, function()
25 | if source:getData("online") then
26 | local dbid = source:getData("dbid")
27 | local dead = cache:getCharacterData(dbid, "dead") or 0
28 | if dead == 1 then
29 | source.health = 0
30 | end
31 | local injured = cache:getCharacterData(dbid, "injured") or 0
32 | source:setData("injured", injured)
33 | if injured == 1 then
34 | triggerClientEvent(source, "death.injure", source)
35 | end
36 | end
37 | end)
38 |
39 | addEvent("death.damaged", true)
40 | addEventHandler("death.damaged", root, function()
41 | local dbid = source:getData("dbid")
42 | cache:setCharacterData(dbid, "injured", 1)
43 | source:setData("injured", 1)
44 | triggerClientEvent(source, "death.injure", source)
45 | end)
46 |
47 | addEvent("death.injured", true)
48 | addEventHandler("death.injured", root, function()
49 | local dbid = source:getData("dbid")
50 | local dead = cache:getCharacterData(dbid, "dead") or 0
51 | if dead == 1 then
52 | return
53 | end
54 | local hp = source.health
55 | source.health = hp - math.random(1, 5)
56 | end)
57 |
58 | addEventHandler("onPlayerWasted", root, function()
59 | local dbid = source:getData("dbid")
60 | local x, y, z = source.position.x, source.position.y, source.position.z
61 | local int, dim = source.interior, source.dimension
62 | local model = source.model
63 | cache:setCharacterData(dbid, "dead", 1)
64 | source:spawn(x, y, z, 0, model, int, dim)
65 | source.frozen = true
66 | source.health = 5
67 | source.armor = 0
68 | source:setAnimation("crack", "crckdeth1", -1, false, false, false)
69 | triggerClientEvent(source, "death.counter", source)
70 | end)
--------------------------------------------------------------------------------
/resources/[in-game]/essantials/ui/index.lua:
--------------------------------------------------------------------------------
1 | local ui = class("UI")
2 |
3 | function ui:init()
4 | self:loadAssets()
5 | self:registerEvents()
6 |
7 | addEventHandler("onClientRender", root, self._renderFunction, true, "low-9999")
8 | end
9 |
10 | function ui:loadAssets()
11 | assert(loadstring(exports.dxlibrary:loadFunctions()))()
12 |
13 | self.fonts = {
14 | awesome = exports.fonts:getFont("AwesomeSolid", 45),
15 | awesome2 = exports.fonts:getFont("AwesomeSolid", 20),
16 | robotoB = exports.fonts:getFont("RobotoB", 10),
17 | roboto = exports.fonts:getFont("Roboto", 11)
18 | }
19 | end
20 |
21 | function ui:registerEvents()
22 | self._renderFunction = function(...)
23 | self:render(...)
24 | end
25 |
26 | self._deathFunction = function(...)
27 | self:death(...)
28 | end
29 |
30 | self._finishFunction = function(...)
31 | self:finish(...)
32 | end
33 |
34 | addEvent("death.counter", true)
35 | addEventHandler("death.counter", root, self._deathFunction)
36 | addEvent("death.finish", true)
37 | addEventHandler("death.finish", root, self._finishFunction)
38 | end
39 |
40 | function ui:render()
41 | if not localPlayer:getData("online") then
42 | return
43 | end
44 |
45 | if self.active then
46 | dxDrawRectangle(0, 0, screen.x, screen.y, tocolor(20, 20, 20))
47 | dxDrawText("", screen.x/2, screen.y/2-100, nil, nil, tocolor(225, 225, 225, self.alpha), 1, self.fonts.awesome)
48 | dxDrawText("Bayıldınız, tekrar ayaklanmak için kalan", screen.x/2-75, screen.y/2-15, nil, nil, tocolor(225, 225, 225, 225), 1, self.fonts.robotoB)
49 | dxDrawText(""..self.counter.." saniye", screen.x/2, screen.y/2+5, nil, nil, tocolor(225, 178, 84, 225), 1, self.fonts.roboto)
50 | else
51 | local injured = localPlayer:getData("injured") or 0
52 | if injured == 1 then
53 | dxDrawText("", screen.x/2-1, screen.y-100, nil, nil, tocolor(0, 0, 0), 1, self.fonts.awesome2)
54 | dxDrawText("", screen.x/2+1, screen.y-100, nil, nil, tocolor(0, 0, 0), 1, self.fonts.awesome2)
55 | dxDrawText("", screen.x/2, screen.y-100-1, nil, nil, tocolor(0, 0, 0), 1, self.fonts.awesome2)
56 | dxDrawText("", screen.x/2, screen.y-100+1, nil, nil, tocolor(0, 0, 0), 1, self.fonts.awesome2)
57 | dxDrawText("", screen.x/2, screen.y-100, nil, nil, tocolor(200, 200, 200, 200), 1, self.fonts.awesome2)
58 | end
59 | end
60 | end
61 |
62 | function ui:death()
63 | if self.active then
64 | return
65 | end
66 | self.active = true
67 | self.counter = 150 --// 150 saniye
68 | self.alpha = 225
69 | showChat(false)
70 | showCursor(true)
71 | self.timer = Timer(function()
72 | if self.counter <= 0 then
73 | triggerServerEvent("death.spawn", localPlayer)
74 | return
75 | end
76 | if self.alpha == 225 then
77 | self.alpha = 75
78 | else
79 | self.alpha = 225
80 | end
81 | self.counter = self.counter - 1
82 | end, 1000, 0)
83 | end
84 |
85 | function ui:finish()
86 | self.active = false
87 | showChat(true)
88 | showCursor(false)
89 | if self.timer.valid then
90 | self.timer:destroy()
91 | end
92 | end
93 |
94 | ui:new()
--------------------------------------------------------------------------------
/resources/[in-game]/factions/libs/class.lua:
--------------------------------------------------------------------------------
1 | function class(name)
2 | local c = {}
3 | c[0] = {}
4 | c.__index = c
5 | c.__type = name
6 | c.pages = {}
7 |
8 | function c:new(...)
9 | local instance = setmetatable({}, self)
10 | instance:init(...)
11 | return instance
12 | end
13 |
14 | function c:addMethod(name, fn)
15 | self[name] = fn
16 | end
17 |
18 | function c:extend(name)
19 | local subclass = class(name)
20 | setmetatable(subclass, { __index = self })
21 | return subclass
22 | end
23 |
24 | return c
25 | end
--------------------------------------------------------------------------------
/resources/[in-game]/factions/meta.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/resources/[in-game]/factions/server.lua:
--------------------------------------------------------------------------------
1 | local conn = exports.mysql:getConn()
2 | local cache = exports.cache
3 | local factions = {}
4 | local factions_rank = {}
5 | local factions_members = {}
6 |
7 | local query_sql = [[
8 | SELECT
9 | f.id as faction_id,
10 | f.name as faction_name,
11 | f.type as faction_type,
12 | f.note as faction_note,
13 | f.balance as faction_balance,
14 | f.level as faction_level,
15 | r.id as rank_id,
16 | r.name as rank_name,
17 | r.permissions as rank_permissions
18 | FROM
19 | factions f
20 | LEFT JOIN factions_rank r ON
21 | f.id = r.faction_id
22 | ]]
23 |
24 | local function processResults(results)
25 | if not results then return end
26 | Async:foreach(results, function(row)
27 | local fact_id = tonumber(row.faction_id)
28 | if not factions[fact_id] then
29 | --// BİRLİK YÜKLEME
30 | factions[fact_id] = {
31 | name = row.faction_name,
32 | type = tonumber(row.faction_type),
33 | balance = tonumber(row.faction_balance),
34 | note = tostring(row.faction_note),
35 | level = tonumber(row.faction_level)
36 | }
37 | factions_rank[fact_id] = {}
38 | end
39 | --// BİRLİĞE RÜTBELERİ YÜKLEME
40 | table.insert(factions_rank[fact_id], {
41 | id = tonumber(row.rank_id),
42 | faction_id = tonumber(fact_id),
43 | name = row.rank_name,
44 | permissions = split(row.rank_permissions or "",",")
45 | })
46 | end)
47 | end
48 |
49 | dbQuery(function(qh)
50 | local results = dbPoll(qh, -1)
51 | processResults(results)
52 | --// BİRLİK ÜYELERİ YÜKLEME
53 | for k, faction in pairs(factions) do
54 | dbQuery(function(qh)
55 | local results = dbPoll(qh, -1)
56 | if results then
57 | factions_members[k] = results
58 | end
59 | end, conn, "SELECT id, name, faction_rank, faction_lead, lastlogin FROM characters WHERE faction = " .. k)
60 | end
61 | print("! LOADED "..#factions.." FACTION")
62 | end, conn, query_sql)
63 |
64 | function sendFactionAnnouncement(faction, message)
65 | if tonumber(faction) then
66 | for _, member in ipairs(Element.getAllByType("player")) do
67 | if cache:getCharacterData(member, "faction") == faction then
68 | member:outputChat("[BİRLİK] "..message.."", 191, 134, 70)
69 | end
70 | end
71 | end
72 | end
73 |
74 | function deleteFaction(fact_id)
75 | if tonumber(fact_id) and factions[fact_id] then
76 | local query = dbExec(conn, "DELETE FROM factions WHERE id = " .. fact_id)
77 | if query then
78 | factions[fact_id] = nil
79 | factions_rank[fact_id] = nil
80 | factions_members[fact_id] = nil
81 | dbExec(conn, "DELETE FROM factions_rank WHERE faction_id = " .. fact_id)
82 | collectgarbage("collect")
83 | end
84 | end
85 | end
86 |
87 | addEvent("factions.quit", true)
88 | addEventHandler("factions.quit", root, function()
89 | local fact_id = tonumber(cache:getCharacterData(source, "faction")) or 0
90 | local dbid = tonumber(source:getData("dbid"))
91 |
92 | sendFactionAnnouncement(fact_id, ""..source.name..", birlikten ayrıldı!")
93 |
94 | cache:setCharacterData(source, "faction", 0)
95 | cache:setCharacterData(source, "faction_rank", 0)
96 | cache:setCharacterData(source, "faction_lead", 0)
97 |
98 | local memberToRemove = nil
99 | for index, member in ipairs(factions_members[fact_id]) do
100 | if member.id == dbid then
101 | memberToRemove = index
102 | break
103 | end
104 | end
105 |
106 | if memberToRemove then
107 | table.remove(factions_members[fact_id], memberToRemove)
108 | end
109 |
110 | if #factions_members[fact_id] <= 0 then
111 | --// üye kalmadıysa birlik siliniyor.
112 | deleteFaction(fact_id)
113 | end
114 | end)
115 |
116 | addEvent("factions.get.server", true)
117 | addEventHandler("factions.get.server", root, function()
118 | local fact_id = tonumber(cache:getCharacterData(source, "faction")) or 0
119 |
120 | local fact_info = {}
121 | local rank_info = {}
122 | local member_info = {}
123 | local vehicle_info = {}
124 | local interior_info = {}
125 |
126 | if fact_id > 0 then
127 | local res = factions[fact_id]
128 |
129 | fact_info = {id = fact_id, name = res.name, note = res.note, type = res.type, balance = res.balance, level = res.level}
130 | rank_info=factions_rank[fact_id]
131 |
132 | for k, v in pairs(factions_members[fact_id]) do
133 | local app = exports.global:findPlayer(v.id)
134 | table.insert(member_info, {id = v.id, rank = v.faction_rank, name = v.name, lead = v.faction_lead, lastlogin = v.lastlogin, online = (app and true or false)})
135 | end
136 |
137 | for _, vehicle in ipairs(Element.getAllByType("vehicle")) do
138 | if cache:getVehicleData(vehicle, "faction") == fact_id then
139 | table.insert(vehicle_info, {id = vehicle:getData("dbid"), plate = vehicle.plateText})
140 | end
141 | end
142 |
143 | triggerClientEvent(source, "factions.load.client", source, fact_info, rank_info, member_info, vehicle_info, interior_info)
144 | end
145 | end)
146 |
147 | addEvent("factions.finance", true)
148 | addEventHandler("factions.finance", root, function(factionID, amount, app)
149 | if tonumber(amount) then
150 | if factions[factionID] then
151 | if app == "withdraw" then
152 | local current = tonumber(factions[factionID].balance)
153 | local new = current - tonumber(amount)
154 | if new < 0 then
155 | source:outputChat("[!]#FFFFFF Birlik kasasında çekmek istediğiniz kadar nakit bulunmuyor!", 55, 55, 200, true)
156 | return
157 | end
158 | factions[factionID].balance = new
159 | exports.global:giveMoney(source, tonumber(amount))
160 | dbExec(conn, "UPDATE factions SET balance='"..(new).."' WHERE id='"..(factionID).."'")
161 | elseif app == "deposit" then
162 | if exports.global:takeMoney(source, tonumber(amount)) then
163 | local current = tonumber(factions[factionID].balance)
164 | local new = current + tonumber(amount)
165 | factions[factionID].balance = new
166 | dbExec(conn, "UPDATE factions SET balance='"..(new).."' WHERE id='"..(factionID).."'")
167 | else
168 | source:outputChat("[!]#FFFFFF Üzerinizde kasya yatırmak için bu kadar nakit bulunmuyor!", 55, 55, 200, true)
169 | end
170 | end
171 | end
172 | end
173 | end)
174 |
175 | local respawnDelay = {}
176 |
177 | addEvent("factions.vehicle", true)
178 | addEventHandler("factions.vehicle", root, function(app, val)
179 | local fact_id = tonumber(cache:getCharacterData(source, "faction")) or 0
180 |
181 | if app == "respawn" then
182 | if respawnDelay[source] then
183 | source:outputChat("[!]#FFFFFF Bu işlemi bu kadar sık gerçekleştiremezsiniz.", 55, 55, 200, true)
184 | return
185 | end
186 |
187 | respawnDelay[source] = Timer(function(player)
188 | respawnDelay[player] = nil
189 | collectgarbage("collect")
190 | end, 30000, 1, source)
191 |
192 | if tonumber(val) then
193 | local vehicle = exports.global:findVehicle(val)
194 | if vehicle and not vehicle.controller then
195 | vehicle:respawn()
196 | source:outputChat("[!]#FFFFFF Aracı respawnladınız.", 55, 55, 200, true)
197 | sendFactionAnnouncement(fact_id, ""..source.name..", #"..val.." ID birlik aracını respawnladı.")
198 | else
199 | source:outputChat("[!]#FFFFFF Birlik aracı şu anda birisi tarafından kullanılıyor.", 55, 55, 200, true)
200 | end
201 | else
202 | for _, vehicle in ipairs(Element.getAllByType("vehicle")) do
203 | if cache:getVehicleData(vehicle, "faction") == fact_id and not vehicle.controller then
204 | vehicle:respawn()
205 | end
206 | end
207 | source:outputChat("[!]#FFFFFF Tüm birlik araçlarını respawnladınız.", 55, 55, 200, true)
208 | sendFactionAnnouncement(fact_id, ""..source.name..", tüm birlik araçlarını respawnladı.")
209 | end
210 | elseif app == "remove" then
211 | local vehicle = exports.global:findVehicle(val)
212 | if vehicle then
213 | if cache:getVehicleData(vehicle, "faction") == fact_id then
214 | cache:setVehicleData(vehicle, "faction", 0)
215 | sendFactionAnnouncement(fact_id, ""..source.name..", #"..val.." ID aracı birlikten çıkardı.")
216 | else
217 | source:outputChat("[!]#FFFFFF Araç zaten bu birliğe ait değil.", 55, 55, 200, true)
218 | end
219 | else
220 | source:outputChat("[!]#FFFFFF Bir sorun oluştu, daha sonra tekrar deneyin.", 55, 55, 200, true)
221 | end
222 | end
223 | end)
224 |
225 |
226 | addEvent("factions.updateRankPermissions", true)
227 | addEventHandler("factions.updateRankPermissions", root, function(rank_id, rank_perms)
228 | local fact_id = tonumber(cache:getCharacterData(client, "faction"))
229 | if fact_id == 0 then return end
230 | local rank_index = false
231 | for i,v in ipairs(factions_rank[fact_id]) do
232 | if v.id == rank_id then
233 | rank_index = i
234 | break
235 | end
236 | end
237 | if not rank_index then client:outputChat("[!]#FFFFFF Seçtiğin rank bulunamadı.", 55, 55, 200, true) return end
238 | local rank = factions_rank[fact_id][rank_index]
239 | factions_rank[fact_id][rank_index].permissions=rank_perms
240 | sendFactionAnnouncement(fact_id, ""..client.name..", "..rank.name.." isimli rankın izinlerini güncelledi.")
241 | client:outputChat("[!]#FFFFFF "..rank.name.." isimli rankın izinlerini güncellediniz.", 55, 55, 200, true)
242 | dbExec(conn, "UPDATE factions_rank SET permissions=? WHERE id=?",table.concat(rank_perms,","),rank.id)
243 | end)
--------------------------------------------------------------------------------
/resources/[in-game]/factions/shared.lua:
--------------------------------------------------------------------------------
1 | permissions = {
2 | {"Üyeleri Yönet","manage_members"},
3 | {"Maaşları Düzenle","manage_payouts"},
4 | {"Birlik Kasası Yönetimi","manage_bank"},
5 | {"Kayıtları Görüntüle","show_logs"},
6 | {"Birlik Envanter Yönetimi","manage_inventory"},
7 | {"Rütbe Yetkilerini Düzenle","manage_ranks"},
8 | {"Birlik Notunu Düzenle","manage_note"},
9 | }
10 |
11 | types = {
12 | [1] = "Devlet Oluşumu",
13 | [2] = "Sivil Oluşum",
14 | [3] = "Kriminal Oluşum",
15 | }
16 |
17 | function getPermName(ID)
18 | return permissions[ID] or "null"
19 | end
20 |
21 | function getTypeName(ID)
22 | return types[ID] or "null"
23 | end
24 |
25 | function hasPermission(perm_table,permission)
26 | for i,v in ipairs(perm_table) do
27 | if v==permission then return true end
28 | end
29 | return false
30 | end
--------------------------------------------------------------------------------
/resources/[in-game]/factions/ui/dashboard/index.lua:
--------------------------------------------------------------------------------
1 | --// BİRLİK PANO SAYFASI
2 | ui.pages[1] = {
3 | open = function(self)
4 | self.infoBox = {
5 | [1] = {"Kasa", "", tocolor(88, 242, 88, 125)},
6 | [2] = {"Üyeler", "", tocolor(88, 101, 242, 125)},
7 | [3] = {"Seviye", "", tocolor(88, 101, 242, 125)},
8 | [4] = {"Oluşum", "", tocolor(213, 101, 66)}
9 | }
10 |
11 | self.dashboardInfo = {
12 | [1] = "$ "..exports.global:formatMoney(self.faction_info.balance).."",
13 | [2] = ""..(#self.members_info or 0).." üye",
14 | [3] = ""..(self.faction_info.level or 1).." seviye",
15 | [4] = ""..types[self.faction_info.type].."",
16 | }
17 | self.faction_notes = {unpack(split(self.faction_info.note, "*>"))}
18 | end,
19 |
20 | close = function(self)
21 | self.infoBox, self.faction_notes, self.dashboardInfo = nil, nil, nil
22 | collectgarbage("collect")
23 | end,
24 |
25 | render = function(self)
26 | --// SAYFA BAŞLIĞI
27 | dxDrawText("Birlik Panosu", self.x+210, self.y+30, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoBBig)
28 | dxDrawText("Birlik hakkında bilgiler ve yöneticilerin notları.", self.x+210, self.y+50, nil, nil, tocolor(175, 175, 175), 1, self.fonts.robotoSmall)
29 |
30 | --// BİLGİ ARKAPLANI
31 | dxDrawCustomRoundedRectangle(12, self.x+200+self.w/2-15, self.y+25, 200, self.h-50, tocolor(65, 67, 74), false, false, true, false, true, false)
32 |
33 | --// NOTLAR KISMI
34 | local note = self.faction_notes[self.sidePage]
35 | local width = dxGetTextWidth("", 1, self.fonts.awesomeSmall)
36 | local height = dxGetFontHeight(1, self.fonts.awesomeSmall)
37 | dxDrawRoundedRectangle(self.x+210, self.y+75, 355, 350, 12, tocolor(15, 15, 15, 75))
38 | dxDrawText(note, self.x+220, self.y+85, 800, 550, tocolor(255, 255, 255), 1, self.fonts.robotoSmall, "left", "top", true, true, false, true)
39 | dxDrawText(self.sidePage, self.x+245, self.y+85+357, nil, nil, tocolor(255, 255, 255, 150), 0.8, self.fonts.awesomeSmall)
40 |
41 | if isInBox(self.x+220, self.y+85+355, width, height, "hand") then
42 | dxDrawText("", self.x+220, self.y+85+355, nil, nil, tocolor(255, 255, 255), 1, self.fonts.awesomeSmall)
43 | if isClicked() then
44 | if self.sidePage > 1 then
45 | self.sidePage = self.sidePage - 1
46 | end
47 | end
48 | else
49 | dxDrawText("", self.x+220, self.y+85+355, nil, nil, tocolor(255, 255, 255, 150), 1, self.fonts.awesomeSmall)
50 | end
51 |
52 | if isInBox(self.x+270, self.y+85+355, width, height, "hand") then
53 | dxDrawText("", self.x+270, self.y+85+355, nil, nil, tocolor(255, 255, 255), 1, self.fonts.awesomeSmall)
54 | if isClicked() then
55 | if self.sidePage < 3 then
56 | self.sidePage = self.sidePage + 1
57 | end
58 | end
59 | else
60 | dxDrawText("", self.x+270, self.y+85+355, nil, nil, tocolor(255, 255, 255, 150), 1, self.fonts.awesomeSmall)
61 | end
62 |
63 | --// BİLGİ KUTUCUKLARI
64 | local dashboardInfo = self.dashboardInfo
65 | local newX1 = self.x+200+self.w/2-7
66 | local newX2 = self.x+200+self.w/2+5
67 | local newY = 0
68 | for i=1, 4 do
69 | dxDrawRoundedRectangle(newX1, self.y+45+newY, 185, 60, 8, tocolor(39, 41, 46))
70 | dxDrawRectangle(newX1, self.y+55+newY, 2, 40, self.infoBox[i][3])
71 | dxDrawText(self.infoBox[i][2], newX2+140, self.y+65+newY, nil, nil, self.infoBox[i][3], 1, self.fonts.awesomeSmall)
72 | dxDrawText(self.infoBox[i][1], newX2, self.y+55+newY, nil, nil, tocolor(255, 255, 255, 245), 1, self.fonts.robotoB)
73 | dxDrawText(dashboardInfo[i], newX2, self.y+75+newY, nil, nil, tocolor(255, 255, 255, 175), 1, self.fonts.robotoSmall)
74 | newY = newY + 65
75 | end
76 | end,
77 | }
--------------------------------------------------------------------------------
/resources/[in-game]/factions/ui/finance/index.lua:
--------------------------------------------------------------------------------
1 | --// FİNANS SAYFASI
2 | ui.pages[3] = {
3 | open = function(self)
4 | self.text, self.alpha = "", 0
5 |
6 | self.financeFunctions = {
7 | write = function(key)
8 | if tonumber(key) and string.len(self.text) <= 15 then
9 | self.text = self.text .. key
10 | end
11 | end,
12 |
13 | textRectangle = function()
14 | self.alpha = self.alpha == 125 and 0 or 125
15 | end,
16 | }
17 |
18 | self.financeOptions = {
19 | {"", "Kasaya Para Yatır"},
20 | {"", "Kasadan Para Çek"},
21 | }
22 | self.timer = Timer(self.financeFunctions.textRectangle, 350, 0)
23 | addEventHandler("onClientCharacter", root, self.financeFunctions.write)
24 | end,
25 |
26 | close = function(self)
27 | self.timer:destroy()
28 | removeEventHandler("onClientCharacter", root, self.financeFunctions.write)
29 | self.alpha, self.text, self.financeFunctions, self.financeOptions = nil, nil, nil, nil
30 | collectgarbage("collect")
31 | end,
32 |
33 | render = function(self)
34 | dxDrawText("Birlik Kasası", self.x+210, self.y+30, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoBBig)
35 | dxDrawText("Mevcut kasa ve para yatırma/çekme işlemleri.", self.x+210, self.y+50, nil, nil, tocolor(175, 175, 175), 1, self.fonts.robotoSmall)
36 |
37 | local case = exports.global:formatMoney(self.faction_info.balance)
38 | local cash = exports.global:formatMoney(localPlayer:getData("money"))
39 | local money = exports.global:formatMoney(self.text) or "0"
40 | local textSize = dxGetTextWidth("$"..money, 1, self.fonts.robotoBBig)
41 |
42 | local newX = 0
43 | for i=1, #self.financeOptions do
44 | local isHovered = isInBox(self.x+220+newX, self.y+85, 150, 35, "hand")
45 | dxDrawText(self.financeOptions[i][1], self.x+230+newX, self.y+90, nil, nil, (isHovered or self.sidePage==i) and tocolor(88, 101, 242, 200) or tocolor(255, 255, 255, 200), 1, self.fonts.awesomeSmall)
46 | dxDrawText(self.financeOptions[i][2], self.x+260+newX, self.y+90, nil, nil, (isHovered or self.sidePage==i) and tocolor(88, 101, 242, 200) or tocolor(255, 255, 255, 200), 1, self.fonts.robotoSmall)
47 | if isHovered and isClicked() and self.sidePage ~= i then
48 | self.sidePage = i
49 | self.text = ""
50 | end
51 | newX = newX + 150
52 | end
53 |
54 | if getKeyState("backspace") and tick+120 <= getTickCount() then
55 | tick = getTickCount()
56 | local fistPart = self.text:sub(0, string.len(self.text)-1)
57 | local lastPart = self.text:sub(string.len(self.text)+1, #self.text)
58 | self.text = fistPart..lastPart
59 | end
60 |
61 | --// SAYFALAR
62 | if self.sidePage == 1 then
63 | dxDrawText("Kasaya Yatırılacak Miktar", self.x+230, self.y+150, nil, nil, tocolor(255, 255, 255, 245), 1, self.fonts.robotoB)
64 |
65 | dxDrawText("$"..money, self.x+230, self.y+175, nil, nil, tocolor(88, 242, 88, 155), 1, self.fonts.robotoBBig)
66 | dxDrawText("l", self.x+230+textSize, self.y+175, nil, nil, tocolor(88, 242, 88, self.alpha), 1, self.fonts.robotoBBig)
67 |
68 | --// İŞLEM
69 | dxDrawText("İşlem", self.x+230, self.y+270, nil, nil, tocolor(255, 255, 255, 245), 1, self.fonts.robotoB)
70 |
71 | dxDrawRoundedRectangle(self.x+215, self.y+300, 275, 60, 8, tocolor(65, 67, 74, 155))
72 | dxDrawRectangle(self.x+215, self.y+310, 2, 40, tocolor(88, 242, 88, 125))
73 | dxDrawText("Birlik Kasası", self.x+230, self.y+305, nil, nil, tocolor(255, 255, 255, 245), 1, self.fonts.robotoB)
74 | dxDrawText("$"..case.." + $"..money, self.x+230, self.y+325, nil, nil, tocolor(255, 255, 255, 175), 1, self.fonts.robotoSmall)
75 | dxDrawText("", self.x+450, self.y+320, nil, nil, tocolor(88, 242, 88, 125), 1, self.fonts.awesomeSmall)
76 |
77 | dxDrawRoundedRectangle(self.x+215+280, self.y+300, 275, 60, 8, tocolor(65, 67, 74, 155))
78 | dxDrawRectangle(self.x+215+280, self.y+310, 2, 40, tocolor(242, 88, 88, 125))
79 | dxDrawText("Cüzdanınız", self.x+230+280, self.y+305, nil, nil, tocolor(255, 255, 255, 245), 1, self.fonts.robotoB)
80 | dxDrawText("$"..cash.." - $"..money, self.x+230+280, self.y+325, nil, nil, tocolor(255, 255, 255, 175), 1, self.fonts.robotoSmall)
81 | dxDrawText("", self.x+450+280, self.y+320, nil, nil, tocolor(242, 88, 88, 125), 1, self.fonts.awesomeSmall)
82 |
83 | if isInBox(self.x+460, self.y+395, 50, 50, "hand") then
84 | dxDrawText("", self.x+475, self.y+400, nil, nil, tocolor(255, 255, 255, 125), 1, self.fonts.awesome)
85 | if isClicked() then
86 | triggerServerEvent("factions.finance", localPlayer, self.faction_info.id, self.text, "deposit")
87 | self:refresh()
88 | end
89 | else
90 | dxDrawText("", self.x+475, self.y+400, nil, nil, tocolor(255, 255, 255, 175), 1, self.fonts.awesome)
91 | end
92 | elseif self.sidePage == 2 then
93 | dxDrawText("Kasadan Çeliecek Miktar", self.x+230, self.y+150, nil, nil, tocolor(255, 255, 255, 245), 1, self.fonts.robotoB)
94 |
95 | dxDrawText("$"..money, self.x+230, self.y+175, nil, nil, tocolor(88, 242, 88, 155), 1, self.fonts.robotoBBig)
96 | dxDrawText("l", self.x+230+textSize, self.y+175, nil, nil, tocolor(88, 242, 88, self.alpha), 1, self.fonts.robotoBBig)
97 |
98 | --// İŞLEM
99 | dxDrawText("İşlem", self.x+230, self.y+270, nil, nil, tocolor(255, 255, 255, 245), 1, self.fonts.robotoB)
100 |
101 | dxDrawRoundedRectangle(self.x+215, self.y+300, 275, 60, 8, tocolor(65, 67, 74, 155))
102 | dxDrawRectangle(self.x+215, self.y+310, 2, 40, tocolor(242, 88, 88, 125))
103 | dxDrawText("Birlik Kasası", self.x+230, self.y+305, nil, nil, tocolor(255, 255, 255, 245), 1, self.fonts.robotoB)
104 | dxDrawText("$"..case.." - $"..money, self.x+230, self.y+325, nil, nil, tocolor(255, 255, 255, 175), 1, self.fonts.robotoSmall)
105 | dxDrawText("", self.x+450, self.y+320, nil, nil, tocolor(242, 88, 88, 125), 1, self.fonts.awesomeSmall)
106 |
107 | dxDrawRoundedRectangle(self.x+215+280, self.y+300, 275, 60, 8, tocolor(65, 67, 74, 155))
108 | dxDrawRectangle(self.x+215+280, self.y+310, 2, 40, tocolor(88, 242, 88, 125))
109 | dxDrawText("Cüzdanınız", self.x+230+280, self.y+305, nil, nil, tocolor(255, 255, 255, 245), 1, self.fonts.robotoB)
110 | dxDrawText("$"..cash.." + $"..money, self.x+230+280, self.y+325, nil, nil, tocolor(255, 255, 255, 175), 1, self.fonts.robotoSmall)
111 | dxDrawText("", self.x+450+280, self.y+320, nil, nil, tocolor(88, 242, 88, 125), 1, self.fonts.awesomeSmall)
112 |
113 | if isInBox(self.x+460, self.y+395, 50, 50, "hand") then
114 | dxDrawText("", self.x+475, self.y+400, nil, nil, tocolor(255, 255, 255, 125), 1, self.fonts.awesome)
115 | if isClicked() then
116 | triggerServerEvent("factions.finance", localPlayer, self.faction_info.id, self.text, "withdraw")
117 | self:refresh()
118 | end
119 | else
120 | dxDrawText("", self.x+475, self.y+400, nil, nil, tocolor(255, 255, 255, 175), 1, self.fonts.awesome)
121 | end
122 | end
123 | end,
124 | }
--------------------------------------------------------------------------------
/resources/[in-game]/factions/ui/index.lua:
--------------------------------------------------------------------------------
1 | ui = class("UI")
2 |
3 | function ui:init()
4 | self._functions = {
5 | load = function(...) self:load(...) end,
6 | start = function(...) self:start(...) end,
7 | menu = function(...) self:menu(...) end,
8 | }
9 |
10 | self:registerEvents()
11 | self:loadAssets()
12 |
13 | bindKey("F3", "down", self._functions.start)
14 | end
15 |
16 | function ui:menu()
17 | --// ARKAPLAN
18 | dxDrawRoundedRectangle(self.x-5, self.y-5, self.w+10, self.h+10, 15, tocolor(0, 0, 0, 45))
19 | dxDrawRoundedRectangle(self.x, self.y, self.w, self.h, 15, tocolor(33, 35, 39))
20 | dxDrawRoundedRectangle(self.x+200-10, self.y+25-10, self.w-220+20, self.h-50+20, 12, tocolor(0, 0, 0, 7))
21 | dxDrawRoundedRectangle(self.x+200, self.y+25, self.w-220, self.h-50, 12, tocolor(39, 41, 46))
22 |
23 | --// YÜKLEME EKRANI
24 | if not self.loaded then
25 | if getTickCount() >= self.finishLoad then
26 | dxDrawText("", self.x+100, self.y+self.h/2-25, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.awesome, "center", "center")
27 | return
28 | end
29 | self.loading = self.loading + 10
30 | dxDrawText("", self.x+100, self.y+self.h/2-25, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.awesome, "center", "center", false, false, false, false, false, self.loading)
31 | return
32 | end
33 |
34 | dxDrawText("", self.x+15, self.y+30, nil, nil, tocolor(255, 255, 255), 1, self.fonts.awesomeSmall)
35 | dxDrawText("Birlik Arayüzü", self.x+45, self.y+30, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoBBig)
36 | dxDrawText(self.faction_info.name, self.x+15, self.y+55, 500, 500, tocolor(125, 125, 125), 1, self.fonts.roboto, "left", "top", false, true)
37 |
38 | dxDrawRectangle(self.x+5, self.y+120, 180, 2, tocolor(255, 255, 255, 125))
39 |
40 | --// SOL TARAF LİSTE
41 | local newY = 0
42 | for i=1, #self.options do
43 | local isHoveredPage = isInBox(self.x+5, self.y+140+newY, 180, 50, "hand")
44 | dxDrawText(self.options[i][1], self.x+20, self.y+150+newY, nil, nil,(isHoveredPage or self.page==i) and tocolor(88, 101, 242, 200) or tocolor(255, 255, 255, 200), 1, self.fonts.awesomeSmall)
45 | dxDrawText(self.options[i][2], self.x+55, self.y+152+newY, nil, nil,(isHoveredPage or self.page==i) and tocolor(88, 101, 242, 200) or tocolor(255, 255, 255, 200), 1, self.fonts.roboto)
46 | if isHoveredPage and isClicked() and self.page ~= i then
47 | self:call(self.page, "close")
48 | self.page = i
49 | self.sidePage = 1
50 | self:call(self.page, "open")
51 | end
52 | newY = newY + 50
53 | end
54 |
55 | self:render()
56 | end
57 |
58 | function ui:render()
59 | self:call(self.page, "render")
60 | end
61 |
62 | function ui:call(page, state)
63 | if self.pages[page] and self.pages[page][state] then
64 | self.pages[page][state](self)
65 | end
66 | end
67 |
68 | function ui:start()
69 | if localPlayer:getData("online") then
70 | if self.display then
71 | self:stop()
72 | else
73 | self.display, self.loaded, self.page = true, false, 1
74 | self.loading, self.finishLoad, self.sidePage = 0, getTickCount()+3000, 1
75 | showCursor(true)
76 | addEventHandler("onClientRender", root, self._functions.menu, true, "low-9999")
77 | triggerServerEvent("factions.get.server", localPlayer)
78 | end
79 | end
80 | end
81 |
82 | function ui:refresh()
83 | self:call(self.page, "close")
84 | self.loaded = false
85 | self.finishLoad = getTickCount()+3000
86 | triggerServerEvent("factions.get.server", localPlayer)
87 | end
88 |
89 | function ui:stop()
90 | self.display = false
91 | self:call(self.page, "close")
92 | showCursor(false)
93 | removeEventHandler("onClientRender", root, self._functions.menu)
94 | end
95 |
96 | function ui:load(faction, ranks, members, vehicles, interiors)
97 | self.faction_info = faction
98 | self.ranks_info = ranks
99 | self.members_info = members
100 | self.vehicles_info = vehicles
101 | self.interiors_info = interiors
102 | self.loaded = true
103 | self:call(self.page, "open")
104 | end
105 |
106 | function ui:loadAssets()
107 | assert(loadstring(exports.dxlibrary:loadFunctions()))()
108 |
109 | self.x, self.y, self.w, self.h = screen.x/2-800/2, screen.y/2-500/2, 800, 500
110 |
111 | self.options = {
112 | [1] = {"", "Birlik Panosu"},
113 | [2] = {"", "Üye Listesi"},
114 | [3] = {"", "Finans"},
115 | [4] = {"", "Rütbeler / Yetkiler"},
116 | [5] = {"", "Birlik Envanteri"},
117 | [6] = {"", "Birlikten Ayrıl"},
118 | }
119 |
120 | self.fonts = {
121 | awesome = exports.fonts:getFont("AwesomeSolid", 25),
122 | awesomeSmall = exports.fonts:getFont("AwesomeSolid", 12),
123 | roboto = exports.fonts:getFont("Roboto", 11),
124 | robotoSmall = exports.fonts:getFont("Roboto", 10),
125 | robotoB = exports.fonts:getFont("RobotoB", 11),
126 | robotoBSmall = exports.fonts:getFont("RobotoB", 9),
127 | robotoBBig = exports.fonts:getFont("RobotoB", 14),
128 | }
129 | end
130 |
131 | function ui:registerEvents()
132 | addEvent("factions.load.client", true)
133 | addEventHandler("factions.load.client", root, self._functions.load)
134 | end
135 |
136 | ui:new()
--------------------------------------------------------------------------------
/resources/[in-game]/factions/ui/inventory/index.lua:
--------------------------------------------------------------------------------
1 | --// ENVANTER SAYFASI
2 | ui.pages[5] = {
3 | open = function(self)
4 | self.selectedTable, self.currentRow, self.maxRow = self.vehicles_info, 0, 10
5 |
6 | self.inventoryOptions = {
7 | {"", "Birlik Taşıtları", self.vehicles_info},
8 | {"", "Birlik Mülkleri", self.interiors_info},
9 | }
10 |
11 | self.inventoryInfoBox = {
12 | [1] = {"Araçlar", "", tocolor(255, 255, 255, 125)},
13 | [2] = {"Mülkler", "", tocolor(196, 86, 86, 125)},
14 | }
15 |
16 | self.inventoryInfo = {
17 | [1] = ""..(#self.vehicles_info or 0).." adet",
18 | [2] = ""..(#self.interiors_info or 0).." adet"
19 | }
20 |
21 | self.inventoryFunctions = {
22 | listUp = function()
23 | if self.currentRow > 0 then
24 | self.currentRow = self.currentRow - 1
25 | end
26 | end,
27 |
28 | listDown = function()
29 | if self.currentRow < #self.selectedTable - self.maxRow then
30 | self.currentRow = self.currentRow + 1
31 | end
32 | end,
33 | }
34 |
35 | bindKey("mouse_wheel_up", "down", self.inventoryFunctions.listUp)
36 | bindKey("mouse_wheel_down", "down", self.inventoryFunctions.listDown)
37 | end,
38 |
39 | close = function(self)
40 | unbindKey("mouse_wheel_up", "down", self.inventoryFunctions.listUp)
41 | unbindKey("mouse_wheel_down", "down", self.inventoryFunctions.listDown)
42 | self.currentRow, self.maxRow, self.inventoryFunctions, self.inventoryOptions, self.inventoryInfoBox, self.inventoryInfo, self.selectedTable = nil, nil, nil, nil, nil, nil, nil
43 | collectgarbage("collect")
44 | end,
45 |
46 | render = function(self)
47 | dxDrawText("Birlik Envanteri", self.x+210, self.y+30, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoBBig)
48 | dxDrawText("Birliğe ait taşırlar ve mülklerin listesi.", self.x+210, self.y+50, nil, nil, tocolor(175, 175, 175), 1, self.fonts.robotoSmall)
49 |
50 | --// BİLGİ KUTUCUKLARI
51 | dxDrawCustomRoundedRectangle(12, self.x+200+self.w/2-15, self.y+25, 200, self.h-50, tocolor(65, 67, 74), false, false, true, false, true, false)
52 | local newX1 = self.x+200+self.w/2-7
53 | local newX2 = self.x+200+self.w/2+5
54 | local newY = 0
55 | for i=1, 2 do
56 | dxDrawRoundedRectangle(newX1, self.y+45+newY, 185, 60, 8, tocolor(39, 41, 46))
57 | dxDrawRectangle(newX1, self.y+55+newY, 2, 40, self.inventoryInfoBox[i][3])
58 | dxDrawText(self.inventoryInfoBox[i][2], newX2+140, self.y+65+newY, nil, nil, self.inventoryInfoBox[i][3], 1, self.fonts.awesomeSmall)
59 | dxDrawText(self.inventoryInfoBox[i][1], newX2, self.y+55+newY, nil, nil, tocolor(255, 255, 255, 245), 1, self.fonts.robotoB)
60 | dxDrawText(self.inventoryInfo[i], newX2, self.y+75+newY, nil, nil, tocolor(255, 255, 255, 175), 1, self.fonts.robotoSmall)
61 | newY = newY + 65
62 | end
63 |
64 | --// TÜM ARAÇLARI RESPAWNLA
65 | dxDrawRoundedRectangle(newX1, self.y+45+newY, 185, 60, 8, tocolor(39, 41, 46))
66 | dxDrawRectangle(newX1, self.y+55+newY, 2, 40, tocolor(88, 101, 242, 125))
67 | dxDrawText("Respawn", newX2, self.y+55+newY, nil, nil, tocolor(255, 255, 255, 245), 1, self.fonts.robotoB)
68 | dxDrawText("Araçları respawn'la", newX2, self.y+75+newY, nil, nil, tocolor(255, 255, 255, 175), 1, self.fonts.robotoSmall)
69 | local isHovered = isInBox(newX2+130, self.y+55+newY, 30, 30, "hand")
70 | dxDrawText("", newX2+140, self.y+65+newY, nil, nil, (isHovered) and tocolor(88, 101, 242, 125) or tocolor(255, 255, 255, 125), 1, self.fonts.awesomeSmall)
71 | if isHovered and isClicked() then
72 | triggerServerEvent("factions.vehicle", localPlayer, "respawn", "all")
73 | end
74 |
75 | --// SEÇENEKLER,
76 | for i, option in ipairs(self.inventoryOptions) do
77 | local isHovered = isInBox(self.x + 220 + (i - 1) * 150, self.y + 85, 150, 35, "hand")
78 | dxDrawText(option[1], self.x + 230 + (i - 1) * 150, self.y + 90, nil, nil, (isHovered or self.sidePage == i) and tocolor(88, 101, 242, 200) or tocolor(255, 255, 255, 200), 1, self.fonts.awesomeSmall)
79 | dxDrawText(option[2], self.x + 260 + (i - 1) * 150, self.y + 90, nil, nil, (isHovered or self.sidePage == i) and tocolor(88, 101, 242, 200) or tocolor(255, 255, 255, 200), 1, self.fonts.robotoSmall)
80 | if isHovered and isClicked() and self.sidePage ~= i then
81 | self.currentRow, self.maxRow = 0, 10
82 | self.selectedTable = option[3]
83 | self.sidePage = i
84 | end
85 | end
86 |
87 | local newY = 0
88 | local listColor = tocolor(65, 67, 74, 170)
89 | local listColor2 = tocolor(47, 49, 55, 170)
90 |
91 | if self.sidePage == 1 then
92 | --// ARAÇLAR
93 | dxDrawText("Araç ID", self.x+225, self.y+140, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoBSmall)
94 | dxDrawText("Plaka", self.x+335, self.y+140, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoBSmall)
95 |
96 | if #self.selectedTable > 0 then
97 | for i = self.currentRow + 1, math.min(self.currentRow + self.maxRow, #self.selectedTable) do
98 | dxDrawRectangle(self.x + 210, self.y + 160 + newY, 350, 30, i % 2 == 0 and listColor2 or listColor)
99 | dxDrawText(self.vehicles_info[i].id, self.x + 225, self.y + 165 + newY, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.robotoSmall)
100 | dxDrawText(self.vehicles_info[i].plate, self.x + 335, self.y + 165 + newY, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.robotoSmall)
101 | local isHovered = isInBox(self.x + 530, self.y + 163 + newY, 25, 25, "hand")
102 | dxDrawText("", self.x + 535, self.y + 167 + newY, nil, nil, (isHovered) and tocolor(88, 101, 242, 200) or tocolor(255, 255, 255, 150), 0.8, self.fonts.awesomeSmall)
103 | if isHovered and isClicked() then
104 | triggerServerEvent("factions.vehicle", localPlayer, "respawn", self.vehicles_info[i].id)
105 | end
106 | local isHovered = isInBox(self.x + 500, self.y + 163 + newY, 25, 25, "hand")
107 | dxDrawText("", self.x + 510, self.y + 167 + newY, nil, nil, (isHovered) and tocolor(188, 75, 75, 200) or tocolor(255, 255, 255, 150), 0.8, self.fonts.awesomeSmall)
108 | if isHovered and isClicked() then
109 | triggerServerEvent("factions.vehicle", localPlayer, "remove", self.vehicles_info[i].id)
110 | self:refresh()
111 | end
112 | newY = newY + 30
113 | end
114 | else
115 | dxDrawRectangle(self.x + 210, self.y + 160 + newY, 350, 30, listColor2)
116 | dxDrawText("Bu birliğe ait hiç taşıt yok.", self.x + 225, self.y + 165 + newY, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.robotoSmall)
117 | end
118 |
119 | elseif self.sidePage == 2 then
120 | --// MÜLKLER
121 | end
122 | end,
123 | }
--------------------------------------------------------------------------------
/resources/[in-game]/factions/ui/leave/index.lua:
--------------------------------------------------------------------------------
1 | --// BİRLİKTEN AYRILMA SAYFASI
2 | ui.pages[6] = {
3 | open = function(self)
4 |
5 | end,
6 |
7 | close = function(self)
8 |
9 | end,
10 |
11 | render = function(self)
12 | dxDrawText("Birlikten Ayrılma", self.x+400, self.y+160, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoBBig)
13 | dxDrawText("Bu birlikte şu an aktif "..(#self.members_info or 0).." üye var, birlik seviyesi "..(self.faction_info.level or 1).." gerçekten ayrılmak istiyormusun?", self.x+250, self.y+185, nil, nil, tocolor(175, 175, 175), 1, self.fonts.robotoSmall)
14 |
15 | dxDrawText("", self.x+465, self.y+125, nil, nil, tocolor(255, 255, 255, 150), 1, self.fonts.awesomeSmall)
16 |
17 | if isInBox(self.x+445, self.y+240, 65, 65, "hand") then
18 | dxDrawText("", self.x+455, self.y+250, nil, nil, tocolor(88, 101, 242, 200), 1, self.fonts.awesome)
19 | if isClicked() then
20 | triggerServerEvent("factions.quit", localPlayer)
21 | self:stop()
22 | end
23 | else
24 | dxDrawText("", self.x+455, self.y+250, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.awesome)
25 | end
26 | end,
27 | }
--------------------------------------------------------------------------------
/resources/[in-game]/factions/ui/members/index.lua:
--------------------------------------------------------------------------------
1 | --// ÜYELER SAYFASI
2 | ui.pages[2] = {
3 | open = function(self)
4 | self.selectedTable, self.currentRow, self.maxRow = self.members_info, 0, 10
5 | self.editing = nil
6 | self.onlineMembers = 0
7 | self.memberFunctions = {
8 | listUp = function()
9 | if self.currentRow > 0 then
10 | self.currentRow = self.currentRow - 1
11 | end
12 | end,
13 |
14 | listDown = function()
15 | if self.currentRow < #self.selectedTable - self.maxRow then
16 | self.currentRow = self.currentRow + 1
17 | end
18 | end,
19 | }
20 |
21 | for k, v in pairs(self.members_info) do
22 | if v.online then
23 | self.onlineMembers = self.onlineMembers + 1
24 | end
25 | end
26 |
27 | bindKey("mouse_wheel_up", "down", self.memberFunctions.listUp)
28 | bindKey("mouse_wheel_down", "down", self.memberFunctions.listDown)
29 | end,
30 |
31 | close = function(self)
32 | unbindKey("mouse_wheel_up", "down", self.memberFunctions.listUp)
33 | unbindKey("mouse_wheel_down", "down", self.memberFunctions.listDown)
34 | self.onlineMembers, self.editing, self.currentRow, self.maxRow, self.memberFunctions, self.selectedTable = nil, nil, nil, nil, nil, nil
35 | collectgarbage("collect")
36 | end,
37 |
38 | render = function(self)
39 | dxDrawCustomRoundedRectangle(12, self.x+200, self.y+25, self.w-220, 75, tocolor(65, 67, 74), false, false, false, false, true, true)
40 | dxDrawRectangle(self.x+200, self.y+25+75, self.w-220, 2, tocolor(255, 255, 255, 125))
41 |
42 | --// SAYFA BAŞLIĞI
43 | dxDrawText("Birlik Üyeleri", self.x+210, self.y+30, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoBBig)
44 | dxDrawText("Birlik üyelerinin listesi, şu anda aktif "..self.onlineMembers.." üye var.", self.x+210, self.y+50, nil, nil, tocolor(175, 175, 175), 1, self.fonts.robotoSmall)
45 |
46 | dxDrawText("Üye", self.x+215, self.y+110, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoB)
47 | dxDrawText("Rütbe", self.x+405, self.y+110, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoB)
48 | dxDrawText("Son Giriş", self.x+555, self.y+110, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoB)
49 |
50 | local newY = 0
51 | local listColor = tocolor(65, 67, 74, 170)
52 | local listColor2 = tocolor(47, 49, 55, 170)
53 |
54 | for i = self.currentRow + 1, math.min(self.currentRow + self.maxRow, #self.members_info) do
55 | local val = self.members_info[i]
56 | if val then
57 | dxDrawRectangle(self.x+210, self.y+140+newY, self.w-240, 30, i%2 == 0 and listColor2 or listColor)
58 | dxDrawText(val.name, self.x+215, self.y+145+newY, self.x+215+180, self.y+215+30+newY, tocolor(255, 255, 255, 200), 1, self.fonts.robotoSmall, nil, nil, true, false)
59 | dxDrawText((self.ranks_info[val.rank].name or "Rütbesiz"), self.x+400, self.y+145+newY, self.x+400+130, self.y+215+30+newY, tocolor(255, 255, 255, 200), 1, self.fonts.robotoSmall, nil, nil, true, false)
60 | dxDrawText(val.lastlogin, self.x+540, self.y+145+newY, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.robotoSmall)
61 |
62 | local isHovered = isInBox(self.x + 722, self.y + 143 + newY, 25, 25, "hand")
63 | dxDrawText("", self.x+730, self.y+147+newY, nil, nil, (isHovered) and tocolor(88, 101, 242, 200) or tocolor(255, 255, 255, 150), 0.8, self.fonts.awesomeSmall)
64 | if isHovered and isClicked() then
65 | self.editing = {i, val.id, val.name, val.rank}
66 | end
67 |
68 | newY = newY + 30
69 | end
70 | end
71 | end,
72 | }
--------------------------------------------------------------------------------
/resources/[in-game]/factions/ui/ranks/index.lua:
--------------------------------------------------------------------------------
1 | --// YETKİLER SAYFASI
2 | ui.pages[4] = {
3 | open = function(self)
4 | self.selectedTable, self.currentRow, self.maxRow, self.selectedRank = self.ranks_info, 0, 9,0
5 | self.currentRowPerms,self.maxRowPerms = 0,7
6 | self.editing,self.cachedRankPerms = nil,{}
7 | self.ranksFunctions = {
8 | listUp = function()
9 | if isInBox(self.x+210,self.y+120,280,#self.selectedTable*30) then
10 | if self.currentRow > 0 then
11 | self.currentRow = self.currentRow - 1
12 | end
13 | elseif isInBox((self.x+210)+290,self.y+150,270,#permissions*30) then
14 | if self.currentRowPerms > 0 then
15 | self.currentRowPerms = self.currentRowPerms - 1
16 | end
17 | end
18 | end,
19 |
20 | listDown = function()
21 | if isInBox(self.x+210,self.y+120,280,#self.selectedTable*30) then
22 | if self.currentRow < #self.selectedTable - self.maxRow then
23 | self.currentRow = self.currentRow + 1
24 | end
25 | elseif isInBox((self.x+210)+290,self.y+150,270,#permissions*30) then
26 | if self.currentRowPerms < #permissions - self.maxRowPerms then
27 | self.currentRowPerms = self.currentRowPerms + 1
28 | end
29 | end
30 | end,
31 | selectRank = function(rank_index)
32 | self.cachedRankPerms = {}
33 | self.selectedRank=rank_index
34 | for i,v in ipairs(self.selectedTable[rank_index].permissions) do
35 | self.cachedRankPerms[v]=true
36 | end
37 | end,
38 | updatePerms = function()
39 | if self.selectedRank == 0 then return end
40 | local perms = {}
41 | for perm,v in pairs(self.cachedRankPerms) do table.insert(perms,perm) end
42 | triggerServerEvent("factions.updateRankPermissions",resourceRoot,tonumber(self.selectedTable[self.selectedRank].id),perms)
43 | end,
44 | }
45 | self.rankButtons = {
46 | {"Ekle","+",tocolor(88, 242, 88, 125)},
47 | {"Değiştir","",tocolor(88, 101, 242, 125)},
48 | {"Kaldır","",tocolor(255, 0, 0, 125)},
49 | }
50 |
51 | bindKey("mouse_wheel_up", "down", self.ranksFunctions.listUp)
52 | bindKey("mouse_wheel_down", "down", self.ranksFunctions.listDown)
53 | end,
54 |
55 | close = function(self)
56 | unbindKey("mouse_wheel_up", "down", self.ranksFunctions.listUp)
57 | unbindKey("mouse_wheel_down", "down", self.ranksFunctions.listDown)
58 | self.editing, self.currentRow, self.maxRow, self.ranksFunctions, self.selectedTable, self.selectedRank = nil, nil, nil, nil, nil, nil
59 | collectgarbage("collect")
60 | end,
61 |
62 | render = function(self)
63 | dxDrawCustomRoundedRectangle(12, self.x+200, self.y+25, self.w-220, 75, tocolor(65, 67, 74), false, false, false, false, true, true)
64 | dxDrawRectangle(self.x+200, self.y+25+75, self.w-220, 2, tocolor(255, 255, 255, 125))
65 |
66 | --// SAYFA BAŞLIĞI
67 | dxDrawText("Birlik Yetkileri", self.x+210, self.y+30, nil, nil, tocolor(255, 255, 255), 1, self.fonts.robotoBBig)
68 | dxDrawText("Birlik yetkilerinin düzenleme", self.x+210, self.y+50, nil, nil, tocolor(175, 175, 175), 1, self.fonts.robotoSmall)
69 |
70 | local newY,newY2 = 0,0
71 | local listColor = tocolor(65, 67, 74, 170)
72 | local listColor2 = tocolor(47, 49, 55, 170)
73 | local listColor3 = tocolor(30, 30, 30, 255)
74 | --// YETKİLER
75 | for i = self.currentRow + 1, math.min(self.currentRow + self.maxRow, #self.selectedTable) do
76 | local val = self.selectedTable[i]
77 | if val then
78 | local isHovered = isInBox(self.x+210, self.y+120+newY, 280, 30, "hand")
79 | dxDrawRectangle(self.x+210, self.y+120+newY, 280, 30, (isHovered or self.selectedRank==i) and (listColor3) or (i%2 == 0 and listColor2 or listColor))
80 | dxDrawText(val.name, self.x+215, self.y+125+newY, (self.x+210)+280, (self.y+125+newY)+30, tocolor(255, 255, 255, 200), 1, self.fonts.robotoSmall, nil, nil, true, false)
81 | if isHovered and isClicked() then
82 | self.ranksFunctions.selectRank(i)
83 | end
84 |
85 | newY = newY + 30
86 | end
87 | end
88 | --// YETKİ İZİNLERİ
89 | for i = self.currentRowPerms + 1, math.min(self.currentRowPerms + self.maxRowPerms, #permissions) do
90 | local val = permissions[i]
91 | if val then
92 | local isHovered = self.selectedRank > 0 and isInBox((self.x+210)+290, self.y+150+newY2, 270, 30, "hand") or false
93 | dxDrawRectangle((self.x+210)+290, self.y+150+newY2, 270, 30, (isHovered) and (listColor3) or (i%2 == 0 and listColor2 or listColor))
94 | dxDrawText(val[1], ((self.x+210)+290)+30, self.y+155+newY2, (((self.x+210)+290)+30)+270, (self.y+155+newY2)+30, tocolor(255, 255, 255, 200), 1, self.fonts.robotoSmall, nil, nil, true, false)
95 | local rank = self.selectedTable[self.selectedRank]
96 | if rank then
97 | local has_perm = self.cachedRankPerms[val[2]]
98 | dxDrawText(has_perm and "" or "", ((self.x+210)+290)+5, self.y+155+newY2, (((self.x+210)+290)+5)+270, (self.y+155+newY2)+30, tocolor(255, 255, 255, 200), 1, self.fonts.awesomeSmall, nil, nil, true, false)
99 | if isHovered and isClicked() then
100 | self.cachedRankPerms[val[2]]= not has_perm or nil
101 | iprint(self.cachedRankPerms)
102 | end
103 | end
104 | newY2 = newY2 + 30
105 | end
106 | end
107 | if self.selectedRank == 0 then
108 | dxDrawRectangle((self.x+210)+290,self.y+150,270,newY2,tocolor(0,0,0,200))
109 | end
110 | --// BUTONLAR
111 | dxDrawRoundedRectangle((self.x+210)+290+10, (self.y+150)+newY2+5, 250, 30, 8, tocolor(65, 67, 74))
112 | dxDrawText("İzinleri Uygula", (self.x+210)+290+15, (self.y+150)+newY2+5, ((self.x+210)+290+10)+250, ((self.y+150)+newY2+5)+30, tocolor(255, 255, 255, 200), 1, self.fonts.robotoB, "left", "center", true, false)
113 | local isHovered = isInBox((self.x+210)+290+230, (self.y+150)+newY2+5, 20, 20, "hand")
114 | dxDrawText("", (self.x+210)+290+15, (self.y+150)+newY2+5, ((self.x+210)+290)+250, ((self.y+150)+newY2+5)+30, (isHovered) and tocolor(88, 101, 242, 125) or tocolor(255, 255, 255, 200), 1, self.fonts.awesomeSmall, "right", "center", false, false)
115 | if self.selectedRank > 0 and isHovered and isClicked() then
116 | self.ranksFunctions.updatePerms()
117 | end
118 | for i=1,#self.rankButtons do
119 | local val = self.rankButtons[i]
120 | local newX = self.x+210+ ((i-1)*95)
121 | dxDrawRoundedRectangle(newX, (self.y+125)+newY, 90, 30, 8, tocolor(65, 67, 74))
122 | dxDrawRectangle(newX, (self.y+125)+newY+5, 2, 20, val[3])
123 | dxDrawText(val[1], newX+5, (self.y+125)+newY, (newX)+90, (self.y+125+newY)+30, tocolor(255, 255, 255, 200), 1, self.fonts.robotoB, "left", "center", true, false)
124 | local isHovered = isInBox(newX+67, (self.y+125)+newY, 20, 20, "hand")
125 | dxDrawText(val[2], newX+67, (self.y+125)+newY, nil, (self.y+125+newY)+30, (isHovered) and tocolor(88, 101, 242, 125) or tocolor(255, 255, 255, 200), 1, self.fonts.awesomeSmall, nil, "center", false, false)
126 | end
127 | end,
128 | }
--------------------------------------------------------------------------------
/resources/[in-game]/fonts/assets/FontAwesomeRegular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/fonts/assets/FontAwesomeRegular.otf
--------------------------------------------------------------------------------
/resources/[in-game]/fonts/assets/FontAwesomeSolid.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/fonts/assets/FontAwesomeSolid.otf
--------------------------------------------------------------------------------
/resources/[in-game]/fonts/assets/Oswald.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/fonts/assets/Oswald.ttf
--------------------------------------------------------------------------------
/resources/[in-game]/fonts/assets/Raleway.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/fonts/assets/Raleway.ttf
--------------------------------------------------------------------------------
/resources/[in-game]/fonts/assets/Roboto.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/fonts/assets/Roboto.ttf
--------------------------------------------------------------------------------
/resources/[in-game]/fonts/assets/RobotoB.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/fonts/assets/RobotoB.ttf
--------------------------------------------------------------------------------
/resources/[in-game]/fonts/get.lua:
--------------------------------------------------------------------------------
1 | fonts = {}
2 | fonts.__index = fonts
3 |
4 | function fonts:new()
5 | local obj = {}
6 | setmetatable(obj, fonts)
7 |
8 | obj.cache = {}
9 |
10 | obj.list = {
11 | ['RobotoB'] = 'assets/RobotoB.ttf',
12 | ['Roboto'] = 'assets/Roboto.ttf',
13 | ['Raleway'] = 'assets/Raleway.ttf',
14 | ['Oswald'] = 'assets/Oswald.ttf',
15 | ['AwesomeSolid'] = 'assets/FontAwesomeSolid.otf',
16 | ['AwesomeRegular'] = 'assets/FontAwesomeRegular.otf'
17 | }
18 |
19 | --// https://fontawesome.com/search?m=free&o=r
20 | obj.icons = {
21 | ['user'] = '',
22 | ['key'] = '',
23 | ['person-circle-plus'] = '',
24 | ['arrow-right'] = '',
25 | ['moon'] = '',
26 | ['mail'] = '@',
27 | ['sun'] = '',
28 | ['light'] = '',
29 | ['back'] = '',
30 | ['login'] = '',
31 | ['location'] = '',
32 | ['github'] = '',
33 | ['palette'] = '',
34 | ['load'] = '',
35 | ['fork'] = '',
36 | ['volume-off'] = '',
37 | ['hand-holding-heart'] = '',
38 | ['skull'] = '',
39 | ['volume-on'] = '',
40 | ['heart'] = '',
41 | ['plus'] = '+',
42 | ['up-down'] = '',
43 | ['eye'] = '',
44 | ['eye-slash'] = '',
45 | ['person'] = '',
46 | ['person-dress'] = ''
47 | }
48 |
49 | return obj
50 | end
51 |
52 | function fonts:getFont(name, size)
53 | local size = size or 9
54 | local name = name or 'Roboto'
55 | local path = self.list[name]
56 |
57 | -- eğer cache'de belirtlilen isim ve size'da font varsa, tekrar oluşturma.
58 | if self.cache[name..' '..size] then return self.cache[name..' '..size] end
59 |
60 | if path then
61 | self.cache[name..' '..size] = DxFont(path, size)
62 | end
63 |
64 | return self.cache[name..' '..size]
65 | end
66 |
67 | function fonts:getIcon(name)
68 | return self.icons[name]
69 | end
70 |
71 | local myFonts = fonts:new()
72 |
73 | function getFont(name, size)
74 | return myFonts:getFont(name, size)
75 | end
76 |
77 | function getIcon(name)
78 | return myFonts:getIcon(name)
79 | end
--------------------------------------------------------------------------------
/resources/[in-game]/fonts/meta.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | true
15 | 10
16 |
--------------------------------------------------------------------------------
/resources/[in-game]/global/meta.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/resources/[in-game]/global/s_chat.lua:
--------------------------------------------------------------------------------
1 | local function getDistanceColor(player, target, type)
2 | local x, y, z = player.position.x, player.position.y, player.position.z
3 | local vx, vy, vz = target.position.x, target.position.y, target.position.z
4 | local distance = getDistanceBetweenPoints3D(x, y, z, vx, vy, vz)
5 | if type == 0 then
6 | if distance > 10 and distance <= 20 then
7 | return 175, 175, 175
8 | end
9 | return 255, 255, 255
10 | elseif type == 1 then
11 | if distance > 10 and distance <= 20 then
12 | return 121, 55, 171
13 | end
14 | return 158, 82, 223
15 | elseif type == 2 then
16 | if distance > 10 and distance <= 20 then
17 | return 86, 175, 112
18 | end
19 | return 89, 215, 140
20 | end
21 | end
22 |
23 | function sendLocalICText(source, message)
24 | local x, y, z = source.position.x, source.position.y, source.position.z
25 | local vehicle = source.vehicle
26 | for _, player in ipairs(Element.getWithinRange(x, y, z, 20, "player")) do
27 | if player:getData("online") then
28 | local r, g, b = getDistanceColor(source, player, 0)
29 | if vehicle then
30 | local windowState = vehicle:getData("window") or 0 --// 0 KAPALI, 1 AÇIK
31 | if windowState == 0 then
32 | local targetVehicle = player.vehicle
33 | if vehicle == targetVehicle then
34 | player:outputChat(""..source.name:gsub("_", " ").." diyor ki (Araç İçi): "..message.."", 175, 175, 175)
35 | end
36 | else
37 | player:outputChat(""..source.name:gsub("_", " ").." diyor ki: "..message.."", r, g, b)
38 | end
39 | else
40 | player:outputChat(""..source.name:gsub("_", " ").." diyor ki: "..message.."", r, g, b)
41 | end
42 | end
43 | end
44 | end
45 |
46 | function sendLocalOOCText(source, message)
47 | local x, y, z = source.position.x, source.position.y, source.position.z
48 | local adminDuty = source:getData("adminduty") or 0
49 | local supporterDuty = source:getData("gmduty") or 0
50 | for _, player in ipairs(Element.getWithinRange(x, y, z, 20, "player")) do
51 | if player:getData("online") then
52 | if adminDuty > 0 then
53 | player:outputChat("[OOC] #AF3737"..source.name:gsub("_", " ")..": #C4FFFF"..message.."", 196, 255, 255, true)
54 | elseif supporterDuty > 0 then
55 | player:outputChat("[OOC] #37AF37"..source.name:gsub("_", " ")..": #C4FFFF"..message.."", 196, 255, 255, true)
56 | else
57 | player:outputChat("[OOC] "..source.name:gsub("_", " ")..": "..message.."", 196, 255, 255, true)
58 | end
59 | end
60 | end
61 | end
62 |
63 | function sendLocalMeAction(source, message)
64 | local x, y, z = source.position.x, source.position.y, source.position.z
65 | local vehicle = source.vehicle
66 | for _, player in ipairs(Element.getWithinRange(x, y, z, 20, "player")) do
67 | if player:getData("online") then
68 | local r, g, b = getDistanceColor(source, player, 1)
69 | if vehicle then
70 | local windowState = vehicle:getData("window") or 0 --// 0 KAPALI, 1 AÇIK
71 | if windowState == 0 then
72 | local targetVehicle = player.vehicle
73 | if vehicle == targetVehicle then
74 | player:outputChat("* "..source.name:gsub("_", " ").." (Araç İçi) "..message.."", 121, 55, 171)
75 | end
76 | else
77 | player:outputChat("* "..source.name:gsub("_", " ").." "..message.."", r, g, b)
78 | end
79 | else
80 | player:outputChat("* "..source.name:gsub("_", " ").." "..message.."", r, g, b)
81 | end
82 | end
83 | end
84 | end
85 |
86 | function sendLocalDoAction(source, message)
87 | local x, y, z = source.position.x, source.position.y, source.position.z
88 | local vehicle = source.vehicle
89 | for _, player in ipairs(Element.getWithinRange(x, y, z, 20, "player")) do
90 | if player:getData("online") then
91 | local r, g, b = getDistanceColor(source, player, 2)
92 | if vehicle then
93 | local windowState = vehicle:getData("window") or 0 --// 0 KAPALI, 1 AÇIK
94 | if windowState == 0 then
95 | local targetVehicle = player.vehicle
96 | if vehicle == targetVehicle then
97 | player:outputChat(""..message.." (Araç İçi) ("..source.name:gsub("_", " ")..")", 86, 175, 112)
98 | end
99 | else
100 | player:outputChat(""..message.." ("..source.name:gsub("_", " ")..")", r, g, b)
101 | end
102 | else
103 | player:outputChat(""..message.." ("..source.name:gsub("_", " ")..")", r, g, b)
104 | end
105 | end
106 | end
107 | end
108 |
109 | function sendMessageToAdmins(message)
110 | for _, admin in ipairs(Element.getAllByType("player")) do
111 | local level = exports.cache:getAccountData(admin:getData("account.id"), "admin") or 0
112 | local duty = admin:getData("adminduty") or 0
113 | if level >= 2 and duty > 0 then
114 | admin:outputChat("[ADM] "..message.."", 175, 55, 55, true)
115 | end
116 | end
117 | end
118 |
119 | function sendMessageToSupporters(message)
120 | for _, supporter in ipairs(Element.getAllByType("player")) do
121 | local level = exports.cache:getAccountData(supporter:getData("account.id"), "admin") or 0
122 | local duty = supporter:getData("gmduty") or 0
123 | if level >= 1 and duty > 0 then
124 | supporter:outputChat("[SUP] "..message.."", 55, 175, 55, true)
125 | end
126 | end
127 | end
--------------------------------------------------------------------------------
/resources/[in-game]/global/s_player.lua:
--------------------------------------------------------------------------------
1 | function findPlayer(arg)
2 | if tonumber(arg) then
3 | local player = Element.getByID("player"..arg)
4 | if player then
5 | return player, player.name
6 | else
7 | return false
8 | end
9 | else
10 | local player = Player(arg)
11 | if player then
12 | return player, player.name
13 | else
14 | return false
15 | end
16 | end
17 | return false
18 | end
19 |
20 | function takeMoney(player, amount)
21 | if tonumber(amount) then
22 | local current = tonumber(player:getData("money"))
23 | local new = current - amount
24 | if new < 0 then
25 | return false
26 | end
27 | player:setData("money", new)
28 | exports.cache:setCharacterData(player, "money", new)
29 | return true
30 | else
31 | print("! takeMoney: amount is not a number")
32 | end
33 | end
34 |
35 | function giveMoney(player, amount)
36 | if tonumber(amount) then
37 | local current = tonumber(player:getData("money"))
38 | local new = current + amount
39 | player:setData("money", new)
40 | exports.cache:setCharacterData(player, "money", new)
41 | else
42 | print("! giveMoney: amount is not a number")
43 | end
44 | end
--------------------------------------------------------------------------------
/resources/[in-game]/global/s_vehicle.lua:
--------------------------------------------------------------------------------
1 | function createRandomPlateText()
2 | local characters = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}
3 | local plate = ""
4 |
5 | for i = 1, 3 do
6 | plate = plate..characters[math.random(1, #characters)]
7 | end
8 |
9 | plate = plate.."-"
10 |
11 | for i = 1, 3 do
12 | plate = plate..math.random(1, 9)
13 | end
14 |
15 | return plate
16 | end
17 |
18 | function findVehicle(arg)
19 | if tonumber(arg) then
20 | local vehicle = Element.getByID("vehicle"..arg)
21 | if vehicle then
22 | return vehicle
23 | else
24 | return false
25 | end
26 | end
27 | return false
28 | end
--------------------------------------------------------------------------------
/resources/[in-game]/global/shared.lua:
--------------------------------------------------------------------------------
1 | function formatMoney(amount)
2 | if tonumber(amount) then
3 | local left,num,right = string.match(tostring(amount),'^([^%d]*%d)(%d*)(.-)$')
4 | return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
5 | end
6 | return "0"
7 | end
8 |
9 | function getTimeStamp()
10 | return os.date('%Y-%m-%d %H:%M:%S')
11 | end
--------------------------------------------------------------------------------
/resources/[in-game]/identity/libs/class.lua:
--------------------------------------------------------------------------------
1 | function class(name)
2 | local c = {}
3 | c[0] = {}
4 | c.__index = c
5 | c.__type = name
6 | c.databaseLoaded = false
7 |
8 | function c:new(...)
9 | local instance = setmetatable({}, self)
10 | instance:init(...)
11 | return instance
12 | end
13 |
14 | function c:addMethod(name, fn)
15 | self[name] = fn
16 | end
17 |
18 | function c:extend(name)
19 | local subclass = class(name)
20 | setmetatable(subclass, { __index = self })
21 | return subclass
22 | end
23 |
24 | return c
25 | end
--------------------------------------------------------------------------------
/resources/[in-game]/identity/meta.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | true
6 |
--------------------------------------------------------------------------------
/resources/[in-game]/identity/server.lua:
--------------------------------------------------------------------------------
1 | local identity = class("IDENTITY")
2 |
3 | function identity:init()
4 | self.identitys = {}
5 | self.maxPlayers = getMaxPlayers()
6 |
7 | addEventHandler("onPlayerJoin", root, function(player) self:onJoin(player) end)
8 | addEventHandler("onPlayerQuit", root, function(player) self:onQuit(player) end)
9 | end
10 |
11 | function identity:onJoin()
12 | local identity
13 |
14 | for i = 1, self.maxPlayers do
15 | if not self.identitys[i] then
16 | identity = i
17 | break
18 | end
19 | end
20 |
21 | if identity then
22 | self.identitys[identity] = source
23 | source:setID("player" .. identity)
24 | source:setData("playerid", identity)
25 | end
26 | end
27 |
28 | function identity:onQuit()
29 | local identity = tonumber(source:getData("playerid"))
30 | self.identitys[identity] = nil
31 | collectgarbage("collect")
32 | end
33 |
34 | identity:new()
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/audio/bag.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/audio/bag.wav
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/gun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/gun.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/items/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/items/1.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/items/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/items/2.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/items/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/items/3.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/items/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/items/4.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/items/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/items/5.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/items/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/items/6.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/items/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/items/7.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/items/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/items/8.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/items/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/items/9.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/key.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/null.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/null.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/pack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/pack.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/assets/images/wallet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/items/assets/images/wallet.png
--------------------------------------------------------------------------------
/resources/[in-game]/items/items.lua:
--------------------------------------------------------------------------------
1 | list = {
2 | --[[
3 | [eşyaID] = {
4 | isim (yazı),
5 | kategori (sayı) ((1 CÜZDAN), (2 ÇANTA), (3 ANAHTAR), (4 SİLAH)),
6 | ağırlık (sayı),
7 | bağlama (true/false) (true ise karakter bu eşyayı transfer edemez.),
8 | stack (true/false) (true ise, aynı id ve value' ile item verildiği zaman stack olur.)
9 | tip (yazı) (itemi kullanırken item tipine göre olaylar yapmak için.),
10 | }
11 | ]]
12 | [1] = {'Ev Anahtarı', 3, 0.1, false, false, 'KEY'},
13 | [2] = {'Araç Anahtarı', 3, 0.1, false, false, 'KEY'},
14 | [5] = {'Kızartma', 2, 0.1, false, true, 'FOOD'},
15 | [6] = {'Hamburger', 2, 0.1, false, true, 'FOOD'},
16 | [7] = {'Sosisli', 2, 0.1, false, true, 'FOOD'},
17 | [8] = {'Su', 2, 0.1, false, true, 'DRINK'},
18 | [9] = {'Kola', 2, 0.1, false, true, 'DRINK'},
19 | }
20 |
21 | function getItemName(itemID)
22 | if tonumber(itemID) then
23 | return list[itemID][1] or 'null'
24 | end
25 | end
26 |
27 | function getItemCategory(itemID)
28 | if tonumber(itemID) then
29 | return list[itemID][2] or 0
30 | end
31 | end
32 |
33 | function getItemType(itemID)
34 | if tonumber(itemID) then
35 | return list[itemID][6] or itemID
36 | end
37 | end
38 |
39 | function isStackableItem(itemID)
40 | if tonumber(itemID) then
41 | return list[itemID][5]
42 | end
43 | end
44 |
45 | function getItemDefaultValue(itemID)
46 | if not tonumber(itemID) then return false end
47 | local info = list[itemID]
48 | if not info then return false end
49 | local tip = info[6]
50 | -- yiyecek ve içecek kategorilerinde value default olarak 100.
51 | if tip == "FOOD" or tip == "DRINK" then
52 | return 100
53 | end
54 | return 0
55 | end
--------------------------------------------------------------------------------
/resources/[in-game]/items/libs/classlib.lua:
--------------------------------------------------------------------------------
1 | function class(name)
2 | local c = {}
3 | c.__index = c
4 | c.__type = name
5 |
6 | function c:new(...)
7 | local instance = setmetatable({}, self)
8 | instance:init(...)
9 | return instance
10 | end
11 |
12 | function c:addMethod(name, fn)
13 | self[name] = fn
14 | end
15 |
16 | function c:extend(name)
17 | local subclass = class(name)
18 | setmetatable(subclass, { __index = self })
19 | return subclass
20 | end
21 |
22 | return c
23 | end
24 |
--------------------------------------------------------------------------------
/resources/[in-game]/items/meta.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/resources/[in-game]/items/src/client.lua:
--------------------------------------------------------------------------------
1 | items = {}
2 |
3 | addEvent('load.items.client',true)
4 | addEventHandler('load.items.client',root,function(results)
5 | local results = results or {}
6 | items = results
7 | iprint("load.items.client",items)
8 | end)
9 |
10 | function getItems()
11 | return items
12 | end
13 |
14 | function hasItem(item,value)
15 | if tonumber(item) then
16 | local value = value or 0
17 | for i, v in pairs(items) do
18 | if v[1] == item and v[2] == value then
19 | return i, v[1], v[2], v[3]
20 | end
21 | end
22 | return false
23 | end
24 | end
25 |
26 | function getItemValue(item,value)
27 | local value = value or 0
28 | local _, _, itemValue, _ = hasItem(item,value)
29 | return itemValue or 0
30 | end
31 |
32 | function getItemCount(item,value)
33 | local value = value or 0
34 | local _, _, _, itemCount = hasItem(item,value)
35 | return itemCount or 0
36 | end
37 |
38 | triggerServerEvent('load.items.server',localPlayer)
--------------------------------------------------------------------------------
/resources/[in-game]/items/src/server.lua:
--------------------------------------------------------------------------------
1 |
2 | local triggerClientEvent = triggerClientEvent
3 | local pairs = pairs
4 | local exports = exports
5 | local tonumber = tonumber
6 | local addEvent = addEvent
7 | local addEventHandler = addEventHandler
8 | local mysql = exports.mysql
9 | local items = {}
10 |
11 | local getlastID = function()
12 | return mysql:getNewID("items")
13 | end
14 |
15 | local refresh = function(player)
16 | triggerClientEvent(player,'load.items.client',player,items[player])
17 | end
18 |
19 | function loadItems(player)
20 | if player then
21 | if player:getData('online') then
22 | if not items[player] then
23 | items[player] = {}
24 | end
25 | dbQuery(
26 | function(qh,player)
27 | local res, rows, err = dbPoll(qh, 0)
28 | if rows > 0 then
29 | for index, row in ipairs(res) do
30 | items[player][row.id] = {tonumber(row.item),tonumber(row.value),tonumber(row.count)}
31 | end
32 | end
33 | refresh(player)
34 | end,
35 | {player}, mysql:getConn(), "SELECT * FROM items WHERE owner=? AND type=?", getID(player), getType(player))
36 | end
37 | end
38 | end
39 |
40 | function clearItems(player)
41 | items[player] = nil
42 | end
43 |
44 | function hasItem(player,item,value)
45 | if player and tonumber(item) then
46 | local value = value or 0
47 | for i, v in pairs(items[player] or {}) do
48 | if v[1] == item and v[2] == value then
49 | return i, v[1], v[2], v[3]
50 | end
51 | end
52 | return false
53 | end
54 | end
55 |
56 | function getItems(player)
57 | return items[player] or {}
58 | end
59 |
60 | function giveItem(player,item,value,count)
61 | if not list[item] then return false end
62 | local count = count or 1
63 | local value = value or getItemDefaultValue(item)
64 | local itemIndex,itemID,itemValue, itemCount = hasItem(player,item,value)
65 | -- aynı id ve value' olan bir item envanterinde varsa ve o item stack yapılıyor ise, count arttır.
66 | if itemIndex and isStackableItem(item) then
67 | local newCount = itemCount + count
68 | items[player][itemIndex] = {itemID,itemValue,tonumber(newCount)}
69 | dbExec(mysql:getConn(), "UPDATE items SET count='"..(newCount).."', value='"..(value).."' WHERE id=?", itemIndex)
70 | else -- eğer item yoksa veya item varsa ama stack yapılmıyosa yeni item oalrak ver
71 | local id = getlastID()
72 | items[player][id] = {tonumber(item),tonumber(value) or value,tonumber(count)}
73 | dbExec(mysql:getConn(), "INSERT INTO items SET id='"..(id).."', type='"..getType(player).."', owner='"..getID(player).."', item='"..(tonumber(item)).."', value='"..(value).."', count='"..(tonumber(count)).."'")
74 | end
75 | refresh(player)
76 | return true
77 | end
78 |
79 | function takeItem(player,item,value,count)
80 | local count = count or 1
81 | local value = value or 0
82 | local itemIndex,itemID,itemValue, itemCount = hasItem(player,item,value)
83 | if itemIndex then
84 | return takeItemFromIndex(player,itemIndex,count)
85 | else
86 | return false
87 | end
88 | end
89 |
90 | function takeItemFromIndex(player,itemIndex,count)
91 | if not items[player] then return false end
92 | if not items[player][itemIndex] then return false end
93 | local itemCount = items[player][itemIndex][3]
94 | local newCount = itemCount - count
95 | if newCount < 0 then
96 | return false
97 | end
98 | if newCount == 0 then
99 | items[player][itemIndex] = nil
100 | dbExec(mysql:getConn(), "DELETE FROM items WHERE id=?",itemIndex)
101 | collectgarbage('collect')
102 | else
103 | items[player][itemIndex][3]=tonumber(newCount)
104 | dbExec(mysql:getConn(), "UPDATE items SET count='"..(newCount).."' WHERE id=?", itemIndex)
105 | end
106 | refresh(player)
107 | return true
108 |
109 | end
110 |
111 | function setItemValue(player,itemIndex,value)
112 | if not items[player] then return false end
113 | if not items[player][itemIndex] then return false end
114 | local info = items[player][itemIndex]
115 | local value = value or 0
116 | if itemIndex then
117 | items[player][itemIndex][2] = tonumber(value) or value
118 | dbExec(mysql:getConn(), "UPDATE items SET value='"..(value).."' WHERE id=?", itemIndex)
119 | refresh(player)
120 | return true
121 | else
122 | return false
123 | end
124 | end
125 |
126 | function setItemCount(player,item,value,count)
127 | local count = tonumber(count) or 1
128 | local itemIndex,itemID,itemValue,itemCount = hasItem(player,item,value)
129 | if itemIndex then
130 | items[player][itemIndex][3] = count
131 | dbExec(mysql:getConn(), "UPDATE items SET count='"..(value).."' WHERE id=?", itemIndex)
132 | refresh(player)
133 | return true
134 | else
135 | return false
136 | end
137 | end
138 |
139 | function getItemValue(player,item,value)
140 | local value = value or 0
141 | local _, _, itemValue, _ = hasItem(player,item,value)
142 | return itemValue or 0
143 | end
144 |
145 | function getItemCount(player,item,value)
146 | local value = value or 0
147 | local _, _, _, itemCount = hasItem(player,item,value)
148 | return itemCount or 0
149 | end
150 |
151 | function getID(element)
152 | local element_type = element:getType()
153 | if element_type == "player" or element_type == "vehicle" then
154 | return element:getData("dbid")
155 | end
156 | return 0
157 | end
158 |
159 | function getType(element)
160 | local element_type = element:getType()
161 | if element_type == "player" then
162 | return 1
163 | elseif element_type == "vehicle" then
164 | return 2
165 | end
166 | return 0
167 | end
168 |
169 | addEventHandler("onPlayerQuit",root,function()
170 | clearItems(source)
171 | end)
172 | addEventHandler("onElementDestroy",root,function()
173 | clearItems(source)
174 | end)
175 |
176 | addEvent('load.items.server', true)
177 | addEventHandler('load.items.server', root, function()
178 | loadItems(source)
179 | end)
--------------------------------------------------------------------------------
/resources/[in-game]/items/ui/index.lua:
--------------------------------------------------------------------------------
1 | assert(loadstring(exports.dxlibrary:loadFunctions()))()
2 | local ui = class("UI")
3 | local localPlayer = getLocalPlayer()
4 | local isCursorShowing = isCursorShowing
5 | local tonumber = tonumber
6 | local tocolor = tocolor
7 | local guiGetScreenSize = guiGetScreenSize
8 | local dxDrawCircle = dxDrawCircle
9 | local dxDrawImage = dxDrawImage
10 | local dxDrawRectangle = dxDrawRectangle
11 | local ipairs = ipairs
12 | local getCursorPosition = getCursorPosition
13 | local getKeyState = getKeyState
14 | local getTickCount = getTickCount
15 | local triggerServerEvent = triggerServerEvent
16 | local cursorX, cursorY
17 | local bgColor = tocolor(15, 15, 15, 235)
18 | local hoverBgColor = tocolor(30, 30, 30, 235)
19 | local progColor = tocolor(66, 135, 245)
20 |
21 | function ui:init()
22 | self._function = {
23 | open = function(...) self:open(...) end,
24 | display = function(...) self:display(...) end,
25 | }
26 | self.categorys = {}
27 | self:addCategory('Cüzdan', 'assets/images/wallet.png')
28 | self:addCategory('Çanta', 'assets/images/pack.png')
29 | self:addCategory('Anahtarlık', 'assets/images/key.png')
30 | self:addCategory('Silahlar', 'assets/images/gun.png')
31 | self.screen = Vector2(guiGetScreenSize())
32 | self.font = exports.fonts:getFont('RobotoB', 9)
33 | self.itemImages = {}
34 | self.current = 1
35 | bindKey('i', 'down', self._function.open)
36 | end
37 |
38 | function ui:display()
39 | local x,y,w,h = self.screen.x-70,self.screen.y/2-250/2,60,250
40 | local boxX, boxY, boxW, boxH = x+5, y+20, 50, 50
41 | local newX,newY = 55,20
42 | x, boxX = x - newX, boxX - newX
43 | dxDrawRoundedRectangle(x,y,w,h,9,bgColor)
44 | for i = 1, #self.categorys do
45 | local category = self.categorys[i]
46 | if self.current == i then
47 | dxDrawRectangle(boxX,boxY,boxW,boxH,hoverBgColor)
48 | elseif isInBox(boxX,boxY,boxW,boxH,"hand") then
49 | dxDrawRectangle(boxX,boxY,boxW,boxH,hoverBgColor)
50 | if getKeyState('mouse1') and self.tick+400 <= getTickCount() then
51 | self.tick = getTickCount()
52 | self.current = i
53 | self:refresh()
54 | end
55 | else
56 | dxDrawRectangle(boxX,boxY,boxW,boxH,bgColor)
57 | end
58 | dxDrawImage(boxX+7.5,boxY+7.5,35,35,category[2])
59 | boxY=boxY+52
60 | end
61 | dxDrawRoundedRectangle(self.screen.x-5-self.size,y,self.size+2.5,h,9,bgColor)
62 | for index, value in ipairs(self.items) do
63 | if isInBox(self.screen.x-1-newX,y+newY,boxW,boxH,"hand") then
64 | dxDrawRectangle(self.screen.x-1-newX,y+newY,boxW,boxH,hoverBgColor)
65 | local cursorX, cursorY = getCursorPosition()
66 | cursorX, cursorY = cursorX * self.screen.x, cursorY * self.screen.y
67 | dxDrawText(""..string.sub(value[6],1,10).." ("..value[5]..")",cursorX-35,cursorY-20,nil,nil,tocolor(155,155,155,235),1,self.font)
68 | if getKeyState('mouse1') and self.tick+400 <= getTickCount() then
69 | self.tick = getTickCount()
70 | triggerServerEvent('use.item',localPlayer,value[1])
71 | self:open()
72 | end
73 | else
74 | dxDrawRectangle(self.screen.x-1-newX,y+newY,boxW,boxH,bgColor)
75 | end
76 | dxDrawText('x'..value[3],self.screen.x-1-newX,y+newY,nil,nil,tocolor(155,155,155,235),1,self.font)
77 | dxDrawImage(self.screen.x-1+10-newX,y+10+newY,30,30,value[2])
78 | if value[4] == "FOOD" or value[4] == "DRINK" then
79 | dxDrawRectangle(self.screen.x-1-newX,y+newY+boxH-5,math.min((boxW/100)*value[1][2],boxW),5,progColor)
80 | end
81 | newY = newY + 52
82 | if index % 4 == 0 then
83 | newY = 20
84 | newX = newX + 55
85 | end
86 | end
87 | end
88 |
89 | function ui:addCategory(name, image)
90 | table.insert(self.categorys, {name, image})
91 | end
92 |
93 | function ui:open()
94 | if localPlayer:getData("online") then
95 | self.active = not self.active
96 | self.items = {}
97 | if self.active then
98 | self.tick = 0
99 | self:refresh()
100 | Sound('assets/audio/bag.wav')
101 | self.render = self.render or Timer(self._function.display, 0, 0)
102 | else
103 | if self.render and self.render.valid then
104 | self.render:destroy()
105 | self.render = nil
106 | end
107 | end
108 | end
109 | end
110 |
111 | function ui:refresh()
112 | local items = getItems(localPlayer) or {}
113 | local category = getItemCategory
114 | local current = self.current
115 | local size = 55
116 | self.items = {}
117 | for index, value in pairs(items) do
118 | if category(value[1]) == current then
119 | table.insert(self.items, {
120 | value,
121 | self:getImage(value[1]),
122 | getItemCount(value[1],value[2]),
123 | getItemType(value[1]),
124 | getItemValue(value[1],value[2]),
125 | getItemName(value[1]),
126 | })
127 | if index % 4 == 0 then
128 | size = size + 55
129 | end
130 | end
131 | end
132 | self.size = size
133 | end
134 |
135 | function ui:getImage(itemID)
136 | if not self.itemImages[itemID] then
137 | local imagePath = 'assets/images/items/'..itemID..'.png'
138 | self.itemImages[itemID] = File.exists(imagePath) and imagePath or 'assets/images/null.png'
139 | end
140 | return self.itemImages[itemID]
141 | end
142 |
143 | ui:new()
144 |
--------------------------------------------------------------------------------
/resources/[in-game]/items/ui/use.lua:
--------------------------------------------------------------------------------
1 | functions = {
2 | -- itemID, function
3 | ['FOOD'] = {function(player,itemID,itemValue,itemCount,itemIndex)
4 | local dbid = player:getData('dbid')
5 | local hunger = player:getData('hunger') or 100
6 | local newHunger = hunger + 20
7 | local new_value = tonumber(itemValue) - 25
8 |
9 | if new_value <= 0 then
10 | takeItemFromIndex(player,itemIndex,1)
11 | if itemCount > 1 then setItemValue(player,itemIndex,100) end
12 | else
13 | setItemValue(player,itemIndex,new_value)
14 | end
15 |
16 |
17 | if newHunger > 100 then
18 | player:setData('hunger', 100)
19 | exports.cache:setCharacterData(dbid, 'hunger', 100)
20 | else
21 | player:setData('hunger', newHunger)
22 | exports.cache:setCharacterData(dbid, 'hunger', newHunger)
23 | end
24 | end},
25 |
26 | ['DRINK'] = {function(player,itemID,itemValue,itemCount,itemIndex)
27 | local dbid = player:getData("dbid")
28 | local thirst = player:getData('thirst') or 100
29 | local newThirst = thirst + 20
30 | local new_value = tonumber(itemValue) - 25
31 |
32 | if new_value <= 0 then
33 | takeItemFromIndex(player,itemIndex,1)
34 | if itemCount > 1 then setItemValue(player,itemIndex,100) end
35 | else
36 | setItemValue(player,itemIndex,new_value)
37 | end
38 |
39 | if newThirst > 100 then
40 | player:setData('thirst', 100)
41 | exports.cache:setCharacterData(dbid, 'thirst', 100)
42 | else
43 | player:setData('thirst', newThirst)
44 | exports.cache:setCharacterData(dbid, 'thirst', newThirst)
45 | end
46 | end},
47 |
48 | ['KEY'] = {function(player,itemID,itemValue,itemCount,itemIndex)
49 | if itemID == 1 then
50 | --// INTERIOR
51 | else
52 | triggerEvent("vehicle.toggle.lock", player, itemValue)
53 | end
54 | end},
55 | }
56 |
57 | function useItem(info)
58 | local itemID,itemValue,_ = unpack(info)
59 | if source and tonumber(itemID) then
60 | if functions[getItemType(itemID)] then
61 | local itemIndex,_,itemValue_, itemCount = hasItem(source,itemID,itemValue)
62 | functions[getItemType(itemID)][1](source,itemID,itemValue_,itemCount,itemIndex)
63 | end
64 | end
65 | end
66 | addEvent('use.item',true)
67 | addEventHandler('use.item',root,useItem)
68 |
--------------------------------------------------------------------------------
/resources/[in-game]/living/libs/classlib.lua:
--------------------------------------------------------------------------------
1 | function class(name)
2 | local c = {}
3 | c.__index = c
4 | c.__type = name
5 |
6 | function c:new(...)
7 | local instance = setmetatable({}, self)
8 | instance:init(...)
9 | return instance
10 | end
11 |
12 | function c:addMethod(name, fn)
13 | self[name] = fn
14 | end
15 |
16 | function c:extend(name)
17 | local subclass = class(name)
18 | setmetatable(subclass, { __index = self })
19 | return subclass
20 | end
21 |
22 | return c
23 | end
24 |
--------------------------------------------------------------------------------
/resources/[in-game]/living/meta.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/resources/[in-game]/living/server.lua:
--------------------------------------------------------------------------------
1 | local cache = exports.cache
2 |
3 | addEvent("living.need", true)
4 | addEventHandler("living.need", root, function()
5 | local hunger = source:getData("hunger")
6 | local thirst = source:getData("thirst")
7 | local dbid = source:getData("dbid")
8 | if hunger <= 0 then
9 | local health = source.health
10 | source.health = health - 10
11 | else
12 | local new = tonumber(hunger - math.random(1, 3))
13 | if new < 0 then
14 | new = 0
15 | end
16 | source:setData("hunger", new)
17 | cache:setCharacterData(dbid, "hunger", new)
18 | end
19 | if thirst <= 0 then
20 | local health = source.health
21 | source.health = health - 10
22 | else
23 | local new = tonumber(thirst - math.random(1, 3))
24 | if new < 0 then
25 | new = 0
26 | end
27 | source:setData("thirst", new)
28 | cache:setCharacterData(dbid, "thirst", new)
29 | end
30 | end)
--------------------------------------------------------------------------------
/resources/[in-game]/living/ui/index.lua:
--------------------------------------------------------------------------------
1 | local ui = class("UI")
2 |
3 | function ui:init()
4 | self:loadAssets()
5 | self:registerEvents()
6 | end
7 |
8 | function ui:loadAssets()
9 | assert(loadstring(exports.dxlibrary:loadFunctions()))()
10 |
11 | self.fonts = {
12 | awesome = exports.fonts:getFont("AwesomeSolid", 12)
13 | }
14 |
15 | self.icons = {
16 | hearth = "",
17 | armor = "",
18 | hunger = "",
19 | thirst = ""
20 | }
21 | end
22 |
23 | function ui:registerEvents()
24 | self._renderFunction = function(...)
25 | self:render(...)
26 | end
27 |
28 | self._needFunction = function(...)
29 | if localPlayer:getData("online") then
30 | triggerServerEvent("living.need", localPlayer)
31 | end
32 | end
33 |
34 | Timer(self._needFunction, 600000, 0)
35 | addEventHandler("onClientRender", root, self._renderFunction, false, "low-9999")
36 | end
37 |
38 | function ui:render()
39 | if not localPlayer:getData("online") then
40 | return
41 | end
42 |
43 | local iconWidth, iconHeight = 100, 20
44 | local iconPadding = 40
45 | local x, y = screen.x / 2 - (iconWidth + 100 * 4 + iconPadding * 3) / 2, screen.y - 25
46 |
47 | local stats = {
48 | { value = localPlayer.health, color = tocolor(26, 135, 86, 200) },
49 | { value = localPlayer.armor, color = tocolor(8, 69, 151, 200) },
50 | { value = localPlayer:getData("hunger"), color = tocolor(185, 154, 102, 200) },
51 | { value = localPlayer:getData("thirst"), color = tocolor(16, 202, 237, 200) },
52 | }
53 |
54 | for i, icon in ipairs({self.icons.hearth, self.icons.armor, self.icons.hunger, self.icons.thirst}) do
55 | local xPos = x + iconPadding * (i - 1) + i * iconWidth - iconPadding + 12
56 |
57 | dxDrawShadowedText(icon, xPos-25, y, iconWidth, iconHeight, tocolor(200, 200, 200, 200), 1, self.fonts.awesome)
58 | dxDrawRectangle(xPos - 1, y - 1, iconWidth + 2, iconHeight + 2, tocolor(15, 15, 15))
59 | dxDrawRectangle(xPos, y, stats[i].value, iconHeight, stats[i].color)
60 | end
61 | end
62 |
63 | ui:new()
--------------------------------------------------------------------------------
/resources/[in-game]/mysql/connection.lua:
--------------------------------------------------------------------------------
1 | -- MySQL sınıfı tanımlama
2 | mysql = {}
3 | mysql.__index = mysql
4 | mysql.otherConnecions = {}
5 |
6 | -- MYSQL BİLGİLERİ
7 | mysql.database = 'roleplay'
8 | mysql.username = 'root'
9 | mysql.password = ''
10 | mysql.hostname = '127.0.0.1'
11 | mysql.port = 3306
12 |
13 | -- ID sorgusu yapılcak table isimleri.
14 | mysql.id_tables = {
15 | "accounts","characters","items","vehicles"
16 | }
17 | -- idlerin depolancağı tablo.
18 | mysql.id_cache = {}
19 |
20 | -- Yeni bir MySQL nesnesi oluşturma işlevi
21 | function mysql:new(database, username, password, hostname, port)
22 | -- Veritabanına bağlanma
23 | self.connection = dbConnect("mysql", "dbname=" .. database .. ";host=" .. hostname .. ";port=" .. port, username, password)
24 | if self.connection then
25 | outputDebugString('database connection successful')
26 | self:loadIDCache(1)
27 | else
28 | outputDebugString('database connection failed')
29 | end
30 | return true
31 | end
32 |
33 | function mysql:loadIDCache(i)
34 | local v = self.id_tables[i]
35 | if not v then print("! MYSQL ID CACHED") return end
36 | self.id_cache[v]={}
37 | dbQuery(function(qh,index,tablename)
38 | local res, rows, err = dbPoll(qh, 0)
39 | self.id_cache[tablename]=res[1] and res[1].id or 0
40 |
41 | self:loadIDCache(index+1)
42 | end,{i,v},self.connection,"SELECT `id` FROM "..v.." ORDER BY id DESC LIMIT 1")
43 | end
44 |
45 | -- exports.mysql:getNewID("accounts")
46 | function mysql:getNewID(tablename)
47 | local id = mysql.id_cache[tablename]
48 | if not id then return false end
49 |
50 | mysql.id_cache[tablename] = mysql.id_cache[tablename]+1
51 | return mysql.id_cache[tablename]
52 | end
53 |
54 | -- exports.mysql:getConn() // exports.mysql:getConn("connection_name")
55 | function mysql:getConn(connectionName)
56 | return self.otherConnecions[connectionName] or self.connection
57 | end
58 |
59 | -- exports.mysql:newConnect("connection_name","tag=0;log=0")
60 | function mysql:newConnect(connectionName,options)
61 | if not connectionName then return false end
62 | if self.otherConnecions[connectionName] then return self.otherConnecions[connectionName] end
63 | self.otherConnecions[connectionName] = dbConnect("mysql", "dbname=" .. self.database .. ";host=" .. self.hostname .. ";port=" .. self.port, self.username, self.password,options)
64 | return self.otherConnecions[connectionName]
65 | end
66 |
67 | -- MySQL sorgusu çalıştırma işlevi
68 | function mysql:query(sql, callback)
69 | local query = dbQuery(self.connection, sql)
70 | local result, num_affected_rows, last_insert_id = dbPoll(query, -1)
71 |
72 | if result == nil then
73 | outputDebugString("MySQL query error: " .. dbErrorMessage())
74 | return false
75 | end
76 |
77 | if callback then
78 | callback(result, num_affected_rows, last_insert_id)
79 | end
80 |
81 | return result, num_affected_rows, last_insert_id
82 | end
83 |
84 | -- MySQL nesnesini kapatma işlevi
85 | function mysql:close()
86 | dbConnectionFree(self.connection)
87 | end
88 |
89 |
90 | function getConn(...)
91 | return mysql:getConn(...)
92 | end
93 | function newConnect(...)
94 | return mysql:newConnect(...)
95 | end
96 | function getNewID(...)
97 | return mysql:getNewID(...)
98 | end
99 |
100 | mysql:new(mysql.database,mysql.username,mysql.password,mysql.hostname,mysql.port)
101 |
--------------------------------------------------------------------------------
/resources/[in-game]/mysql/meta.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/resources/[in-game]/scoreboard/index.lua:
--------------------------------------------------------------------------------
1 | ui = class("UI")
2 |
3 | function ui:init()
4 | self:loadAssets()
5 | self:events()
6 |
7 | bindKey("tab", "both", self._startRender)
8 | bindKey('mouse_wheel_up', 'down', self._up)
9 | bindKey('mouse_wheel_down', 'down', self._down)
10 | end
11 |
12 | function ui:loadAssets()
13 | assert(loadstring(exports.dxlibrary:loadFunctions()))()
14 | self.fonts = {
15 | awesome = exports.fonts:getFont("AwesomeRegular", 20),
16 | awesome2 = exports.fonts:getFont("AwesomeSolid", 23),
17 | robotoB = exports.fonts:getFont("RobotoB", 10),
18 | roboto = exports.fonts:getFont("Roboto", 12),
19 | oswald = exports.fonts:getFont("Oswald", 23)
20 | }
21 | self.players = {}
22 | self.maxPlayers = 300
23 | self.current = 1
24 | self.latest = 1
25 | end
26 |
27 | function ui:syncID()
28 | self.players = {}
29 | for k, v in ipairs(Element.getAllByType("player")) do
30 | self.players[k] = v
31 | end
32 | table.sort(self.players, function(a, b)
33 | if a ~= localPlayer and b ~= localPlayer and getElementData(a, "playerid") and getElementData(b, "playerid") then
34 | return tonumber(getElementData(a, "playerid")) < tonumber(getElementData(b, "playerid"))
35 | end
36 | end)
37 | end
38 |
39 | function ui:events()
40 | self._renderFunction = function(...)
41 | self:render(...)
42 | end
43 | self._syncID = function(...)
44 | self:syncID(...)
45 | end
46 | self._startRender = function(...)
47 | self:start(...)
48 | end
49 | self._up = function(...)
50 | self:up(...)
51 | end
52 | self._down = function(...)
53 | self:down(...)
54 | end
55 | end
56 |
57 | function ui:start()
58 | if localPlayer:getData("online") then
59 | self.active = not self.active
60 | if self.active then
61 | self.loading, self.finishLoad = 1, getTickCount()+3000
62 | addEventHandler("onClientRender", root, self._renderFunction, true, "low-9999")
63 | Delay = Timer(function()
64 | self.loaded = true
65 | end, 3000, 1)
66 | else
67 | removeEventHandler("onClientRender", root, self._renderFunction)
68 | self.loaded = false
69 | end
70 | end
71 | end
72 |
73 | function ui:render()
74 | w, h = 390, 480
75 | x, y = (screen.x-w)/2, (screen.y-h)/2
76 |
77 |
78 | self._syncID()
79 |
80 | dxDrawRoundedRectangle(x, y, w, h, 5, tocolor(30, 30, 30, 255))
81 | dxDrawRectangle(x+80, y+10, 2, 50, tocolor(255, 255, 255, 50))
82 | dxDrawText("projectQ ROLEPLAY", x+90, y, nil, nil, tocolor(255, 255, 255, 170), 1, self.fonts.oswald)
83 | dxDrawText("Write You'r History ...", x+91, y+35, nil, nil, tocolor(255, 255, 255, 140), 1, self.fonts.roboto)
84 | dxDrawText("", x+20, y+15, nil, nil, tocolor(255, 255, 255, 140), 1, self.fonts.awesome2)
85 |
86 | if not self.loaded then
87 | self.loading = self.loading + 5
88 | dxDrawText("", x+200, y+220, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.awesome2, "center", "center", false, false, false, false, false, self.loading)
89 | return
90 | end
91 |
92 | self.latest = self.current + self.maxPlayers - 1
93 | counterY = 0
94 | for k, v in pairs(self.players) do
95 | if k >= self.current and k <= self.latest then
96 | k = k - self.current + 1
97 | ping = v:getPing()
98 | id = v:getData('playerid')
99 | name = v.name:gsub("_", " ")
100 | hours = (v:getData('timeingame') or 0).." saat"
101 | if ping > 80 then
102 | ping = ping - 20
103 | end
104 | if v:getData('online') then
105 | r, g, b = 255, 255, 255
106 | dxDrawText(id, x+25, y+80+counterY, nil, nil, tocolor(r, g, b), 1, self.fonts.robotoB)
107 | dxDrawText(name, x+80, y+80+counterY, nil, nil, tocolor(r, g, b), 1, self.fonts.robotoB)
108 | dxDrawText(hours, x+250, y+80+counterY, nil, nil, tocolor(r, g, b), 1, self.fonts.robotoB)
109 | dxDrawText(ping.."ms", x+340, y+80+counterY, nil, nil, tocolor(r, g, b), 1, self.fonts.robotoB)
110 | else
111 | r, g, b = 100, 100, 100, 100
112 | dxDrawText(id, x+25, y+80+counterY, nil, nil, tocolor(r, g, b), 1, self.fonts.robotoB)
113 | dxDrawText("Giriş Yapıyor", x+100, y+80+counterY, nil, nil, tocolor(r, g, b), 1, self.fonts.robotoB)
114 | dxDrawText("Bilinmiyor", x+230, y+80+counterY, nil, nil, tocolor(r, g, b), 1, self.fonts.robotoB)
115 | dxDrawText("?", x+340, y+80+counterY, nil, nil, tocolor(r, g, b), 1, self.fonts.robotoB)
116 | end
117 | end
118 | counterY = counterY + 50
119 | end
120 | end
121 |
122 |
123 | function ui:up()
124 | if getKeyState('tab') then
125 | if self.current > 1 then
126 | self.current = self.current - 1
127 | end
128 | end
129 | end
130 |
131 | function ui:down()
132 | if getKeyState('tab') then
133 | if self.current < (#self.players) - (self.max_players - 1) then
134 | self.current = self.current + 1
135 | end
136 | end
137 | end
138 |
139 | ui:new()
140 |
141 |
142 |
--------------------------------------------------------------------------------
/resources/[in-game]/scoreboard/libs/classlib.lua:
--------------------------------------------------------------------------------
1 | function class(name)
2 | local c = {}
3 | c.__index = c
4 | c.__type = name
5 |
6 | function c:new(...)
7 | local instance = setmetatable({}, self)
8 | instance:init(...)
9 | return instance
10 | end
11 |
12 | function c:addMethod(name, fn)
13 | self[name] = fn
14 | end
15 |
16 | function c:extend(name)
17 | local subclass = class(name)
18 | setmetatable(subclass, { __index = self })
19 | return subclass
20 | end
21 |
22 | return c
23 | end
24 |
--------------------------------------------------------------------------------
/resources/[in-game]/scoreboard/meta.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 |
--------------------------------------------------------------------------------
/resources/[in-game]/vehicles/assets/engine.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/vehicles/assets/engine.wav
--------------------------------------------------------------------------------
/resources/[in-game]/vehicles/assets/lock.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/vehicles/assets/lock.wav
--------------------------------------------------------------------------------
/resources/[in-game]/vehicles/assets/window.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/vehicles/assets/window.wav
--------------------------------------------------------------------------------
/resources/[in-game]/vehicles/client.lua:
--------------------------------------------------------------------------------
1 | addEvent("vehicle.effect.3d", true)
2 | addEventHandler("vehicle.effect.3d", root, function(src, x, y, z)
3 | local effect = playSound3D(src, x, y, z, false)
4 | setSoundMaxDistance(effect, 12)
5 | end)
6 |
7 | bindKey("j", "down", function()
8 | if not getElementData(localPlayer, "online") then
9 | return
10 | end
11 |
12 | local vehicle = getPedOccupiedVehicle(localPlayer)
13 |
14 | if not vehicle then
15 | return
16 | end
17 |
18 | triggerServerEvent("vehicle.toggle.engine", localPlayer, vehicle)
19 | end)
20 |
21 | bindKey("l", "down", function()
22 | if not getElementData(localPlayer, "online") then
23 | return
24 | end
25 |
26 | local vehicle = getPedOccupiedVehicle(localPlayer)
27 |
28 | if not vehicle then
29 | return
30 | end
31 |
32 | triggerServerEvent("vehicle.toggle.lights", localPlayer, vehicle)
33 | end)
34 |
35 | bindKey("x", "down", function()
36 | if not getElementData(localPlayer, "online") then
37 | return
38 | end
39 |
40 | local vehicle = getPedOccupiedVehicle(localPlayer)
41 |
42 | if not vehicle then
43 | return
44 | end
45 |
46 | triggerServerEvent("vehicle.toggle.windows", localPlayer, vehicle)
47 | end)
48 |
49 |
50 | bindKey("k", "down", function()
51 | if not getElementData(localPlayer, "online") then
52 | return
53 | end
54 |
55 | triggerServerEvent("vehicle.toggle.lock", localPlayer)
56 | end)
--------------------------------------------------------------------------------
/resources/[in-game]/vehicles/fuel/client.lua:
--------------------------------------------------------------------------------
1 | local prevX, prevY, prevZ = 0
2 | local timerIntervall = 10000
3 | local maxDistance = timerIntervall
4 | noFuelVehicles = {
5 | ["Boat"] = true,
6 | ["Train"] = true,
7 | ["Trailer"] = true,
8 | ["BMX"] = true,
9 | }
10 |
11 | -- araba hareket ettiği sürece km sayacı ve gittiğie yola göre benzin azaltma.
12 | --(server.lua da da benzin azaltma var fakat o hem kayıt için hem de araba hareket etmese bile ama motoru açık olsa bile benzin azaltmak için.)
13 | function calculateDistance()
14 | local vehicle = getPedOccupiedVehicle(localPlayer)
15 | if not isElement(vehicle) or getVehicleController(vehicle) ~= localPlayer or isElementFrozen(vehicle) or not isControlEnabled("forwards") then
16 | return
17 | end
18 | if getVehicleType(vehicle) ~= "Plane" and not isVehicleOnGround ( vehicle ) then return end
19 | local x,y,z = getElementPosition(vehicle)
20 | if prevX ~= 0 then
21 | local distanceSinceLast = ((x-prevX)^2 + (y-prevY)^2 + (z-prevZ)^2)^(0.5)
22 | if distanceSinceLast < maxDistance then
23 | local total = tonumber(getElementData(vehicle,"odometer")) or 0
24 | local fuel = tonumber(getElementData(vehicle,"fuel")) or 0
25 | if fuel > 0 then
26 | local newfuel = math.floor(distanceSinceLast)/1000
27 | local vtype = getVehicleType(vehicle)
28 | if newfuel > 0 and not noFuelVehicles[vtype] then
29 | setElementData(vehicle,"fuel",fuel-(newfuel))
30 | end
31 | end
32 | setElementData(vehicle,"odometer",total+distanceSinceLast)
33 | end
34 | end
35 | prevX,prevY,prevZ = x,y,z
36 | end
37 | setTimer(calculateDistance,timerIntervall,0)
--------------------------------------------------------------------------------
/resources/[in-game]/vehicles/fuel/server.lua:
--------------------------------------------------------------------------------
1 | local tonumber = tonumber
2 | local ipairs = ipairs
3 | local cache = exports.cache
4 |
5 | -- arabanın motoru açık olduğu sürece benzini azalt ve verileri kaydet.
6 | function refueling()
7 | for _, vehicle in ipairs(getElementsByType("vehicle")) do
8 | if cache:getVehicleData(vehicle, "job") == 0 and cache:getVehicleData(vehicle, "engine") == 1 then
9 | local fuel = getElementData(vehicle, "fuel")
10 | local odometer = getElementData(vehicle, "odometer")
11 | if fuel <= 0 then
12 | setVehicleEngineState(vehicle, false)
13 | cache:setVehicleData(vehicle, "engine", 0)
14 | return
15 | end
16 | local new = fuel - 1
17 | setElementData(vehicle, "fuel", new)
18 | cache:setVehicleData(vehicle, "fuel", new)
19 | cache:setVehicleData(vehicle, "odometer", odometer)
20 | end
21 | end
22 | end
23 | setTimer(refueling, 30000, 0)
--------------------------------------------------------------------------------
/resources/[in-game]/vehicles/meta.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/resources/[in-game]/vehicles/tax/client.lua:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/forprojectQ/projectQ/2172df627a9a0b239fa10fad1c7bc945ad23460a/resources/[in-game]/vehicles/tax/client.lua
--------------------------------------------------------------------------------
/resources/[in-game]/vehicles/tax/server.lua:
--------------------------------------------------------------------------------
1 | local tonumber = tonumber
2 | local ipairs = ipairs
3 | local cache = exports.cache
4 |
5 | function taxation()
6 | for _, vehicle in ipairs(getElementsByType("vehicle")) do
7 | local dbid = getElementData(vehicle, "dbid")
8 | if cache:getVehicleData(dbid, "job") == 0 then
9 | local interest = tonumber(cache:getVehicleData(dbid, "interest"))
10 | if interest == 1 then
11 | return
12 | end
13 | local current = tonumber(getElementData(vehicle, "tax"))
14 | if current > 25000 then
15 | setVehicleEngineState(vehicle, false)
16 | cache:setVehicleData(dbid, "engine", 0)
17 | cache:setVehicleData(dbid, "interest", 1)
18 | return
19 | end
20 | local add = tonumber(getElementData(vehicle, "carshop_tax"))
21 | local new = current + add
22 | setElementData(vehicle, "tax", new)
23 | cache:setVehicleData(dbid, "tax", new)
24 | end
25 | end
26 | end
27 | setTimer(taxation, 3600000, 0)
--------------------------------------------------------------------------------
/resources/[in-game]/vehicleshop/client.lua:
--------------------------------------------------------------------------------
1 | ui = class("UI")
2 |
3 | function ui:init()
4 | self.functions = {
5 | render = function(...) self:render(...) end,
6 | load = function(...) self:load(...) end,
7 | startRender = function(...) self:start(...) end,
8 | up = function(...) self:up(...) end,
9 | down = function(...) self:down(...) end,
10 | carScreen = function(...) self:carScreen(...) end
11 | }
12 | self:registerEvent()
13 | self:loadAssets()
14 | bindKey('mouse_wheel_up', 'down', self.functions.up)
15 | bindKey('mouse_wheel_down', 'down', self.functions.down)
16 | self.npc = createPed(11, 555.537109375, -1293.08203125, 17.248237609863, 2.3923034667969)
17 | self.npc:setData('name', 'Carol Joshua')
18 | self.npc.frozen = true
19 | addEventHandler('onClientClick', root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement)
20 | if (clickedElement) then
21 | if clickedElement == self.npc then
22 | if button == "right" and state == "down" then
23 | self.functions.startRender()
24 | end
25 | end
26 | end
27 | end)
28 | end
29 |
30 | function ui:render()
31 | self.w, self.h = 250, 80
32 | self.x, self.y = (screen.x-self.w), (screen.y-self.h)/2
33 | self.x2 = interpolateBetween(self.x+200, 0, 0, self.x-30, 0, 0, ((getTickCount() - self.startTime) / 700), "Linear")
34 | dxDrawRoundedRectangle(self.x2, self.y-300, 400, 600, 2, tocolor(50, 50, 50, 240))
35 | dxDrawText("Grotti Car's", self.x2+150, self.y-280, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.oswald, "center", "center", false, false, false, false, true)
36 | if not self.loaded then
37 | self.loading = self.loading + 5
38 | dxDrawText("", self.x2+155, self.y-10, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.awesome2, "center", "center", false, false, false, false, false, self.loading)
39 | dxDrawText("Araçlar Yükleniyor", self.x2+155, self.y+25, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.robotoB, "center", "center", false, false, false, false, false)
40 | return
41 | end
42 | self.counterYText = 0
43 | self.counterYRect = 0
44 | self.latest = self.current + self.maxCar - 1
45 | for i, v in ipairs(self.vehicle) do
46 | if i >= self.current and i <= self.latest then
47 | if (v.enabled) == 0 then return end
48 | if i == self.selected then
49 | if isInBox(self.x-15, self.y-230+self.counterYRect, self.w, self.h, "hand") then
50 | dxDrawRoundedRectangle(self.x-15, self.y-230+self.counterYRect, self.w, self.h, 2, tocolor(20, 20, 20, 250))
51 | if getKeyState("mouse1") and isClicked() then
52 | self.buyScreen = true
53 | self.selected = nil
54 | end
55 | else
56 | dxDrawRoundedRectangle(self.x-15, self.y-230+self.counterYRect, self.w, self.h, 2, tocolor(20, 20, 20, 200))
57 | end
58 | else
59 | if isInBox(self.x-15, self.y-230+self.counterYRect, self.w, self.h, "hand") then
60 | dxDrawRoundedRectangle(self.x-15, self.y-230+self.counterYRect, self.w, self.h, 2, tocolor(20, 20, 20, 250))
61 | if getKeyState("mouse1") and isClicked() then
62 | self.buyScreen = false
63 | self.selected = i
64 | self.tax = v.tax
65 | self.model = v.model
66 | self.selectedModel = ""..v.brand.. " " ..v.model..""
67 | self.year = v.year
68 | self.fueltype = v.fueltype
69 | self.price = v.price
70 | self.gtaID = v.gtaID
71 | self.vehlibID = v.vehlibID
72 | end
73 | else
74 | dxDrawRoundedRectangle(self.x-15, self.y-230+self.counterYRect, self.w, self.h, 2, tocolor(20, 20, 20, 200))
75 | end
76 | end
77 | dxDrawText(v.brand, self.x-5, self.y-230+self.counterYText, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.oswald)
78 | dxDrawText(v.model, self.x-5, self.y-197+self.counterYText, nil, nil, tocolor(255, 255, 255, 170), 1, self.fonts.roboto)
79 | self.lenght = dxGetTextWidth(""..exports.global:formatMoney(v.price).."#008000$", 1, self.fonts.oswaldS)
80 | dxDrawText(""..exports.global:formatMoney(v.price).."#008000$", self.x+300-self.lenght, self.y-190+self.counterYText, nil, nil, tocolor(255, 255, 255, 170), 1, self.fonts.oswaldS, "left", "top", _, _, _, true)
81 | dxDrawText("Stok: "..v.stock.."", self.x-5, self.y-180+self.counterYText, nil, nil, tocolor(255, 255, 255, 170), 1, self.fonts.roboto)
82 |
83 | if (v.fueltype) == -1 then
84 | v.fueltype = "Dizel"
85 | elseif (v.fueltype) == 0 then
86 | v.fueltype = "Benzin"
87 | elseif (v.fueltype) == 1 then
88 | v.fueltype = "LPG"
89 | end
90 |
91 | self.counterYText = self.counterYText + 85
92 | self.counterYRect = self.counterYRect + 85
93 | end
94 | if self.buyScreen then
95 | dxDrawRoundedRectangle(self.x-30, self.y+320, 280, 200, 2, tocolor(50, 50, 50, 240))
96 | dxDrawText("Satın Alım Ekranı", self.x-15, self.y+320, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.oswald)
97 | dxDrawText("Seçili Araç: #ECAB53"..self.selectedModel.."", self.x-15, self.y+370, nil, nil, tocolor(255, 255, 255, 170), 1, self.fonts.roboto, _, _, _, _ ,_, true)
98 | dxDrawText("Vergi: "..exports.global:formatMoney(self.tax).."#008000$".."", self.x-15, self.y+390, nil, nil, tocolor(255, 255, 255, 170), 1, self.fonts.roboto, _, _, _, _ ,_, true)
99 | dxDrawText("Çıkış Yılı: #FF2222"..self.year.."", self.x-15, self.y+410, nil, nil, tocolor(255, 255, 255, 170), 1, self.fonts.roboto, _, _, _, _ ,_, true)
100 | dxDrawText("Yakıt Türü: #FFFF50"..self.fueltype.."", self.x-15, self.y+430, nil, nil, tocolor(255, 255, 255, 170), 1, self.fonts.roboto, _, _, _, _ ,_, true)
101 |
102 | if isInBox(self.x-15, self.y+470, 120, 35, "hand") then
103 | dxDrawRoundedRectangle(self.x-15, self.y+470, 120, 35, 2, tocolor(0, 128, 0, 200))
104 | if getKeyState("mouse1") and isClicked() then
105 | triggerServerEvent("vehicle.buy", localPlayer, self.price, self.selectedModel, self.vehlibID)
106 | showCursor(false)
107 | end
108 | else
109 | dxDrawRoundedRectangle(self.x-15, self.y+470, 120, 35, 2, tocolor(20, 20, 20, 220))
110 | end
111 | dxDrawText("Satın Al", self.x+18, self.y+476, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.roboto)
112 |
113 | if isInBox(self.x+120, self.y+470, 120, 35, "hand") then
114 | dxDrawRoundedRectangle(self.x+120, self.y+470, 120, 35, 2, tocolor(0, 105, 92, 200))
115 | if getKeyState("mouse1") and isClicked() then
116 | self.functions.carScreen(self.gtaID)
117 | end
118 | else
119 | dxDrawRoundedRectangle(self.x+120, self.y+470, 120, 35, 2, tocolor(20, 20, 20, 220))
120 | end
121 | dxDrawText(self.screenText, self.x+150, self.y+476, nil, nil, tocolor(255, 255, 255, 200), 1, self.fonts.roboto)
122 | end
123 | end
124 | end
125 |
126 | function ui:start()
127 | if localPlayer:getData("online") then
128 | self.active = not self.active
129 | if self.active then
130 | self.loading, self.finishLoad = 1, getTickCount()+3000
131 | addEventHandler("onClientRender", root, self.functions.render, true, "low-9999")
132 | triggerServerEvent("vehicle.get.data", localPlayer)
133 | Delay = Timer(function()
134 | self.loaded = true
135 | end, 4000, 1)
136 | self.maxCar = 6
137 | self.current = 1
138 | self.latest = 1
139 | self.startTime = getTickCount()
140 | self.selected = nil
141 | self.x2 = 0
142 | self.screenText = "Görüntüle"
143 | showCursor(true)
144 | else
145 | showCursor(false)
146 | removeEventHandler("onClientRender", root, self.functions.render)
147 | self.loaded = false
148 | end
149 | end
150 | end
151 |
152 | function ui:carScreen(gtaID)
153 | self.state = not self.state
154 | if self.state then
155 | self.dimension = 100
156 | self.veh = Vehicle(602, 2263.654296875, -2484.3349609375, 8.2896251678467)
157 | self.veh.dimension = self.dimension
158 | Camera.setMatrix(2252.056640625, -2477.9736328125, 10.98962688446, 2263.654296875, -2484.3349609375, 8.2896251678467)
159 | localPlayer:setPosition(2257, -2482, 8.296875)
160 | localPlayer:setRotation(0, 0, 247)
161 | localPlayer.dimension = self.dimension
162 | localPlayer:setFrozen(true)
163 | self.screenText = "Geri Dön"
164 | self.veh.model = gtaID
165 | toggleAllControls(false)
166 | else
167 | self.buyScreen = false
168 | self.veh:destroy()
169 | triggerServerEvent("close.vehicle.shop", localPlayer)
170 | self.screenText = "Görüntüle"
171 | end
172 | end
173 |
174 | function ui:up()
175 | if self.active then
176 | if self.current > 1 then
177 | self.current = self.current - 1
178 | end
179 | end
180 | end
181 |
182 | function ui:down()
183 | if self.active then
184 | if self.current < (#self.vehicle) - (self.maxCar - 1) then
185 | self.current = self.current + 1
186 | end
187 | end
188 | end
189 |
190 | function ui:loadAssets()
191 | assert(loadstring(exports.dxlibrary:loadFunctions()))()
192 | self.fonts = {
193 | awesome = exports.fonts:getFont("AwesomeRegular", 20),
194 | awesome2 = exports.fonts:getFont("AwesomeSolid", 23),
195 | robotoB = exports.fonts:getFont("RobotoB", 11),
196 | roboto = exports.fonts:getFont("Roboto", 11),
197 | oswald = exports.fonts:getFont("Oswald", 23),
198 | oswaldS = exports.fonts:getFont("Oswald", 20),
199 | }
200 | end
201 |
202 | function ui:load(vehData)
203 | self.vehicle = vehData
204 | end
205 |
206 | function ui:registerEvent()
207 | addEvent("vehicle.data", true)
208 | addEventHandler("vehicle.data", root, self.functions.load)
209 | end
210 |
211 |
212 | ui:new()
213 |
--------------------------------------------------------------------------------
/resources/[in-game]/vehicleshop/libs/classlib.lua:
--------------------------------------------------------------------------------
1 | function class(name)
2 | local c = {}
3 | c.__index = c
4 | c.__type = name
5 | c.databaseLoaded = false
6 |
7 | function c:new(...)
8 | local instance = setmetatable({}, self)
9 | instance:init(...)
10 | return instance
11 | end
12 |
13 | function c:addMethod(name, fn)
14 | self[name] = fn
15 | end
16 |
17 | function c:extend(name)
18 | local subclass = class(name)
19 | setmetatable(subclass, { __index = self })
20 | return subclass
21 | end
22 |
23 | return c
24 | end
25 |
--------------------------------------------------------------------------------
/resources/[in-game]/vehicleshop/meta.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/resources/[in-game]/vehicleshop/server.lua:
--------------------------------------------------------------------------------
1 | local connection = exports.mysql:getConn()
2 |
3 | function getVehicleData (thePlayer)
4 | if thePlayer then
5 | source = thePlayer
6 | end
7 | dbQuery(
8 | function(qh, thePlayer)
9 | local res, rows, err = dbPoll(qh, 0)
10 | local vehicles = {}
11 | if rows > 0 then
12 | for index, row in ipairs(res) do
13 | table.insert(vehicles, {vehlibID = row.id, gtaID = row.gta, brand = row.brand, model = row.model, year = row.year, price = row.price, tax = row.tax, enabled = row.enabled, stock = row.stock, fueltype = row.fueltype})
14 | end
15 | end
16 | triggerClientEvent(thePlayer, "vehicle.data", thePlayer, vehicles)
17 | end,
18 | {source}, connection, "SELECT * FROM vehicles_library")
19 | end
20 | addEvent("vehicle.get.data", true)
21 | addEventHandler("vehicle.get.data", root, getVehicleData)
22 |
23 | function closeVehicleShop()
24 | source.dimension = 0
25 | source.cameraTarget = source
26 | source:setFrozen(false)
27 | source:setPosition(555.318359375, -1291.763671875, 17.248237609863)
28 | toggleAllControls(source, true)
29 | end
30 | addEvent("close.vehicle.shop", true)
31 | addEventHandler("close.vehicle.shop", root, closeVehicleShop)
32 |
33 | function buyVehicle(price, selectedModel, vehlibID)
34 | if source then
35 | if exports.global:takeMoney(source, price) then
36 | local owner = source:getData("dbid")
37 | exports.vehicles:makeVehicle(vehlibID, owner, 0)
38 | source:outputChat(">#D0D0D0 Başarıyla "..selectedModel.." markalı aracı satın aldın!", 0, 255, 0, true)
39 | else
40 | source:outputChat(">#D0D0D0 Bu aracı satın almak için paranız yeterli değil. Gerekli miktar: "..exports.global:formatMoney(price).."$", 255, 0, 0, true)
41 | end
42 | end
43 | end
44 | addEvent("vehicle.buy", true)
45 | addEventHandler("vehicle.buy", root, buyVehicle)
46 |
--------------------------------------------------------------------------------
/resources/[in-game]/vehicleslibrary/client.lua:
--------------------------------------------------------------------------------
1 | local screen = Vector2(guiGetScreenSize())
2 | local dbid
3 | local adds = {
4 | {"ID", 0.05},
5 | {"GTA", 0.06},
6 | {"MARKA", 0.15},
7 | {"MODEL", 0.15},
8 | {"YIL", 0.06},
9 | {"ÜCRET", 0.12},
10 | {"VERGİ", 0.1},
11 | {"GÜNCELLEYEN", 0.1},
12 | {"TARİH", 0.15},
13 | }
14 |
15 | local formatMoney = function(amount)
16 | local left,num,right = string.match(tostring(amount),'^([^%d]*%d)(%d*)(.-)$')
17 | return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
18 | end
19 |
20 | local validation = function(...)
21 | for i,v in ipairs({...}) do
22 | if not tonumber(gui.edit[v].text) then
23 | outputChatBox("Lütfen yeni araç bilgilerini geçerli bir şekilde doldurun!", 255, 25, 25)
24 | return false
25 | end
26 | end
27 | return true
28 | end
29 |
30 | function library(results)
31 | local columns = {}
32 | if isElement(window) then
33 | window:destroy()
34 | end
35 | window = GuiWindow(screen.x/2-800/2, screen.y/2-500/2, 800, 500, "Araç Kütüphanesi", false)
36 | window:setSizable(false)
37 | list = GuiGridList(5, 25, 785, 420, false, window)
38 | list:setSortingEnabled(false)
39 | for index, value in ipairs(adds) do
40 | columns[index] = list:addColumn(value[1], value[2])
41 | end
42 | for index, value in ipairs(results) do
43 | local row = list:addRow(columns[index])
44 | list:setItemText(row, columns[1], value.id, false, false)
45 | list:setItemText(row, columns[2], value.gta, false, false)
46 | list:setItemText(row, columns[3], value.brand, false, false)
47 | list:setItemText(row, columns[4], value.model, false, false)
48 | list:setItemText(row, columns[5], value.year, false, false)
49 | list:setItemText(row, columns[6], "$"..formatMoney(value.price), false, false)
50 | list:setItemText(row, columns[7], "$"..formatMoney(value.tax), false, false)
51 | list:setItemText(row, columns[8], value.updatedbyname or "", false, false)
52 | list:setItemText(row, columns[9], value.updatedate or "", false, false)
53 | list:setItemData(row,1,value)
54 | if value.enabled == 0 then
55 | for columnid=1,#columns do
56 | list:setItemColor(row,columnid,255,0,0)
57 | end
58 | end
59 | end
60 | editW = GuiButton(5, 450, 150, 30, "Seçili Aracı Düzenle", false, window)
61 | addW = GuiButton(5+150+5, 450, 150, 30, "Yeni Bir Araç Ekle", false, window)
62 | handlingW = GuiButton(5+300+5, 450, 150, 30, "Handling", false, window)
63 | closeW = GuiButton(5+450+5, 450, 150, 30, "Arayüzü Kapat", false, window)
64 | end
65 |
66 | function edit()
67 | if isElement(editWindow) then
68 | editWindow:destroy()
69 | end
70 | gui = {staticLbls={},edit={},combos={},check={}}
71 | local pg,pu = 450,550
72 | local x,y = (screen.x-pg)/2,(screen.y-pu)/2
73 | editWindow = GuiWindow(x,y,pg,pu,"Araç Özellikleri", false)
74 | editWindow:setSizable(false)
75 | local text = GuiLabel(0, 25, 450, 20, "Oluşturacağınız aracın bilgilerini doldurun.", false, editWindow)
76 | text.horizontalAlign = "center"
77 |
78 | gui.staticLbls[1] = GuiLabel(10,60,200,20,"araç markası:",false,editWindow)
79 | gui.edit["brand"] = GuiEdit(10, 80, 200, 40, "", false, editWindow)
80 | gui.staticLbls[2] = GuiLabel(10,60+(65),200,20,"araç modeli:",false,editWindow)
81 | gui.edit["model"] = GuiEdit(10, 80+(65), 200, 40, "", false, editWindow)
82 | gui.staticLbls[3] = GuiLabel(10,60+(65*2),200,20,"araç yılı:",false,editWindow)
83 | gui.edit["year"] = GuiEdit(10, 80+(65*2), 200, 40, "", false, editWindow)
84 | gui.staticLbls[4] = GuiLabel(10,60+(65*3),200,20,"kalan stok:",false,editWindow)
85 | gui.edit["stock"] = GuiEdit(10, 80+(65*3), 200, 40, "", false, editWindow)
86 |
87 | gui.staticLbls[5] = GuiLabel(240,60,200,20,"gta araç id",false,editWindow)
88 | gui.edit["gta"] = GuiEdit(240, 80, 200, 40, "", false, editWindow)
89 | gui.staticLbls[6] = GuiLabel(240,60+(65),200,20,"araç vergisi:",false,editWindow)
90 | gui.edit["tax"] = GuiEdit(240, 80+(65), 200, 40, "", false, editWindow)
91 | gui.staticLbls[7] = GuiLabel(240,60+(65*2),200,20,"araç fiyatı:",false,editWindow)
92 | gui.edit["price"] = GuiEdit(240, 80+(65*2), 200, 40, "", false, editWindow)
93 | gui.staticLbls[8] = GuiLabel(240,60+(65*3),200,20,"depo limiti:",false,editWindow)
94 | gui.edit["tanksize"] = GuiEdit(240, 80+(65*3), 200, 40, "", false, editWindow)
95 | gui.staticLbls[9] = GuiLabel(240,60+(65*4),200,20,"donate fiyatı:",false,editWindow)
96 | gui.edit["donateprice"] = GuiEdit(240, 80+(65*4), 200, 40, "0", false, editWindow)
97 | gui.staticLbls[9]:setVisible(false) gui.edit["donateprice"]:setVisible(false)
98 |
99 | gui.staticLbls[10] = GuiLabel(10,60+(65*4),200,20,"kapı tipi:",false,editWindow)
100 | gui.combos["doortype"] = GuiComboBox(10,80+(65*4),200,75,"Standart",false,editWindow)
101 | for i,v in ipairs({"Kelebek","Makas"}) do
102 | gui.combos["doortype"]:addItem(v)
103 | end
104 | gui.staticLbls[11] = GuiLabel(10,60+(62*5),200,20,"yakıt tipi:",false,editWindow)
105 | gui.combos["fueltype"] = GuiComboBox(10,80+(62*5),200,75,"Dizel",false,editWindow)
106 | for i,v in ipairs({"Benzin","LPG"}) do
107 | gui.combos["fueltype"]:addItem(v)
108 | end
109 |
110 | gui.check["enabled"] = GuiCheckBox(10,80+(58*6),200,20,"Galeriden satın alınabilsin mi?",true,false,editWindow)
111 | gui.check["isdonate"] = GuiCheckBox(10,80+(62*6),200,20,"Donate araç?",false,false,editWindow)
112 |
113 | -- carPrice = GuiEdit(15+245, 60+45, 175, 40, "araç fiyatı", false, editWindow)
114 | -- carTax = GuiEdit(15, 60+45*2, 175, 40, "araç vergisi", false, editWindow)
115 | -- carGta = GuiEdit(15+180, 60+45*2, 175, 40, "gta araç id", false, editWindow)
116 | -- carEnabled = GuiCheckBox(15,60+45*3,250,25,"Bu araba galeriden satın alınabilsin mi?",true,false,editWindow)
117 | saveE = GuiButton(450/2-200/2-52, pu-40, 150, 30, "Kaydet", false, editWindow)
118 | closeE = GuiButton(450/2-200/2+102, pu-40, 150, 30, "Arayüzü Kapat", false, editWindow)
119 |
120 | for i,v in pairs(gui.staticLbls) do
121 | v:setFont("default-bold-small")
122 | end
123 | for i,v in ipairs({"gta","year","stock","price","tax","tanksize","donateprice"}) do
124 | gui.edit[v]:setProperty("ValidationString", "[0-9]*")
125 | end
126 | end
127 |
128 | function closeAll()
129 | closeEdit()
130 | if isElement(window) then
131 | window:destroy()
132 | end
133 | dbid = nil
134 | end
135 |
136 | function closeEdit()
137 | if isElement(editWindow) then
138 | editWindow:destroy()
139 | end
140 | dbid = nil
141 | end
142 |
143 | addEventHandler("onClientGUIClick", resourceRoot, function()
144 | if source == editW then
145 | local selected = list:getSelectedItem()
146 | if selected < 0 then
147 | outputChatBox("Listeden bir araç seçmediniz.", 255, 25, 25)
148 | else
149 | local info = list:getItemData(selected,1)
150 | edit()
151 | for key,elm in pairs(gui.edit) do
152 | if info[key] then
153 | elm:setText(info[key] or "")
154 | end
155 | end
156 | dbid = info.id
157 | gui.combos["doortype"]:setSelected(info.doortype or -1)
158 | gui.combos["fueltype"]:setSelected(info.fueltype or -1)
159 | guiCheckBoxSetSelected(gui.check["enabled"],info.enabled == 1)
160 | guiCheckBoxSetSelected(gui.check["isdonate"],info.isdonate == 1)
161 | end
162 | elseif gui and source == gui.check["isdonate"] then
163 | local state = source:getSelected()
164 | gui.staticLbls[9]:setVisible(state) gui.edit["donateprice"]:setVisible(state)
165 | elseif source == handlingW then
166 | local selected = list:getSelectedItem()
167 | if selected < 0 then
168 | outputChatBox("Listeden bir araç seçmediniz.", 255, 25, 25)
169 | else
170 | local id = list:getItemData(selected,1).id
171 | triggerServerEvent("vehicle.library.handling", localPlayer, id)
172 | closeAll()
173 | end
174 | elseif source == addW then
175 | dbid = nil
176 | edit()
177 | elseif source == saveE then
178 | local info = {}
179 | for key,elm in pairs(gui.edit) do
180 | info[key] = elm.text
181 | end
182 | info["doortype"] = gui.combos["doortype"]:getSelected()
183 | info["fueltype"] = gui.combos["fueltype"]:getSelected()
184 | info["enabled"] = guiCheckBoxGetSelected(gui.check["enabled"]) and 1 or 0
185 | info["isdonate"] = guiCheckBoxGetSelected(gui.check["isdonate"]) and 1 or 0
186 | if validation("gta","year","stock","price","tax","tanksize","donateprice") then
187 | if dbid then
188 | triggerServerEvent("vehicle.library.edit", localPlayer, dbid,info)
189 | else
190 | triggerServerEvent("vehicle.library.create", localPlayer, info)
191 | end
192 | closeAll()
193 | end
194 | elseif source == closeW then
195 | closeAll()
196 | elseif source == closeE then
197 | closeEdit()
198 | end
199 | end)
200 |
201 | addEvent("vehicle.library", true)
202 | addEventHandler("vehicle.library", root, library)
203 |
204 |
205 | --edit()
--------------------------------------------------------------------------------
/resources/[in-game]/vehicleslibrary/editveh/client.lua:
--------------------------------------------------------------------------------
1 | local screen = Vector2(guiGetScreenSize())
2 |
3 | local local_info = {}
4 |
5 | function editVehWindowOpen(info)
6 | local_info = info
7 | if isElement(editVehWindow) then editVehWindow:destroy() end
8 |
9 | local pg,pu = 425,470
10 | local x,y = (screen.x-pg)/2,(screen.y-pu)/2
11 |
12 | editVehWindow = GuiWindow(x,y, pg,pu , "Araç Özellikleri - #"..(info.id), false)
13 | editVehWindow:setSizable(false)
14 |
15 | modelLbl = GuiLabel(10,25,200,20,"MTA Araç Modeli:",false,editVehWindow):setFont("default-bold-small")
16 | modelEdit = GuiEdit(10,25+20,200,30,info.mtamodel,false,editVehWindow) modelEdit:setProperty("ValidationString", "[0-9]*")
17 | modelEdit:setEnabled(false)
18 |
19 | markaLbl = GuiLabel(10,25+(55),200,20,"Marka:",false,editVehWindow):setFont("default-bold-small")
20 | markaEdit = GuiEdit(10,25+(75),200,30,info.brand,false,editVehWindow)
21 |
22 | modelLbl = GuiLabel(10,25+(55*2),200,20,"Model:",false,editVehWindow):setFont("default-bold-small")
23 | modelEdit = GuiEdit(10,25+(65*2),200,30,info.model,false,editVehWindow)
24 |
25 | yilLbl = GuiLabel(220,25,200,20,"Yıl:",false,editVehWindow):setFont("default-bold-small")
26 | yilEdit = GuiEdit(220,25+20,200,30,info.year,false,editVehWindow) yilEdit:setProperty("ValidationString", "[0-9]*")
27 |
28 | ucretLbl = GuiLabel(220,25+(55),200,20,"Ücret:",false,editVehWindow):setFont("default-bold-small")
29 | ucretEdit = GuiEdit(220,25+(75),200,30,info.price,false,editVehWindow) ucretEdit:setProperty("ValidationString", "[0-9]*")
30 |
31 | vergiLbl = GuiLabel(220,25+(55*2),200,20,"Vergi:",false,editVehWindow):setFont("default-bold-small")
32 | vergiEdit = GuiEdit(220,25+(65*2),200,30,info.tax,false,editVehWindow) vergiEdit:setProperty("ValidationString", "[0-9]*")
33 |
34 | depoLbl = GuiLabel(220,25+(55*3),200,20,"Depo Limiti:",false,editVehWindow):setFont("default-bold-small")
35 | depoEdit = GuiEdit(220,25+(62*3),200,30,info.tanksize,false,editVehWindow)
36 |
37 | doorTypeLbl = GuiLabel(10,25+(55*3),200,20,"Kapı Tipi:",false,editVehWindow):setFont("default-bold-small")
38 | doorTypeCombo = GuiComboBox(10,25+(60*3),200,75,"Standart",false,editVehWindow)
39 | for i,v in ipairs({"Kelebek","Makas"}) do
40 | doorTypeCombo:addItem(v)
41 | end
42 | doorTypeCombo:setSelected(info.doortype or -1)
43 |
44 | fuelTypeLbl = GuiLabel(10,25+(52*4),200,20,"Yakıt Tipi:",false,editVehWindow):setFont("default-bold-small")
45 | fuelTypeCombo = GuiComboBox(10,25+(56*4),200,75,"Dizel",false,editVehWindow)
46 | for i,v in ipairs({"Benzin","LPG"}) do
47 | fuelTypeCombo:addItem(v)
48 | end
49 | fuelTypeCombo:setSelected(info.fueltype or -1)
50 |
51 | notlarLbl = GuiLabel(10,pu-180,pg-20,20,"Notlar:",false,editVehWindow):setFont("default-bold-small")
52 | notlarMemo = GuiMemo(10,pu-160,pg-20,120,info.notes or "",false,editVehWindow)
53 |
54 |
55 | editVehSave = GuiButton(pg-100, pu-35, 100, 30, "Kaydet", false, editVehWindow)
56 | editVehClose = GuiButton(10, pu-35, 100, 30, "İptal", false, editVehWindow)
57 | editVehReset = GuiButton(10+105, pu-35, 100, 30, "Sıfırla", false, editVehWindow)
58 | editVehHandling = GuiButton(10+210, pu-35, 100, 30, "Özel Hand", false, editVehWindow)
59 | end
60 |
61 | function editVehWindowClose()
62 | if isElement(editVehWindow) then editVehWindow:destroy() end
63 | end
64 |
65 |
66 | -- NULL olan yerleri değiştirme.
67 | function checkText(s)
68 | return s:gsub(" ","") == "" and "NULL" or s
69 | end
70 |
71 | addEventHandler("onClientGUIClick", resourceRoot, function()
72 | if source == editVehClose then
73 | editVehWindowClose()
74 | elseif source == editVehSave then
75 | local info = {
76 | brand = checkText(markaEdit:getText()),
77 | model = checkText(modelEdit:getText()),
78 | year = tonumber(yilEdit:getText()) or "NULL",
79 | price = tonumber(ucretEdit:getText()) or "NULL",
80 | tax = tonumber(vergiEdit:getText()) or "NULL",
81 | notes = checkText(notlarMemo:getText()),
82 | doortype = doorTypeCombo:getSelected() == -1 and "NULL" or doorTypeCombo:getSelected(),
83 | fueltype = fuelTypeCombo:getSelected() == -1 and "NULL" or fuelTypeCombo:getSelected(),
84 | tanksize = checkText(depoEdit:getText())
85 | }
86 | triggerServerEvent("editveh.saveCustoms",resourceRoot,local_info.id,info)
87 | editVehWindowClose()
88 | elseif source == editVehReset then
89 | triggerServerEvent("editveh.resetCustoms",resourceRoot,local_info.id)
90 | editVehWindowClose()
91 | elseif source == editVehHandling then
92 | editVehWindowClose()
93 | triggerServerEvent("vehicle.library.handling",localPlayer,local_info.library_id,local_info.id)
94 | end
95 | end)
96 |
97 |
98 | addEvent("editveh.openwindow", true)
99 | addEventHandler("editveh.openwindow", root, editVehWindowOpen)
--------------------------------------------------------------------------------
/resources/[in-game]/vehicleslibrary/editveh/server.lua:
--------------------------------------------------------------------------------
1 | local mysql = exports.mysql
2 | local conn = mysql:getConn()
3 |
4 | local handling_test = {}
5 |
6 | addEvent("editveh.openwindow", true)
7 | addEvent("editveh.saveCustoms", true)
8 | addEvent("editveh.resetCustoms", true)
9 |
10 | addEventHandler("editveh.openwindow", root, function()
11 | local vehicle = source.vehicle
12 | if not isElement(vehicle) then
13 | source:outputChat("[!]#ffffff Lütfen bir araca bin.",255,0,0,true)
14 | return
15 | end
16 | local dbid = vehicle:getData("dbid")
17 | if not dbid then return end
18 | local info = vehicle:getData("info")
19 | info.id = dbid
20 | info.mtamodel = vehicle:getModel()
21 | info.price = vehicle:getData("carshop_price")
22 | info.tax = vehicle:getData("carshop_tax")
23 | triggerClientEvent(source,"editveh.openwindow",source,info)
24 | end)
25 |
26 | addEventHandler("editveh.saveCustoms",root,function(dbid,info)
27 | if exports.vehicles:isVehicleHasCustomRecord(dbid) then
28 | dbExec(conn,"UPDATE vehicles_custom SET brand=?,model=?,year=?,tax=?,notes=?,price=?,doortype=?,fueltype=?,tanksize=? WHERE id=?",info.brand,info.model,info.year,info.tax,info.notes,info.price,info.doortype,info.fueltype,info.tanksize,dbid)
29 | else
30 | dbExec(conn,"INSERT vehicles_custom SET brand=?,model=?,year=?,tax=?,notes=?,price=?,doortype=?,fueltype=?,tanksize=?,id=?",info.brand,info.model,info.year,info.tax,info.notes,info.price,info.doortype,info.fueltype,info.tanksize,dbid)
31 | end
32 | exports.vehicles:reloadVehicle(dbid)
33 | end)
34 | addEventHandler("editveh.resetCustoms",root,function(dbid)
35 | dbExec(conn,"DELETE from vehicles_custom WHERE id=?",dbid)
36 | exports.vehicles:reloadVehicle(dbid)
37 | end)
--------------------------------------------------------------------------------
/resources/[in-game]/vehicleslibrary/handling/client.lua:
--------------------------------------------------------------------------------
1 | local screen = Vector2(guiGetScreenSize())
2 | local options = {
3 | --// LİSTE ADI, MAKS. AYAR, REFERANS
4 | {"Azami Hız", 275, "maxVelocity"},
5 | {"Hızlanma", 75, "engineAcceleration"},
6 | {"Motor Ataleti", 30, "engineInertia"},
7 | {"Süspansiyon Yüksekliği", 0.1, "suspensionLowerLimit"},
8 | {"Süspansiyon Ön Arka Basıncı", 0.95, "suspensionFrontRearBias"},
9 | {"Süspansiyon Kuvvet Seviyesi", 0.2, "suspensionForceLevel"},
10 | {"Süspansiyon Sönümleme", 0.2, "suspensionDamping"},
11 | {"Direksiyon Kilidi", 55, "steeringLock"},
12 | {"Kütle Ağırlığı", 10000, "mass"},
13 | {"Sürükleme Katsayısı", 6, "dragCoeff"},
14 | {"Frenleme Gücü", 50, "brakeDeceleration"},
15 | {"Frenleme Basıncı", 1, "brakeBias"},
16 | {"Çekim Gücü Çarpanı", 6, "tractionMultiplier"},
17 | {"Çekim Gücü Basıncı", 1, "tractionBias"},
18 | }
19 |
20 | local dbid
21 | local max
22 | local option
23 | local validation = function(maximum, new)
24 | if tonumber(new) and tonumber(maximum) >= tonumber(new) then
25 | return true
26 | end
27 | outputChatBox("Lütfen araç özelliklerini düzgün bir şekilde doldurun!", 255, 25, 25)
28 | return false
29 | end
30 |
31 | function editorWindow(index, name, value)
32 | if isElement(editBox) then
33 | editBox:destroy()
34 | end
35 | max = options[index][2]
36 | option = tostring(options[index][3])
37 | editBox = GuiWindow(screen.x/2-325/2, screen.y/2-115/2, 325, 115, ""..name.." (MAKS: "..max..")", false)
38 | editBox:setSizable(false)
39 | newValue = GuiEdit(15, 30, 395, 30, value, false, editBox)
40 | saveEdit = GuiButton(325/2-150/2, 65, 150, 30, "Kaydet", false, editBox)
41 | end
42 |
43 | function select()
44 | local selected = handlingList:getSelectedItem()
45 | if selected >= 0 then
46 | local i = selected + 1
47 | local name = handlingList:getItemText(selected, 1)
48 | local value = handlingList:getItemText(selected, 2)
49 | local index = i
50 | editorWindow(index, name, value)
51 | end
52 | end
53 |
54 | function editWindow(id)
55 | dbid = id
56 | local veh = localPlayer.vehicle
57 | local currentHand = veh.handling
58 | if isElement(handlingWindow) then
59 | handlingWindow:destroy()
60 | end
61 | handlingWindow = GuiWindow(10, screen.y-460, 400, 450, "Araç Özellikleri ("..dbid..")", false)
62 | handlingWindow:setSizable(false)
63 | handlingList = GuiGridList(5, 25, 385, 370, false, handlingWindow)
64 | handlingList:setSortingEnabled(false)
65 | handlingName = handlingList:addColumn("Özellik", 0.70)
66 | handlingValue = handlingList:addColumn("Değer", 0.2)
67 | for _, value in ipairs(options) do
68 | local row = handlingList:addRow()
69 | handlingList:setItemText(row, handlingName, value[1], false, false)
70 | handlingList:setItemText(row, handlingValue, ""..tostring(currentHand[value[3]]).."", false, false)
71 | handlingList:setItemData(row, handlingValue, value[2])
72 | end
73 | handlingSave = GuiButton(45, 400, 150, 30, "Kaydet", false, handlingWindow)
74 | handlingClose = GuiButton(45+155, 400, 150, 30, "Arayüzü Kapat", false, handlingWindow)
75 | addEventHandler("onClientGUIDoubleClick", handlingList, select)
76 | end
77 |
78 | function refresh(opt)
79 | local veh = localPlayer.vehicle
80 | local currentHand = veh.handling
81 | local row = handlingList:getSelectedItem()
82 | handlingList:setItemText(row, handlingValue, ""..tostring(currentHand[opt]).."", false, false)
83 | end
84 |
85 | function closeEditorBox()
86 | max, option, dbid = nil, nil, nil
87 | if isElement(editBox) then
88 | editBox:destroy()
89 | end
90 | end
91 |
92 | function closeHandling()
93 | max, option, dbid = nil, nil, nil
94 | removeEventHandler("onClientGUIDoubleClick", handlingList, select)
95 | if isElement(editBox) then
96 | editBox:destroy()
97 | end
98 | if isElement(handlingWindow) then
99 | handlingWindow:destroy()
100 | end
101 | end
102 |
103 | addEventHandler("onClientGUIClick", resourceRoot, function()
104 | if source == handlingClose then
105 | closeHandling()
106 | triggerServerEvent("vehicle.library.handling.stop", localPlayer)
107 | elseif source == saveEdit then
108 | local getNewValue = newValue.text
109 | if max and option then
110 | if validation(max, getNewValue) then
111 | triggerServerEvent("vehicle.library.set.handling", localPlayer, tostring(option), tonumber(getNewValue))
112 | closeEditorBox()
113 | end
114 | else
115 | outputChatBox("Bir sorun oluştu, lütfen arayüzü yenileyin veya daha sonra tekrar deneyin.", 255, 25, 25)
116 | end
117 | elseif source == handlingSave then
118 | triggerServerEvent("vehicle.library.save", localPlayer, dbid)
119 | end
120 | end)
121 |
122 | addEventHandler("onClientVehicleExit", getRootElement(), function(player)
123 | if player == localPlayer then
124 | if player:getData("vehicle.library.test") then
125 | triggerServerEvent("vehicle.library.handling.stop", player, source)
126 | closeHandling()
127 | end
128 | end
129 | end)
130 |
131 | addEvent("vehicle.library.edt.handling", true)
132 | addEventHandler("vehicle.library.edt.handling", root, editWindow)
133 | addEvent("vehicle.library.refresh.handling", true)
134 | addEventHandler("vehicle.library.refresh.handling", root, refresh)
--------------------------------------------------------------------------------
/resources/[in-game]/vehicleslibrary/handling/server.lua:
--------------------------------------------------------------------------------
1 | local mysql = exports.mysql
2 | local conn = mysql:getConn()
3 |
4 | local handling_test = {}
5 |
6 | addEvent("vehicle.library.handling", true)
7 | addEventHandler("vehicle.library.handling", root, function(id,isEditVeh)
8 | dbQuery(
9 | function(qh, player,isEditVeh)
10 | local res, rows, _ = dbPoll(qh, 0)
11 | if rows > 0 then
12 | removePedFromVehicle(player)
13 | local x, y, z = player.position.x, player.position.y, player.position.z
14 | local int, dim = player.interior, player.dimension
15 | local newDim = math.random(1,100)
16 | local row = res[1]
17 | local testVeh = Vehicle(row.gta, 1428.71484375, -2593.26953125, 13.273954391479)
18 | local hand = isEditVeh and getVehicleHandling(getElementByID("vehicle"..isEditVeh)) or (fromJSON(row.handling or "[ [ ] ]") or {})
19 | for property,value in pairs(hand) do
20 | setVehicleHandling(testVeh,property,value)
21 | end
22 |
23 | testVeh:setDimension(newDim)
24 | player:setDimension(newDim)
25 | player:setData("vehicle.library.test", true)
26 | player.vehicle = testVeh
27 | handling_test[player] = {}
28 | handling_test[player].pos = {x, y, z, int, dim}
29 | handling_test[player].veh = testVeh
30 | handling_test[player].vehlib_id = row.id
31 | handling_test[player].isEditVeh = isEditVeh
32 |
33 | triggerClientEvent(player, "vehicle.library.edt.handling", player, id)
34 | else
35 | player:outputChat("[!]#ffffff Araç veri tabanına bulunamadı, lütfen daha sonra tekrar deneyin.", 111, 72, 201, true)
36 | end
37 | end,
38 | {source,isEditVeh}, conn, "SELECT gta,id,handling FROM vehicles_library WHERE id=?", id)
39 | end)
40 |
41 | addEvent("vehicle.library.handling.stop", true)
42 | addEventHandler("vehicle.library.handling.stop", root, function()
43 | local info = handling_test[source]
44 | if info then
45 | if isElement(info.veh) then info.veh:destroy() end
46 | source.vehicle=nil
47 | source:setPosition(info.pos[1], info.pos[2], info.pos[3])
48 | source:setInterior(info.pos[4])
49 | source:setDimension(info.pos[5])
50 | source:removeData("vehicle.library.test")
51 | handling_test[source] = nil
52 | end
53 | end)
54 | addEvent("vehicle.library.set.handling", true)
55 | addEventHandler("vehicle.library.set.handling", root, function(option, value)
56 | local info = handling_test[source]
57 | if isElement(info.veh) then
58 | setVehicleHandling(info.veh, tostring(option), tonumber(value))
59 | triggerClientEvent(source, "vehicle.library.refresh.handling", source, tostring(option))
60 | else
61 | source:outputChat("[!]#ffffff Değişiklikleri uygulamak için test aracında olmalısınız.", 111, 72, 201, true)
62 | end
63 | end)
64 |
65 | addEvent("vehicle.library.save", true)
66 | addEventHandler("vehicle.library.save", root, function(id)
67 | local info = handling_test[source]
68 | if isElement(info.veh) then
69 | local hand = getVehicleHandling(info.veh)
70 | if info.isEditVeh then
71 | if exports.vehicles:isVehicleHasCustomRecord(info.isEditVeh) then
72 | dbExec(conn,"UPDATE vehicles_custom SET handling=? WHERE id=?",toJSON(hand),info.isEditVeh)
73 | else
74 | dbExec(conn,"INSERT vehicles_custom SET handling=?,id=?",toJSON(hand),info.isEditVeh)
75 | end
76 | source:outputChat("[!]#ffffff Aracın handı veri tabanına başarılı bir şekilde kaydedildi.", 111, 72, 201, true)
77 | exports.vehicles:reloadVehicle(info.isEditVeh)
78 | return
79 | end
80 | local query = dbExec(conn, "UPDATE vehicles_library SET handling=? WHERE id=?",toJSON(hand), info.vehlib_id)
81 | if query then
82 | source:outputChat("[!]#ffffff Aracın handı veri tabanına başarılı bir şekilde kaydedildi.", 111, 72, 201, true)
83 | else
84 | source:outputChat("[!]#ffffff Aracın handı veri tabanına kayedilirken bir sorun oluştu.", 111, 72, 201, true)
85 | end
86 | end
87 | end)
--------------------------------------------------------------------------------
/resources/[in-game]/vehicleslibrary/meta.xml:
--------------------------------------------------------------------------------
1 |
2 | true
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/resources/[in-game]/vehicleslibrary/server.lua:
--------------------------------------------------------------------------------
1 | local conn = exports.mysql:getConn()
2 | local cache = exports.cache
3 |
4 |
5 | function getSqlText(t)
6 | local sql = ""
7 | for key,v in pairs(t) do
8 | sql = sql..key.."='"..(v).."',"
9 | end
10 | return sql:sub(1,-2)
11 | end
12 |
13 | addEvent("vehicle.library.edit", true)
14 | addEventHandler("vehicle.library.edit", root, function(id, info)
15 | local sql = getSqlText(info)
16 | local sql = sql..",updatedby='"..(cache:getAccountData(source,"id")).."',updatedate=current_timestamp()"
17 | local query = dbExec(conn, "UPDATE vehicles_library SET "..sql.." WHERE id=?", id)
18 |
19 | if query then
20 | source:outputChat("[!]#ffffff Araç veri tabanına başarılı bir şekilde kaydedildi.", 111, 72, 201, true)
21 | source:outputChat("[!]#ffffff Değişikler araçlara işlendi.", 111, 72, 201, true)
22 | for _, vehicle in ipairs(Element.getAllByType("vehicle")) do
23 | local vehInfo = vehicle:getData("info")
24 | if vehInfo then
25 | if vehInfo.library_id == id then
26 | local dbid = vehicle:getData("dbid")
27 | exports.vehicles:reloadVehicle(dbid)
28 | end
29 | end
30 | end
31 | else
32 | source:outputChat("[!]#ffffff Araç veri tabanına kayedilirken bir sorun oluştu.", 111, 72, 201, true)
33 | end
34 | end)
35 |
36 | addEvent("vehicle.library.create", true)
37 | addEventHandler("vehicle.library.create", root, function(info)
38 | local sql = getSqlText(info)
39 | local sql = sql..",updatedby='"..(cache:getAccountData(source,"id")).."',updatedate=current_timestamp()"
40 | local query = dbExec(conn, "INSERT INTO vehicles_library SET "..sql)
41 | if query then
42 | source:outputChat("[!]#ffffff Araç veri tabanına başarılı bir şekilde kaydedildi.", 111, 72, 201, true)
43 | else
44 | source:outputChat("[!]#ffffff Araç veri tabanına kayedilirken bir sorun oluştu.", 111, 72, 201, true)
45 | end
46 | end)
--------------------------------------------------------------------------------
/resources/launcher/meta.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 |
--------------------------------------------------------------------------------
/resources/launcher/resources.lua:
--------------------------------------------------------------------------------
1 | local launcher = {}
2 | launcher.__index = launcher
3 | local _print = outputDebugString
4 |
5 | function launcher:new(name, priority)
6 | local resource = {}
7 | setmetatable(resource, launcher)
8 | resource.name = name
9 | resource.priority = priority or 0
10 | return resource
11 | end
12 |
13 | -- Resource listesi
14 | local resources = {
15 | -- isim, sıra/öncelik
16 | launcher:new("mysql", 1),
17 | launcher:new("cache", 2),
18 | launcher:new("dxlibrary", 3),
19 | launcher:new("fonts", 4),
20 | launcher:new("global", 5),
21 | launcher:new("identity", 6),
22 | launcher:new("account", 7),
23 | launcher:new("items", 8),
24 | launcher:new("admins", 9),
25 | launcher:new("vehicleslibrary", 10),
26 | launcher:new("cursor", 11),
27 | launcher:new("living", 12),
28 | launcher:new("vehicles", 13),
29 | launcher:new("factions", 14),
30 | launcher:new("chat", 15),
31 | launcher:new("essantials", 16),
32 | }
33 |
34 | local loaded = 0
35 | local max = #resources
36 | local delay = 0
37 |
38 | addEventHandler ("onPlayerConnect", getRootElement(), function()
39 | if max ~= loaded then
40 | cancelEvent(true, "Tüm sistemler başlatılmamış, lütfen biraz bekleyin.")
41 | end
42 | end)
43 |
44 | function launcher:launch()
45 | setTimer(function()
46 | loaded = loaded + 1
47 | _print("Resource "..self.name.." started. "..loaded.."/"..max.."")
48 | Resource.getFromName(self.name):start()
49 | end, delay * 1000, 1)
50 | end
51 |
52 | table.sort(resources, function(a,b) return a.priority < b.priority end)
53 |
54 | for index, resource in ipairs(resources) do
55 | resource:launch()
56 | delay = delay + 2
57 | end
--------------------------------------------------------------------------------
/roleplay.sql:
--------------------------------------------------------------------------------
1 | /*
2 | Navicat MySQL Data Transfer
3 |
4 | Source Server : localsw
5 | Source Server Version : 50505
6 | Source Host : localhost:3306
7 | Source Database : roleplay
8 |
9 | Target Server Type : MYSQL
10 | Target Server Version : 50505
11 | File Encoding : 65001
12 |
13 | Date: 2023-06-15 05:44:02
14 | */
15 |
16 | SET FOREIGN_KEY_CHECKS=0;
17 | -- ----------------------------
18 | -- Table structure for `accounts`
19 | -- ----------------------------
20 | DROP TABLE IF EXISTS `accounts`;
21 | CREATE TABLE `accounts` (
22 | `id` int(11) NOT NULL,
23 | `name` text CHARACTER SET latin1 DEFAULT NULL,
24 | `password` text CHARACTER SET latin1 DEFAULT NULL,
25 | `admin` int(11) NOT NULL DEFAULT 0,
26 | `serial` text CHARACTER SET latin1 DEFAULT NULL,
27 | `limit` int(11) NOT NULL DEFAULT 3,
28 | `lastlogin` text DEFAULT NULL,
29 | PRIMARY KEY (`id`)
30 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
31 |
32 | -- ----------------------------
33 | -- Records of accounts
34 | -- ----------------------------
35 | INSERT INTO `accounts` VALUES ('0', null, null, '0', null, '3', '2023-06-15 04:51:13');
36 | INSERT INTO `accounts` VALUES ('1', 'test', 'test', '8', '9005638F97DC1640DD35331F4076AA12', '3', '2023-05-29 14:28:48');
37 |
38 | -- ----------------------------
39 | -- Table structure for `characters`
40 | -- ----------------------------
41 | DROP TABLE IF EXISTS `characters`;
42 | CREATE TABLE `characters` (
43 | `id` int(11) NOT NULL,
44 | `account` int(11) NOT NULL DEFAULT 0,
45 | `name` text CHARACTER SET latin1 DEFAULT NULL,
46 | `pos` varchar(255) NOT NULL DEFAULT '0,0,5,0,0',
47 | `age` int(11) NOT NULL DEFAULT 18,
48 | `height` int(11) NOT NULL DEFAULT 175,
49 | `weight` int(11) NOT NULL DEFAULT 65,
50 | `gender` int(1) NOT NULL DEFAULT 1,
51 | `model` int(11) NOT NULL DEFAULT 170,
52 | `money` bigint(11) NOT NULL DEFAULT 1000,
53 | `hunger` int(11) NOT NULL DEFAULT 100,
54 | `thirst` int(11) NOT NULL DEFAULT 100,
55 | `dead` int(1) NOT NULL DEFAULT 0,
56 | `health` int(11) NOT NULL DEFAULT 100,
57 | `armor` int(11) NOT NULL DEFAULT 0,
58 | `walk` int(11) NOT NULL DEFAULT 128,
59 | `job` int(11) NOT NULL DEFAULT 0,
60 | `active` int(1) NOT NULL DEFAULT 1,
61 | `injured` int(1) NOT NULL DEFAULT 0,
62 | `faction` int(11) NOT NULL DEFAULT 0,
63 | `faction_rank` int(11) NOT NULL DEFAULT 0,
64 | `faction_lead` int(11) NOT NULL DEFAULT 0,
65 | `lastlogin` text CHARACTER SET latin1 DEFAULT NULL,
66 | PRIMARY KEY (`id`)
67 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
68 |
69 | -- ----------------------------
70 | -- Records of characters
71 | -- ----------------------------
72 | INSERT INTO `characters` VALUES ('1', '1', 'test1', '0,0,5,0,0', '21', '175', '70', '2', '93', '1000', '61', '46', '0', '100', '0', '131', '0', '1', '0', '1', '1', '1', '2023-06-15 04:51:17');
73 | INSERT INTO `characters` VALUES ('2', '1', 'test2', '0,0,5,0,0', '18', '175', '65', '1', '170', '1000', '99', '97', '0', '100', '0', '128', '0', '1', '0', '1', '1', '0', '2023-05-29 15:24:24');
74 | INSERT INTO `characters` VALUES ('3', '1', 'test3', '0,0,5,0,0', '18', '175', '65', '1', '170', '1000', '100', '100', '0', '100', '0', '128', '0', '1', '0', '1', '1', '0', '2023-05-29 14:29:25');
75 | INSERT INTO `characters` VALUES ('4', '1', 'test4', '0,0,5,0,0', '18', '175', '65', '1', '170', '1000', '100', '100', '0', '100', '0', '128', '0', '1', '0', '1', '1', '0', '2023-05-29 14:29:25');
76 | INSERT INTO `characters` VALUES ('5', '1', 'test5', '0,0,5,0,0', '18', '175', '65', '1', '170', '1000', '100', '100', '0', '100', '0', '128', '0', '1', '0', '1', '1', '0', '2023-05-29 14:29:25');
77 | INSERT INTO `characters` VALUES ('6', '1', 'test6', '0,0,5,0,0', '18', '175', '65', '1', '170', '1000', '100', '100', '0', '100', '0', '128', '0', '1', '0', '1', '1', '0', '2023-05-29 14:29:25');
78 | INSERT INTO `characters` VALUES ('7', '1', 'test7', '0,0,5,0,0', '18', '175', '65', '1', '170', '1000', '100', '100', '0', '100', '0', '128', '0', '1', '0', '1', '1', '0', '2023-05-29 14:29:25');
79 | INSERT INTO `characters` VALUES ('8', '1', 'test8', '0,0,5,0,0', '18', '175', '65', '1', '170', '1000', '100', '100', '0', '100', '0', '128', '0', '1', '0', '1', '1', '0', '2023-05-29 14:29:25');
80 | INSERT INTO `characters` VALUES ('9', '1', 'test9', '0,0,5,0,0', '18', '175', '65', '1', '170', '1000', '100', '100', '0', '100', '0', '128', '0', '1', '0', '1', '1', '0', '2023-05-29 14:29:25');
81 | INSERT INTO `characters` VALUES ('10', '1', 'test10', '0,0,5,0,0', '18', '175', '65', '1', '170', '1000', '100', '100', '0', '100', '0', '128', '0', '1', '0', '1', '1', '0', '2023-05-29 14:29:25');
82 |
83 | -- ----------------------------
84 | -- Table structure for `factions`
85 | -- ----------------------------
86 | DROP TABLE IF EXISTS `factions`;
87 | CREATE TABLE `factions` (
88 | `id` int(11) NOT NULL,
89 | `name` text DEFAULT NULL,
90 | `type` int(3) NOT NULL DEFAULT 2,
91 | `balance` bigint(11) NOT NULL DEFAULT 0,
92 | `note` varchar(255) NOT NULL DEFAULT 'Sayfa 1 *> Sayfa 2 *> Sayfa 3',
93 | `level` int(11) NOT NULL DEFAULT 1,
94 | PRIMARY KEY (`id`)
95 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
96 |
97 | -- ----------------------------
98 | -- Records of factions
99 | -- ----------------------------
100 | INSERT INTO `factions` VALUES ('1', 'test faction', '2', '0', 'Sayfa 1 *> Sayfa 2 *> Sayfa 3', '1');
101 |
102 | -- ----------------------------
103 | -- Table structure for `factions_rank`
104 | -- ----------------------------
105 | DROP TABLE IF EXISTS `factions_rank`;
106 | CREATE TABLE `factions_rank` (
107 | `id` int(11) NOT NULL,
108 | `faction_id` int(11) DEFAULT NULL,
109 | `name` text DEFAULT NULL,
110 | `permissions` text DEFAULT NULL,
111 | PRIMARY KEY (`id`)
112 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
113 |
114 | -- ----------------------------
115 | -- Records of factions_rank
116 | -- ----------------------------
117 | INSERT INTO `factions_rank` VALUES ('0', '1', 'allah billah tillahaaaaaaaaaaaaaaaaaaa', 'manage_members,manage_payouts,manage_note,manage_ranks,manage_inventory');
118 | INSERT INTO `factions_rank` VALUES ('1', '1', 'testrank1', 'show_logs,manage_members');
119 | INSERT INTO `factions_rank` VALUES ('2', '1', 'testrank2', null);
120 | INSERT INTO `factions_rank` VALUES ('3', '1', 'testrank3', '');
121 | INSERT INTO `factions_rank` VALUES ('4', '1', 'testrank4', null);
122 | INSERT INTO `factions_rank` VALUES ('5', '1', 'testrank5', null);
123 | INSERT INTO `factions_rank` VALUES ('6', '1', 'testrank6', null);
124 | INSERT INTO `factions_rank` VALUES ('7', '1', 'testrank7', null);
125 | INSERT INTO `factions_rank` VALUES ('8', '1', 'testrank8', null);
126 | INSERT INTO `factions_rank` VALUES ('9', '1', 'testrank9', null);
127 | INSERT INTO `factions_rank` VALUES ('10', '1', 'testrank10', null);
128 | INSERT INTO `factions_rank` VALUES ('11', '1', 'testrank11', null);
129 |
130 | -- ----------------------------
131 | -- Table structure for `items`
132 | -- ----------------------------
133 | DROP TABLE IF EXISTS `items`;
134 | CREATE TABLE `items` (
135 | `id` bigint(11) NOT NULL,
136 | `type` int(11) DEFAULT NULL,
137 | `owner` bigint(11) DEFAULT NULL,
138 | `item` int(11) DEFAULT NULL,
139 | `value` text DEFAULT NULL,
140 | `count` int(11) DEFAULT NULL,
141 | PRIMARY KEY (`id`)
142 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
143 |
144 | -- ----------------------------
145 | -- Records of items
146 | -- ----------------------------
147 |
148 | -- ----------------------------
149 | -- Table structure for `vehicles`
150 | -- ----------------------------
151 | DROP TABLE IF EXISTS `vehicles`;
152 | CREATE TABLE `vehicles` (
153 | `id` int(11) NOT NULL,
154 | `library_id` int(11) DEFAULT NULL,
155 | `fuel` int(11) NOT NULL DEFAULT 100,
156 | `odometer` int(11) DEFAULT NULL,
157 | `tax` int(11) NOT NULL DEFAULT 0,
158 | `job` int(11) DEFAULT NULL,
159 | `pos` varchar(255) NOT NULL DEFAULT '0,0,5,0,0,0,0,90',
160 | `plate` text DEFAULT NULL,
161 | `color` varchar(255) NOT NULL DEFAULT '0,0,0',
162 | `upgrades` text DEFAULT NULL,
163 | `lock` int(11) NOT NULL DEFAULT 1,
164 | `interest` int(11) NOT NULL DEFAULT 0,
165 | `owner` int(11) DEFAULT NULL,
166 | `faction` int(11) DEFAULT NULL,
167 | `engine` int(11) NOT NULL DEFAULT 0,
168 | `enabled` int(1) NOT NULL DEFAULT 1,
169 | PRIMARY KEY (`id`)
170 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
171 |
172 | -- ----------------------------
173 | -- Records of vehicles
174 | -- ----------------------------
175 | INSERT INTO `vehicles` VALUES ('1', '1', '100', '0', '48', '0', '4.9999999942551,0.35570843449802,3.1171875,0,0,0,0,0.00274658203125', 'PMJ-987', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
176 | INSERT INTO `vehicles` VALUES ('2', '1', '100', '0', '48', '0', '6.6486714232676,3.445235757417,3.1171875,0,0,0,0,337.79354858398', 'EWS-531', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
177 | INSERT INTO `vehicles` VALUES ('3', '1', '100', '0', '48', '0', '8.2463276732676,7.359298257417,3.1096496582031,0,0,0,0,337.79354858398', 'CJD-295', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
178 | INSERT INTO `vehicles` VALUES ('4', '1', '100', '0', '48', '0', '10.021718298268,11.708907632417,3.1171875,0,0,0,0,337.79354858398', 'DAA-456', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
179 | INSERT INTO `vehicles` VALUES ('5', '1', '100', '0', '48', '0', '11.411366735768,15.111251382417,3.1171875,0,0,0,0,337.79354858398', 'PPE-654', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
180 | INSERT INTO `vehicles` VALUES ('6', '1', '100', '0', '48', '0', '12.856679235768,18.652267007417,3.1171875,0,0,0,0,337.79354858398', 'BPU-853', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
181 | INSERT INTO `vehicles` VALUES ('7', '1', '100', '0', '48', '0', '13.531483923268,20.306563882417,3.1171875,0,0,0,0,337.79354858398', 'WSY-952', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
182 | INSERT INTO `vehicles` VALUES ('8', '1', '100', '0', '48', '0', '14.593007360768,22.904220132417,3.1171875,0,0,0,0,337.79354858398', 'MGW-288', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
183 | INSERT INTO `vehicles` VALUES ('9', '1', '100', '0', '48', '0', '15.450429235768,25.005782632417,3.1171875,0,0,0,0,337.79354858398', 'ZZP-433', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
184 | INSERT INTO `vehicles` VALUES ('10', '1', '100', '0', '48', '0', '16.462147985768,27.483321694917,3.1171875,0,0,0,0,337.79354858398', 'VAJ-171', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
185 | INSERT INTO `vehicles` VALUES ('11', '1', '100', '0', '48', '0', '17.124257360768,29.104415444917,3.1171875,0,0,0,0,337.79354858398', 'AXH-367', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
186 | INSERT INTO `vehicles` VALUES ('12', '1', '100', '0', '48', '0', '17.943593298268,31.112227944917,3.1171875,0,0,0,0,337.79354858398', 'VSM-275', '0,0,0', 'false', '1', '0', '1', '1', '0', '1');
187 |
188 | -- ----------------------------
189 | -- Table structure for `vehicles_custom`
190 | -- ----------------------------
191 | DROP TABLE IF EXISTS `vehicles_custom`;
192 | CREATE TABLE `vehicles_custom` (
193 | `id` int(11) NOT NULL,
194 | `brand` text DEFAULT NULL,
195 | `model` text DEFAULT NULL,
196 | `year` int(11) DEFAULT NULL,
197 | `tax` int(11) DEFAULT NULL,
198 | `handling` text DEFAULT NULL,
199 | `notes` text DEFAULT NULL,
200 | `price` int(11) DEFAULT NULL,
201 | `doortype` int(11) DEFAULT NULL,
202 | `fueltype` int(11) DEFAULT NULL,
203 | `tanksize` int(11) DEFAULT NULL,
204 | PRIMARY KEY (`id`)
205 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
206 |
207 | -- ----------------------------
208 | -- Records of vehicles_custom
209 | -- ----------------------------
210 |
211 | -- ----------------------------
212 | -- Table structure for `vehicles_library`
213 | -- ----------------------------
214 | DROP TABLE IF EXISTS `vehicles_library`;
215 | CREATE TABLE `vehicles_library` (
216 | `id` int(11) NOT NULL AUTO_INCREMENT,
217 | `gta` int(11) DEFAULT NULL,
218 | `brand` text DEFAULT NULL,
219 | `model` text DEFAULT NULL,
220 | `year` text DEFAULT NULL,
221 | `price` int(11) DEFAULT NULL,
222 | `tax` int(11) DEFAULT NULL,
223 | `enabled` int(11) DEFAULT NULL,
224 | `handling` varchar(1000) DEFAULT '',
225 | `stock` int(11) DEFAULT NULL,
226 | `tanksize` int(11) DEFAULT NULL,
227 | `donateprice` int(11) DEFAULT NULL,
228 | `doortype` int(11) DEFAULT NULL,
229 | `fueltype` int(11) DEFAULT NULL,
230 | `isdonate` int(11) DEFAULT NULL,
231 | `updatedby` int(11) DEFAULT NULL,
232 | `updatedate` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
233 | PRIMARY KEY (`id`)
234 | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
235 |
236 | -- ----------------------------
237 | -- Records of vehicles_library
238 | -- ----------------------------
239 | INSERT INTO `vehicles_library` VALUES ('1', '560', 'test', 'car', '2022', '25000', '12', '1', '', '100', '100', '0', '-1', '-1', '0', '1', '2023-05-10 00:52:38');
240 | INSERT INTO `vehicles_library` VALUES ('2', '555', 'test2', 'test car', '2001', '10000', '31', '1', '', null, null, null, null, null, null, null, null);
241 | INSERT INTO `vehicles_library` VALUES ('3', '554', 'araç markası', 'araç modeli', '2000', '155', '1111', '0', '', null, null, null, null, null, null, null, '2023-05-10 00:55:29');
242 | INSERT INTO `vehicles_library` VALUES ('4', '553', 'test marka', 'test model', '2012', '15000000', '555', '0', '', '55', '80', '50', '0', '1', '1', '1', '2023-05-10 00:55:27');
243 | INSERT INTO `vehicles_library` VALUES ('5', '552', 'test marka2', 'test model2', '2001', '654897', '1500', '1', '', '85', '100', '0', '-1', '0', '0', '1', '2023-05-10 00:51:43');
244 |
--------------------------------------------------------------------------------