[lua]addCommandHandler('test",function(source,cmd)
local save = getElementData(source,'player:save') or {}
if getElementData(e,"player:faction") == "SAPD" or getElementData(source,'player:faction')=='SAMD' or getElementData(source,'player:faction')=='SAFD' then
local x,y,z = getElementPosition(source)
local utrudnienie = createBlip(x,y,z, 19,2,0,0,0,0,0,275)
--outputChatBox('Postawiles Znak ostrzegawczy')
table.insert(save,utrudnienie)
setElementData(source,'player:save',save)
end)
addCommandHandler('test2",function(source,cmd)
local save = getElementData(source,'player:save') or {}
if getElementData(e,"player:faction") == "SAPD" or getElementData(source,'player:faction')=='SAMD' or getElementData(source,'player:faction')=='SAFD' then
for key, source in ipairs(getElementData(source,'player:save')) do
if isElement(source) then
destroyElement(source)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(source,'player:save')
end)[/lua]
dla sapd?w
addCommandHandler('test",function(source,cmd)
local save = getElementData(source,'player:save') or {}
if getElementData(e,"player:faction") == "SAPD" or getElementData(source,'player:faction')=='SAMD' or getElementData(source,'player:faction')=='SAFD' then
local x,y,z = getElementPosition(source)
local utrudnienie = createBlip(x,y,z, 19,2,0,0,0,0,0,275)
--outputChatBox('Postawiles Znak ostrzegawczy')
table.insert(save,utrudnienie)
setElementData(source,'player:save',save)
end)
addCommandHandler('test2",function(source,cmd)
local save = getElementData(source,'player:save') or {}
if getElementData(e,"player:faction") == "SAPD" or getElementData(source,'player:faction')=='SAMD' or getElementData(source,'player:faction')=='SAFD' then
for key, source in ipairs(getElementData(source,'player:save')) do
if isElement(source) then
destroyElement(source)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(source,'player:save')
end)
addCommandHandler('test'function(source,cmd)
if getElementData(source, "player:faction",true) then
local save = getElementData(source,'player:save') or {}
local x,y,z = getElementPosition(source)
local utrudnienie = createBlip(x,y,z, 19,2,0,0,0,0,0,275)
--outputChatBox('Postawiles Znak ostrzegawczy')
table.insert(save,utrudnienie)
setElementData(source,'player:save',save)
return end
end)
addCommandHandler('test2',function(source,cmd)
if getElementData(source, "player:faction",true) then
local save = getElementData(source,'player:save') or {}
for key, source in ipairs(getElementData(source,'player:save')) do
if isElement(source) then
destroyElement(source)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(source,'player:save')
return end
end)
Wilq, Tak wiem przeinki czy jak t sie tam zwie pozmienialem
[ Dodano: 2019-11-03, 10:12 ]
Zobacz
addCommandHandler('test'function(source,cmd)
if getElementData(source, "player:faction",true) then
local save = getElementData(source,'player:save') or {}
local x,y,z = getElementPosition(source)
local utrudnienie = createBlip(x,y,z, 19,2,0,0,0,0,0,275)
--outputChatBox('Postawiles Znak ostrzegawczy')
table.insert(save,utrudnienie)
setElementData(source,'player:save',save)
return end
end)
addCommandHandler('test2',function(source,cmd)
if getElementData(source, "player:faction",true) then
local save = getElementData(source,'player:save') or {}
for key, source in ipairs(getElementData(source,'player:save')) do
if isElement(source) then
destroyElement(source)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(source,'player:save')
return end
end)
Niestety wystepuje ciagle lad w db3
ERROR:Loading script failed: [frakcje]/utrudnienie/system.lua:30 ')' expected near 'function'
Widzisz, tak to jest jak dziesi?ciu chce pom?c, a ?aden pewnie nie wie co to LUA.
local player_faction = {['SAPD'] = true, ['SAMD'] = true, ['SAFD'] = true}
addCommandHandler('test', function(player, cmd)
if (getElementData(player, "player:faction") and player_faction[getElementData(player, "player:faction")]) then
local save = getElementData(player, 'player:save') or {}
local x, y, z = getElementPosition(player)
local utrudnienie = createBlip(x, y, z, 19, 2, 0, 0, 0, 0, 0, 275)
--outputChatBox('Postawiles Znak ostrzegawczy')
table.insert(save, utrudnienie)
setElementData(player, 'player:save', save)
return
end
end)
addCommandHandler('test2', function(player, cmd)
if (getElementData(player, "player:faction") and player_faction[getElementData(player, "player:faction")]) then
local save = getElementData(player, 'player:save') or {}
for _, element in ipairs(save) do
if isElement(element) then
destroyElement(element)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(player, 'player:save')
return
end
end)
Kod nie tylko zawiera? b??dy, ale te? zmienne si? nadpisywa?y w p?tli na tabeli 'save'. Taki kod powinien dzia?a? bez problemu.
Co do tych pomocnik?w, je?li nie wiecie o co chodzi to lepiej nie pr?bowa? na si??. Zmieni?em te? nazwy zmiennych (np. source na player) ?eby to by?o bardziej przejrzyste.
Widzisz, tak to jest jak dziesi?ciu chce pom?c, a ?aden pewnie nie wie co to LUA.
local player_faction = {['SAPD'] = true, ['SAMD'] = true, ['SAFD'] = true}
addCommandHandler('test', function(player, cmd)
if (getElementData(player, "player:faction") and player_faction[getElementData(player, "player:faction")]) then
local save = getElementData(player, 'player:save') or {}
local x, y, z = getElementPosition(player)
local utrudnienie = createBlip(x, y, z, 19, 2, 0, 0, 0, 0, 0, 275)
--outputChatBox('Postawiles Znak ostrzegawczy')
table.insert(save, utrudnienie)
setElementData(player, 'player:save', save)
return
end
end)
addCommandHandler('test2', function(player, cmd)
if (getElementData(player, "player:faction") and player_faction[getElementData(player, "player:faction")]) then
local save = getElementData(player, 'player:save') or {}
for _, element in ipairs(save) do
if isElement(element) then
destroyElement(element)
end
end
--outputChatBox('Usuneles Znak ostrzegawczy')
removeElementData(player, 'player:save')
return
end
end)
Kod nie tylko zawiera? b??dy, ale te? zmienne si? nadpisywa?y w p?tli na tabeli 'save'. Taki kod powinien dzia?a? bez problemu.
Co do tych pomocnik?w, je?li nie wiecie o co chodzi to lepiej nie pr?bowa? na si??. Zmieni?em te? nazwy zmiennych (np. source na player) ?eby to by?o bardziej przejrzyste.
Kod jak najbardziej nic nie pokazuje zadnych bledow w db 3 ale po wpisania komendy nic nie dzieje
Jeste? pewny, ?e masz elementDat? "player:faction"? Kt?r? komend? wpisujesz? Mo?e si??co??dzieje ale ty o tym nie wiesz (dodaj sobie outputChatBoxy).
Dodalem outchatboxy i mam date 'player:faction' . Po wpisaniu komendy /test nic sie nie pojawia a po wpisaniu komendy /test2 wyskakuje usuneles znak ostrzegawczy
addCommandHandler('test', function(player, cmd)
if (getElementData(player, "player:faction")) then
local save = getElementData(player, 'player:save') or {}
local x, y, z = getElementPosition(player)
local utrudnienie = createBlip(x, y, z, 19, 2, 0, 0, 0, 0, 0, 275)
outputChatBox('Postawi?es: znak ostrzegawczy!', player)
table.insert(save, utrudnienie)
setElementData(player, 'player:save', save)
return
end
end)
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