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

Wysłany: 2017-11-22, 11:30


ZabijakPG







Wiek: 28
Na forum: 3892 dni
Posty: 3
Nick w MP: ZabijakPG



Respekt: 50

Duty SAPD sypie tym b??dem: [2017-11-22 11:11] WARNING: [Frakcje]/frakcja-policja/s_duty.lua:39: Bad argument @ 'triggerClientEvent' [Expected string at argument 1, got nil]

O to kod
Kod:

local marker=createMarker(-1622.46, 691.68, 18.00-0.8, 'cylinder', 1.0, 240, 240, 240, 240)
setElementDimension(marker, 0)
setElementInterior(marker, 0)

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

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

addEventHandler('onMarkerHit', marker, function(el,md)
if isPlayerInPoliceFaction(el) then
if not getElementData(el,'player:duty') then
exports['frakcja']:rozpocznijnaliczanie(el)
setElementData(el,'player:duty','SFPD')
local rank = exports['frakcja']:getPlayerFactionRank(el,'SFPD')
setElementData(el,"player:rank",rank)
giveWeapon(el,23,9999)
bindKey(el, "mouse_wheel_up","both", 'openSAPD')
bindKey(el, "mouse_wheel_down","both", 'closeSAPD')
bindKey(el, "mouse_wheel_up","both", 'openSAPD2')
bindKey(el, "mouse_wheel_down","both", 'closeSAPD2')
bindKey(el, "mouse_wheel_up","both", 'openSAPD3')
bindKey(el, "mouse_wheel_down","both", 'closeSAPD3')
triggerClientEvent(client,"addNotification",root, "✔Wszed?e?/a? na s?u?b? w San Fierro Police Department.✔", "error")
else
takeWeapon(el,23)
exports['frakcja']:zatrzymajnaliczanie(el)
setElementData(el, 'player:duty', false)
setElementData(el,"player:rank",false)
local skin=getElementData(el,"player:skin")
setElementModel(el, skin)
triggerClientEvent(client,"addNotification",root, "✔Wyszed?e?/a? z s?u?by w San Fierro Police Department.✔", "error")
end
else
triggerClientEvent(client,"addNotification",root, "✘Nie jeste? zatrudniony jako San Fierro Police Department.✘", "error")
end
end)

function naliczanie(el)
if isElement(el) then
local x = getElementData(el,"player:workinjob") or 0
setElementData(el,"player:workinjob",x+1)
else
if isTimer(licz[el]) then
killTimer(licz[el])
licz[el] = nil
end
end
end

local bronie2 = createMarker ( -1619.86, 671.55, -4.91, "cylinder", 1.0, 0, 255, 0, 255 )
setElementDimension(bronie2, 0)
setElementInterior(bronie2, 0)
local t=createElement("text")
setElementData(t,"name", "Pistolet Glock-19")
setElementPosition(t,-1619.86, 671.55, -4.91)
setElementDimension(t, 0)
setElementInterior(t, 0)

function bronie11(hitElement, matchingDimension)
if source == bronie2 then
if getElementData(hitElement,"player:duty") == "SFPD" then
if getElementData(hitElement,'player:rank') <= 4 then hitElement:outputChat("Jeste? aktualnie podczas akademii, nie przys?uguje Ci wyposa?enie!") return end
outputChatBox("Bierzesz pistolet po czym wk?adasz go do kabury.", hitElement)
giveWeapon(hitElement, 24, 100000)
else
outputChatBox ("Nie jestes policjantem!", hitElement)
end
end
end
addEventHandler ("onMarkerHit", bronie2, bronie11)

local bronie3 = createMarker ( -1619.89, 669.65, -4.91, "cylinder", 1.0, 0, 255, 0, 255 )
setElementDimension(bronie3, 0)
setElementInterior(bronie3, 0)
local t=createElement("text")
setElementData(t,"name", "Paralizator")
setElementPosition(t,-1619.89, 669.65, -4.91)
setElementDimension(t, 0)
setElementInterior(t, 0)

function bronie11(hitElement, matchingDimension)
if source == bronie3 then
if getElementData(hitElement,"player:duty") == "SFPD" then
if getElementData(hitElement,'player:rank') <= 4 then hitElement:outputChat("Jeste? aktualnie podczas akademii, nie przys?uguje Ci wyposa?enie!") return end
outputChatBox("Bierzesz paralizator po czym wk?adasz go do kabury.", hitElement)
giveWeapon(hitElement, 23, 100000)
else
outputChatBox ("Nie jestes policjantem!", hitElement)
end
end
end
addEventHandler ("onMarkerHit", bronie3, bronie11)

local bronie4 = createMarker ( -1619.72, 667.63, -4.91, "cylinder", 1.0, 0, 255, 0, 255 )
setElementDimension(bronie4, 0)
setElementInterior(bronie4, 0)
local t=createElement("text")
setElementData(t,"name", "ShotGun Remington 870")
setElementPosition(t,-1619.72, 667.63, -4.91)
setElementDimension(t, 0)
setElementInterior(t, 0)

function bronie11(hitElement, matchingDimension)
if source == bronie4 then
if getElementData(hitElement,"player:duty") == "SFPD" then
if getElementData(hitElement,'player:rank') <= 4 then hitElement:outputChat("Jeste? aktualnie podczas akademii, nie przys?uguje Ci wyposa?enie!") return end
outputChatBox("Bierzesz ShotGuna po czym zawieszasz go na szyi.", hitElement)
giveWeapon(hitElement, 25, 100000)
else
outputChatBox ("Nie jestes policjantem!", hitElement)
end
end
end
addEventHandler ("onMarkerHit", bronie4, bronie11)

local bronie5 = createMarker ( -1619.78, 665.46, -4.91, "cylinder", 1.0, 0, 255, 0, 255 )
setElementDimension(bronie5, 0)
setElementInterior(bronie5, 0)
local t=createElement("text")
setElementData(t,"name", "Pistolet Maszynowy MP5")
setElementPosition(t,-1619.78, 665.46, -4.91)
setElementDimension(t, 0)
setElementInterior(t, 0)

function bronie11(hitElement, matchingDimension)
if source == bronie5 then
if getElementData(hitElement,"player:duty") == "SFPD" then
if getElementData(hitElement,'player:rank') <= 4 then hitElement:outputChat("Jeste? aktualnie podczas akademii, nie przys?uguje Ci wyposa?enie!") return end
outputChatBox("Wzi??e? swoje wyposa?enie!", hitElement)
giveWeapon(hitElement, 29, 100000)
else
outputChatBox ("Nie jestes policjantem!", hitElement)
end
end
end
addEventHandler ("onMarkerHit", bronie5, bronie11)

local bronie6 = createMarker ( -1619.42, 664.17, -4.91, "cylinder", 1.0, 0, 255, 0, 255 )
setElementDimension(bronie6, 0)
setElementInterior(bronie6, 0)
local t=createElement("text")
setElementData(t,"name", "Karabin Maszynowy M4CQBR")
setElementPosition(t,-1619.42, 664.17, -4.91)
setElementDimension(t, 0)
setElementInterior(t, 0)

function bronie11(hitElement, matchingDimension)
if source == bronie6 then
if getElementData(hitElement,"player:duty") == "SFPD" then
if getElementData(hitElement,'player:rank') <= 4 then hitElement:outputChat("Jeste? aktualnie podczas akademii, nie przys?uguje Ci wyposa?enie!") return end
outputChatBox("Wzi??e? swoje wyposa?enie!", hitElement)
giveWeapon(hitElement, 31, 100000)
else
outputChatBox ("Nie jestes policjantem!", hitElement)
end
end
end
addEventHandler ("onMarkerHit", bronie6, bronie11)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-24, 16:50


R3fr3Sh







Wiek: 27
Na forum: 4800 dni
Posty: 70

Piwa: 60

Respekt: 150
Respekt: 150Respekt: 150

Przy evencie onMarkerHit nie wyst?puje zmienna client. Musisz zmieni? client na el.

Postaw piwo autorowi tego posta
 

 
Tagi: duty :: sfpd :: (policja)
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Duty SFPD (policja) 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