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

Wysłany: 2018-12-01, 19:07


AkossPL







Wiek: 25
Na forum: 4221 dni
Posty: 140
Nick w MP: AkossPL

Piwa: 3

Respekt: 50

Siema taj jak w temacie za pomoc stawiam :piwo:

local door1 = createObject(3089, -50.099609375,30.900390625,980.90002441406,0,0,0)
local door2 = createObject(3089, -60.669921875,13.5,980.90002441406,0,0,0)
setElementInterior(door1, 2)
setElementInterior(door2, 2)
local marker1 = createMarker(-49.44,30.95,980.61-1, "cylinder", 1.8, 255, 255, 255, 0)
setElementInterior(marker1, 2)
local marker2 = createMarker(-59.94,13.53,980.61-1, "cylinder", 1.8, 255, 255, 255, 0)
setElementInterior(marker2, 2)

function isPlayerInPoliceFaction(plr)
 local sid=getElementData(plr,'player:uid')
 if not sid then return end

 local result=exports['ogrpg-db']:dbGet('SELECT 1 FROM ogrpg_factions WHERE code=? AND sud=? LIMIT 1;', "SAPD", uid)
 if result[1] then
  return true
 else
  return false
 end
end

addEventHandler("onMarkerHit", marker1, function(el)
    if not isPlayerInPoliceFaction(el) then return end
    local px, py, pz = getElementPosition(door1)
    moveObject(door1, 2000, px+2, py, pz)
end)

addEventHandler("onMarkerLeave", marker1, function(el)
    if not isPlayerInPoliceFaction(el) then return end
    moveObject(door1, 2000, -50.099609375, 30.900390625, 980.90002441406)
end)

addEventHandler("onMarkerHit", marker2, function(el)
    if not isPlayerInPoliceFaction(el) then return end
    local px, py, pz = getElementPosition(door2)
    moveObject(door2, 2000, px+2, py, pz)
end)

addEventHandler("onMarkerLeave", marker2, function(el)
    if not isPlayerInPoliceFaction(el) then return end
    moveObject(door2, 2000, -60.669921875, 13.5, 980.90002441406)
end)


local bramaSAPD = createObject(971, -1572.0999755859, 661.29998779297, 9.6999998092651, 0, 0, 90)
local bramaSAPDm = createMarker(-1572.25,661.65,7.19-1, "cylinder", 8, 255, 255, 255, 0)

addEventHandler("onMarkerHit", bramaSAPDm, function(el)
    if not isPlayerInPoliceFaction(el) then return end
    local px, py, pz = getElementPosition(bramaSAPD)
    moveObject(bramaSAPD, 4000, px, py, pz-15)
end)

addEventHandler("onMarkerLeave", bramaSAPDm, function(el)
    if not isPlayerInPoliceFaction(el) then return end
    moveObject(bramaSAPD, 4000, -1572.0999755859, 661.29998779297, 9.6999998092651)
end)

local bramaSAPD2 = createObject(971, -1701.18, 683.86, 24.82, 0, 0, 90)
local bramaSAPD2m = createMarker(-1701.18, 683.86, 24.82-1, "cylinder", 8, 255, 255, 255, 0)

addEventHandler("onMarkerHit", bramaSAPD2m, function(el)
    if not isPlayerInPoliceFaction(el) then return end
    local px, py, pz = getElementPosition(bramaSAPD2)
    moveObject(bramaSAPD2, 3000, -1701.18, 683.86, 24.82-10)
end)

addEventHandler("onMarkerLeave", bramaSAPD2m, function(el)
    if not isPlayerInPoliceFaction(el) then return end
    moveObject(bramaSAPD2, 1000, -1701.18, 683.86, 24.82)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-12-01, 19:25


Query

SyndicateMTA






Wiek: 24
Na forum: 3213 dni
Posty: 319
Nick w MP: Query

Piwa: 5238

Respekt: 141
Respekt: 141

Debugscript 3 ?

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-12-01, 19:39


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Problem le?y w tej funkcji:

function isPlayerInPoliceFaction(plr)
 local sid=getElementData(plr,'player:uid')
 if not sid then return end

 local result=exports["ogrpg-db"]:dbGet("SELECT 1 FROM ogrpg_factions WHERE code=? AND sud=? LIMIT 1", "SAPD", sid)
 if result[1] then
  return true
 else
  return false
 end
end


Zmienna elementDaty 'player:uid' si? nie zgadza z t?, kt?r? sprawdzasz w MySQL.
Upewnij si?, czy w bazie 'ogrpg_factions' masz kolumny 'code' i 'sud'.

Spr?buj co? takiego:
function isPlayerInPoliceFaction(plr)
 local sid=getElementData(plr,'player:uid')
 if not sid then return end

 local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_factions WHERE code=? AND sud=? LIMIT 1", "SAPD", sid)
 if result[1] then
  return true
 else
  return false
 end
end


Postaw piwo autorowi tego posta
 

 
Tagi: nie :: działa :: brama :: dla :: frakcji
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 działa brama dla frakcji 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