Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix set coords for admin
Browse files Browse the repository at this point in the history
  • Loading branch information
yeganehha committed Jan 25, 2021
1 parent 006d288 commit 82c1ec9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/admin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ AddEventHandler('Erfan:gang:creatNewGang', function(gangName)
if IsPlayerAceAllowed(_Source, "gang.admin") then
executeOnDB('INSERT INTO `gangs` (`gangName`,`expireTime`,`coords`,`inventory`) VALUES (@gangName,NOW(),"{}","{}")', { ['@gangName'] = gangName } , function(e)
local gangs = selectFromDB("SELECT * , DATE_FORMAT(expireTime, '%Y/%m/%d') as expireTimeFormat FROM gangs", {})
print(json.encode(gangs))
print(json.encode(gangs[#gangs]))
print(json.encode(gangs[#gangs].id))
executeOnDB('INSERT INTO `gangs_grade` (`gangId`,`grade`,`name`,`salary`,`maleSkin`,`femaleSkin`) VALUES (@gangId,0,"boss","100","{}","{}")', {
['@gangId'] = gangs[#gangs].id
} , function(e)end)
Expand Down Expand Up @@ -91,6 +88,10 @@ AddEventHandler('Erfan:gang:updateGangcoords', function(gangId , variable , valu
local gang = selectFromDB("SELECT * , DATE_FORMAT(expireTime, '%Y/%m/%d') as expireTimeFormat FROM gangs WHERE id = @gangId", { ['@gangId'] = gangId })
if gang ~= nil and gang[1] ~= nil and gang[1].id == gangId then
local coords = json.decode(gang[1].coords)
if type(value) == 'vector3' then
local x1,y1,z1 = table.unpack(value)
value = { x = x1 , y =y1 , z = z1 }
end
coords[variable] = value
local coordsStr = json.encode(coords)
gang[1].coords = coordsStr
Expand Down

0 comments on commit 82c1ec9

Please sign in to comment.