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

Wysłany: 2020-07-11, 20:43


ItzWhitee







Wiek: 27
Na forum: 2224 dni
Posty: 8
Nick w MP: ItzWhitee



Respekt: 50

Witam, nie wiem czy pisze to w dobrym dziale, najwy?ej mi to przeniesiecie.
Mam ma?y problem, mianowicie chodzi o to ?e od d?u?szego czasu nie mog? znale?? odpowiedzi na moj problem dot. Komendy /tpev.set itp itp. Podpi??em baz? danych pod skrypt, tzn z pystories-db zrobilem DB3 i zamiast from pystories-admins dalem nazwe swojego skryptu na system admina i dalej mi nie dzia?a. Podsy?am ca?y kod, mo?e co? ?le zrobi?em.

debugscript - WARNING: [mysql]/DB3/s_db.lua:18 dbPoll failed; Table 'DB_56991.admins' doesn't exist

Kod:

[size=9][ [i][b]Dodano[/b]: 2020-07-11, 20:44[/i] ][/size]
--[[
@ Autor: Frixen
@ Skrypt zosta?‚ zrobiony na serwer: Itz-RPG
]]

local istp = {
state = false,
posx = 0,
posy = 0,
posz = 0,
int = 0,
dim = 0,
}

function getAdmin(plr,level)
if level then
local result=exports["DB3"]:dbGet("SELECT * from admins WHERE serial=? AND level=?", getPlayerSerial(plr), level)
if result and #result > 0 then
return true
else
return false
end
else
local result=exports["DB3"]:dbGet("SELECT * from admins WHERE serial=?", getPlayerSerial(plr))
if result and #result > 0 then
return true
else
return false
end
end
end

function setTp(player)
if not player then return end
if not getElementData(player, "player:admin") then return end
if getAdmin(player) then
if not istp.state == false then return outputChatBox("??” Ten teleport jest juz ustawiony!", player, 255, 0, 0) end
local x, y, z = getElementPosition(player)
local int = getElementInterior(player)
local dim = getElementDimension(player)
istp.state = true
istp.posx = x
istp.posy = y
istp.posz = z
istp.int = int
istp.dim = dim
outputChatBox("* Ustawiono teleport!", player, 255, 0, 0)
local q = string.format("[TPEV] ["..getElementData(player,"id").."]"..getPlayerName(player).." ustawil tpev!")
triggerEvent("admin:addText", resourceRoot, q:gsub("#%x%x%x%x%x%x",""))
end
end
addCommandHandler("tpev.set", setTp)

function delTp(player)
if not player then return end
if not getElementData(player, "player:admin") then return end
if getAdmin(player) then
if istp.state == true then
istp.state = false
istp.posx = 0
istp.posy = 0
istp.posz = 0
istp.int = 0
istp.dim = 0
outputChatBox("??” Usunieto teleport!", player, 255, 0, 0)
local q = string.format("[TPEV] ["..getElementData(player,"id").."]"..getPlayerName(player).." usunal tpev!")
triggerEvent("admin:addText", resourceRoot, q:gsub("#%x%x%x%x%x%x",""))
else
outputChatBox("??– Ten teleport nie jest ustawiony!", player, 255, 0, 0)
end
end
end
addCommandHandler("tpev.del", delTp)

function tpTp(player)
if not player then return end
if not getElementType(player) == "player" then return end
if isPedInVehicle(player) then return outputChatBox("* Wyjdz z pojazdu!", player, 255, 0, 0) end
if not getElementData(player, "player:sid") then return end
if istp.state == true then
setElementPosition(player, istp.posx, istp.posy, istp.posz)
setElementInterior(player, istp.int)
setElementDimension(player, istp.dim)
local q = string.format("[TPEV] ["..getElementData(player,"id").."]"..getPlayerName(player).." teleportowal sie na tpev!")
triggerEvent("admin:addText", resourceRoot, q:gsub("#%x%x%x%x%x%x",""))
else
outputChatBox("Ten teleport nie jest ustawiony!", player, 255, 0, 0)
end
end
addCommandHandler("tpev", tpTp)
[code][/code]
[code][/code]

[ Dodano: 2020-07-11, 20:56 ]
Juz sobie poradzilem ale jest jeszcze jeden problem, jak ustawiam teleporta to potem sie do niego nie moge tepnac.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-11, 21:25


PatryKK.

Emeryt LUA






Wiek: 26
Na forum: 3061 dni
Posty: 1060
Nick w MP: PatryKK.

Piwa: 2322

Respekt: 331,5
Respekt: 331,5Respekt: 331,5Respekt: 331,5

B??dy db3?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-11, 23:39


ItzWhitee







Wiek: 27
Na forum: 2224 dni
Posty: 8
Nick w MP: ItzWhitee



Respekt: 50

Tak jak w edicie
Juz sobie poradzilem ale jest jeszcze jeden problem, jak ustawiam teleporta to potem nie moge sie tepnac w dane miejsce.

W debug scripcie tym razem nic mi nie pokazuje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-12, 02:41


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Na przysz?o??, mo?liwe, ?e wpisa?e? b?edne dane do mysql :P

Dodaj po kolei w funkcji na tepanie, w ka?dej linijce np

outputChatBox("test",player)

Sprawdzisz w kt?rej linijce kod si? zatrzymuje i daj zna?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-12, 14:09


ItzWhitee







Wiek: 27
Na forum: 2224 dni
Posty: 8
Nick w MP: ItzWhitee



Respekt: 50

Doda?em ow? linijk? i po zrestartowaniu skryptu wyskakuje mi co? takiego -

test
* Ustawiono teleport!

tepac dalej si? nie mog?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-12, 14:50


VVirmex

Sgrypter luja






Wiek: 21
Na forum: 3365 dni
Posty: 281
Nick w MP: AxyZ

Piwa: 234

Respekt: 110
Respekt: 110

A jeste? pewien ?e ka?da funkcja jest dobrze przypisana do teleportu?
(np.:)


-- "el" jako admin
addCommandHandler("makeev", function(elcmd)
   if {bla bla bla...} then
       coordinates getElementPositon(el) --tutaj!
   end
end


-- "el" jako gracz
addCommandHandler("tpev", function(elcmd)
   if {bla bla bla...} then
       setElementPosition(elcoordinates) --sprawdto!
   end
end

(Nie pisa?em ca?ego kodu, bo pisz? z telefonu)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-12, 23:37


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

coordinates getElementPositon(el) --tutaj!


Nie no, tak to si? nie bawmy :oops: getElementPosition zwraca 3 argumentacje.
Co do tematu - zastosuj si? do mojej instrukcji i przybli?y nam to zakres poszukiwa?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-13, 00:33


Maniekxx

Amator






Wiek: 24
Na forum: 2894 dni
Posty: 232
Nick w MP: Maniekxx

Piwa: 225

Respekt: 110
Respekt: 110

Ostrzeżeń: 20%
Spr?buj co? takiego, zamiast zmiennej coordinates, ustawiaj na graczu elementData np setElementData(player,"tep",{getElementPosition(player)}) i wtedy sprawdzaj czy gracz posiada t? element date.


addCommandHandler("makeev", function(elcmd)
       setElementData(el,"tep",{getElementPosition(player)})
end



addCommandHandler("tpev", function(elcmd)
if getElementData(el,"tep"then
       setElementPosition(elunpack(getElementData(el,"tep")))
       else
       outputChatBox("* Nie masz zapisanej pozycji!",el,255,0,0)
end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-13, 16:06


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

"Maniekxx" napisał/a:

Spr?buj co? takiego, zamiast zmiennej coordinates, ustawiaj na graczu elementData np setElementData(player,"tep",{getElementPosition(player)}) i wtedy sprawdzaj czy gracz posiada t? element date.


addCommandHandler("makeev", function(elcmd)
       setElementData(el,"tep",{getElementPosition(player)})
end



addCommandHandler("tpev", function(elcmd)
if getElementData(el,"tep"then
       setElementPosition(elunpack(getElementData(el,"tep")))
       else
       outputChatBox("* Nie masz zapisanej pozycji!",el,255,0,0)
end
end




Nie ma sensu takie dzia?anie, bo ustawiasz eldate dla osoby, a ma dzia?a? dla graczy, po drugie zmienna zajmuje mniej CPU ni? elementdata, optymalno?ci troszeczke.

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-13, 16:26


Maniekxx

Amator






Wiek: 24
Na forum: 2894 dni
Posty: 232
Nick w MP: Maniekxx

Piwa: 225

Respekt: 110
Respekt: 110

Ostrzeżeń: 20%
W sumie masz racj?, tak b?dzie lepiej.


local function utpev(plr)
    local pos = {getElementPosition(plr)}
    --if (getElementData(plr,"player:admin")) then
    if == 1 then -- Dodazabezpieczenie dla administracji.
        if pos and not global_pos then
            global_pos pos
            outputChatBox(">> Administrator ustawi? globalny teleport.",_,255,0,0)
            else
            outputChatBox(">> Administrator usun?? globalny teleport.",_,255,0,0)
            global_pos nil
        end
    end
end
addCommandHandler("utpev",utpev)

local function tpev(plr)
    if global_pos then
        setElementPosition(plr,global_pos[1],global_pos[2],global_pos[3])
        outputChatBox("* Pomy?lnie teleportowa?e? si?.",plr)
    else
        outputChatBox("* Brak teleportu.",plr,255,0,0)
    end
end
addCommandHandler("tpev",tpev)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-13, 23:11


ItzWhitee







Wiek: 27
Na forum: 2224 dni
Posty: 8
Nick w MP: ItzWhitee



Respekt: 50

Naprawione, pokminilem i pyklo. Dzieki za pomoc - do zamkniecia

Postaw piwo autorowi tego posta
 

 
Tagi: skrypt :: tpev :: nie :: dziala
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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