Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-04-10, 15:57


DamianekPL32006







Wiek: 26
Na forum: 2893 dni
Posty: 33
Nick w MP: DamianekPL32006



Respekt: 50

Witam, mam problem poniewa? nie tepa gracza do jaila po wpisaniu /jail ID CZAS m/h POWOD

Ale po wpisaniu /unjail ID tepa gracza pod komende i ze jest wypuszczony

Pisze tylko na czacie ze jest w wiezieniu. Zero b??d?w w DB3.
Mo?e kto? to zmieni? aby dzia?a?o? Dam piwerko


Kod:

local cub = createColCuboid(1336.20, -1081.96, -60.85, 20, 20.75, 12.5)

function u(e)
getElementData(e, "player:sid")
end

local cele = { -- x,y,z,int,dim
{1323.62, -1093.68, -60.85,0,0},
{1336.14, -1096.00, -60.85,0,0},
{1347.56, -1094.26, -60.85,0,0},
{1345.27, -1072.97, -60.85,0,0},
}
local x,y,z = 1541.32, -1675.48, 13.55
local m=createElement("text")
setElementData(m, "name", "/jail\n/unjail\n(dla SAPD)")
setElementData(m, "scale", 1.3)
setElementPosition(m, 1467.00, 1189.99, 129.45)

local function wypusc(plr)
setElementDimension(plr,1)
setElementInterior(plr,0)
setElementPosition(plr,1467.00, 1189.99, 129.45)
outputChatBox("Zosta?e? wypuszczony z wi?zienia.",plr, 255, 255, 255)
end

function getPlayerName2(plr)
if not plr then return end
return getPlayerName(plr):gsub("#%x%x%x%x%x%x","")
end

local function sprawdz(plr)
if not plr then return end
if not getElementData(plr,"player:sid") then return end
local x = exports['pystories-db']:dbGet("SELECT * FROM saj WHERE Serial=?",getPlayerSerial(plr))
if not x or #x < 1 then return end
local x2=exports['pystories-db']:dbGet("SELECT Termin FROM saj WHERE Serial=? and Termin < NOW()",getPlayerSerial(plr))
if x2 and #x2 > 0 then
exports['pystories-db']:dbSet("DELETE FROM saj WHERE Serial=?", getPlayerSerial(plr))
wypusc(plr)
return end
if isElementWithinColShape(plr,cub) then return end
setElementPosition(plr,cele[x[1].Cela][1],cele[x[1].Cela][2],cele[x[1].Cela][3])
setElementDimension(plr, 0)
end

local function sprawdzczas(plr)
if not plr then return end
if not getElementData(plr,"player:sid") then return end
local x = exports['pystories-db']:dbGet("SELECT * FROM saj WHERE Serial=?",getPlayerSerial(plr))
if not x or #x < 1 then return end
local x2=exports['pystories-db']:dbGet("SELECT Termin FROM saj WHERE Serial=? and Termin < NOW()",getPlayerSerial(plr))
if x2 and #x2 > 0 then
exports['pystories-db']:dbSet("DELETE FROM saj WHERE Serial=?", getPlayerSerial(plr))
wypusc(plr)
return end
outputChatBox("Jeste? uwi?ziony w wi?zieniu do: "..x[1].Termin.." za: "..x[1].Powod.."", plr, 255, 255, 255)
end

function ajotceju(plr,cmd,cel,ile,typ,zaco)
if getElementData(plr, "player:duty")=="SAPD" then
if not cel or not ile or not typ or not zaco then
outputChatBox("U?ycie: /jail <gracz/ID> <czas> <m/h> <pow?d>", plr, 255, 255, 255)
return
end
local target=exports["pystories-core"]:findPlayer(plr,cel)
if not target then
outputChatBox("Nie znaleziono podanego gracza.", plr, 255, 255, 255)
return
end
x1,x2,x3 = getElementPosition(plr)
y1,y2,y3 = getElementPosition(target)
dystans = getDistanceBetweenPoints3D(x1,x2,x3,y1,y2,y3)
if dystans > 20.0 then outputChatBox("Ten gracz jest za daleko!", plr, 255, 255, 255) return end
local cela=math.random(1, #cele)
if typ=="m" or typ=="h" then
if typ=="m"then
exports["pystories-db"]:dbSet("INSERT INTO saj (Serial,Termin,Cela,Powod) VALUES (?,NOW() + INTERVAL ?? minute,??,?)", getPlayerSerial(target), ile,cela, zaco)
outputChatBox("Zosta?e? uwi?ziony w wi?zieniu przez "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." za "..zaco.." na "..ile.." minut(-a/-y)", target, 255, 255, 255)
outputChatBox("Uwi?ziono gracza "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." w wi?zieniu za "..zaco.." na "..ile.." minut(-a/-y)", plr, 255, 255, 255)
sprawdz(plr)
end
if typ=="h" then
exports["pystories-db"]:dbSet("INSERT INTO saj (Serial,Termin,Cela,Powod) VALUES (?,NOW() + INTERVAL ?? hour,??,?)", getPlayerSerial(target), ile,cela, zaco)
outputChatBox("Zosta?e? uwi?ziony w wi?zieniu przez "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","").." za "..zaco.." na "..ile.." godzin(-a/-y)", target, 255, 255, 255)
outputChatBox("Uwi?ziono gracza "..getPlayerName(target):gsub("#%x%x%x%x%x%x","").." w wi?zieniu za "..zaco.." na "..ile.." godzin(-a/-y)", plr, 255, 255, 255)
sprawdz(plr)
end
end
sprawdz(plr)
cela=math.random(1, #cele)
sprawdzczas(plr)
end
end
addCommandHandler("jail", ajotceju)

function unaj(plr,cmd,cel)
if getElementData(plr, "player:duty")=="SAPD" then
local target=exports["pystories-core"]:findPlayer(plr,cel)
if not target then
outputChatBox("Nie znaleziono podanego gracza.", plr, 255, 255, 255)
return
end
local jebnijsie=exports['pystories-db']:dbGet("SELECT Termin FROM saj WHERE Serial=? and Termin > NOW()",getPlayerSerial(target))
if jebnijsie and #jebnijsie <= 0 then outputChatBox("Ten gracz nie jest w wi?zieniu! ("..getPlayerName(target)..")", plr,255,255,255) return end
exports['pystories-db']:dbSet("DELETE FROM saj WHERE Serial=?", getPlayerSerial(target))
outputChatBox("Gracz zosta? uwolniony z wi?zienia.", plr, 255, 255, 255)
sprawdz(target)
wypusc(target)
end
end
addCommandHandler("unjail", unaj)

setTimer(function()
for _,p in pairs(getElementsByType("player")) do
sprawdz(p)
end
end,5000,0)

function spawn()
local x=exports['pystories-db']:dbGet("SELECT Termin FROM saj WHERE Serial=? and Termin > NOW()",getPlayerSerial(source))
if x and #x <= 0 then return end
sprawdzczas(source)
end
addEventHandler("onPlayerSpawn", getRootElement(), spawn)


Postaw piwo autorowi tego posta
 

 
Tagi: nie :: tepa :: jaila
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Nie tepa do jaila Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku