Wysłany: 2018-06-25, 15:34
Kulegg
Wiek: 46 Na forum: 3125 dni Posty: 283
Piwa : 20
Witam, pisa?em niedawno do was z tym ?e komenda /jail nie dzia?a, teraz dzia?a, lecz jak si? ja wpisze to wyskakuje komunikat poprawnie, ?e dany gracz zosta? uwi?ziony, ale nie wi?zi go, czyli nie teleportuje si? on w dane miejsce
Wysłany: 2018-06-25, 15:37
PatryKK.
Emeryt LUA
Wiek: 26 Na forum: 3061 dni Posty: 1060
Nick w MP: PatryKK.
Piwa : 2322
Poprosz? o kod.
Podpis
GG:75080675
- ✔
- ✔
- ✔
- ✔
Aktualny projekt: BRAK
Wysłany: 2018-06-25, 15:43
Kulegg
Wiek: 46 Na forum: 3125 dni Posty: 283
Piwa : 20
local cub = createColCuboid (- 2462.43 , 3734.53 , 300.57 - 1 , 19 , 15 , 4 )
function u ( e )
getElementData ( e , "dbid" )
end
local cele = { -- x , y , z , int , dim
{ 3156.19 , - 2004.87 , 11.07 , 0 , 0 },
{ 3144.99 , - 2074.52 , 11.07 , 0 , 0 },
{ 3106.63 , - 2066.91 , 11.07 , 0 , 0 },
{ 3109.98 , - 2064.55 , 11.07 , 0 , 0 },
}
local x , y , z = 2845.92 , - 1878.57 , 11.10
local function wypusc ( plr )
setElementDimension ( plr , 0 )
setElementInterior ( plr , 0 )
setElementPosition ( plr , x , y , z )
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 , "dbid" ) then return end
local x = exports . mysql : wykonaj ( "SELECT * FROM jail WHERE Serial=?" , getPlayerSerial ( plr ))
if not x or #x < 1 then return end
local x2 = exports . mysql : wykonaj ( "SELECT Termin FROM jail WHERE Serial=? and Termin < NOW()" , getPlayerSerial ( plr ))
if x2 and #x2 > 0 then
exports . mysql : wykonaj ( "DELETE FROM jail 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 , "dbid" ) then return end
local x = exports . mysql : wykonaj ( "SELECT * FROM jail WHERE Serial=?" , getPlayerSerial ( plr ))
if not x or #x < 1 then return end
local x2 = exports . mysql : wykonaj ( "SELECT Termin FROM jail WHERE Serial=? and Termin < NOW()" , getPlayerSerial ( plr ))
if x2 and #x2 > 0 then
exports . mysql : wykonaj ( "DELETE FROM jail WHERE Serial=?" , getPlayerSerial ( plr ))
wypusc ( plr )
return end
outputChatBox ( "Jeste? uwi?ziony w wi?zieniu do: #ff000" .. x [ 1 ]. Termin .. " #ffffffza: #ff0000" .. x [ 1 ]. Powod .. "" , plr , 255 , 255 , 255 , true )
end
function ajotceju ( plr , cmd , target , ile , typ , zaco )
if getElementData ( plr , "player:faction" )== "SAPD" then
if not target 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 osoba = findPlayer ( plr , target )
if not osoba then
outputChatBox ( "Nie znaleziono podanego gracza." , plr , 255 , 255 , 255 )
return
end
x1 , x2 , x3 = getElementPosition ( plr )
y1 , y2 , y3 = getElementPosition ( osoba )
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 . mysql : wykonaj ( "INSERT INTO jail (Serial,Termin,Cela,Powod) VALUES (?,NOW() + INTERVAL ?? minute,??,?)" , getPlayerSerial ( osoba ), ile , cela , zaco )
outputChatBox ( "Zosta?e? uwi?ziony w wi?zieniu przez #ff0000" .. getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. " #ffffffza #ff0000" .. zaco .. " #ffffffna #ff0000" .. ile .. "#ffffff minut(-a/-y)" , osoba , 255 , 255 , 255 )
outputChatBox ( "Uwi?ziono gracza " .. getPlayerName ( osoba ): 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 . mysql : wykonaj ( "INSERT INTO jail (Serial,Termin,Cela,Powod) VALUES (?,NOW() + INTERVAL ?? hour,??,?)" , getPlayerSerial ( osoba ), ile , cela , zaco )
outputChatBox ( "Zosta?e? uwi?ziony w wi?zieniu przez #ff0000" .. getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. " #ffffffza #ff0000" .. zaco .. " #ffffffna #ff0000" .. ile .. "#ffffff godzin(a/y)" , osoba , 255 , 255 , 255 )
outputChatBox ( "Uwi?ziono gracza " .. getPlayerName ( osoba ): 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 , target )
if getElementData ( plr , "player:faction" )== "SAPD" then
local osoba = findPlayer ( plr , target )
if not osoba then
outputChatBox ( "Nie znaleziono podanego gracza." , plr , 255 , 255 , 255 )
return
end
local jebnijsie = exports . mysql : wykonaj ( "SELECT Termin FROM jail WHERE Serial=? and Termin > NOW()" , getPlayerSerial ( osoba ))
if jebnijsie and #jebnijsie <= 0 then outputChatBox("Ten gracz nie jest w wi?zieniu! ("..getPlayerName(osoba)..")", plr,255,255,255) return end
exports . mysql : wykonaj ( "DELETE FROM jail WHERE Serial=?" , getPlayerSerial ( osoba ))
outputChatBox ( "Gracz zosta? uwolniony z wi?zienia." , plr , 255 , 255 , 255 )
sprawdz ( osoba )
wypusc ( osoba )
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 . mysql : wykonaj ( "SELECT Termin FROM jail WHERE Serial=? and Termin > NOW()" , getPlayerSerial ( source ))
if x and #x <= 0 then return end
sprawdzczas ( source )
end
addEventHandler ( "onPlayerSpawn" , getRootElement (), spawn )
function findPlayer ( plr , cel )
local target = nil
if ( tonumber ( cel ) ~= nil ) then
target = getElementByID ( "p" .. cel )
else
for _ , thePlayer in ipairs ( getElementsByType ( "player" )) do
if string . find ( string . gsub ( getPlayerName ( thePlayer ): lower (), "#%x%x%x%x%x%x" , "" ), cel : lower (), 1 , true ) then
if ( target ) then
outputChatBox ( "Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter." , plr )
return nil
end
target = thePlayer
end
end
end
return target
end
[ Dodano : 2018-06-26, 23:29 ]
Witam, nadal nie rozwi?za?em problemu z jail i nikt si? nie wypowiada wi?c pisze jeszcze raz, gdy? TERAZ Znalaz?em w debug script 3 b??dy co do tego jaila: Pisze tak:
WARNING : [ skrypty ]/ pystories - db / s_db . lua : 18 : dbPoll failed ; Table 'db_34294.saj' doesn 't exist
A oto Osiemnasta linijka tego kodu:
local result = dbPoll ( query , - 1 )
A oto ca?y kod:
-- Settings
DBHandler = nil
DBName = "db_34294"
DBUser = "db_34294"
DBPass = "ppp2bxyj"
DBHost = "137.74.0.12"
-- Functions
function dbSet (...)
if not {...} then return end
local query = dbExec ( DBHandler , ...)
return query
end
function dbGet (...)
if not {...} then return end
local query = dbQuery ( DBHandler , ...)
local result = dbPoll ( query , - 1 )
return result
end
addEventHandler ( "onResourceStart" , resourceRoot , function()
DBHandler = dbConnect ( "mysql" , "dbname=" .. DBName .. ";host=" .. DBHost .. "" , DBUser , DBPass , "share=1" )
if DBHandler then
outputDebugString ( "* Connect to server MYSQL..." )
else
outputDebugString ( "* No Connecting to server MYSQL.." )
end
end )
Tagi: nie :: działa :: jail :: nie :: teleportują :: się :: tam :: więźniowie
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: