Tematy otagowane jako: nil]
1. addEventHandler [Expected element at argument 2, got nil]
Wszystko dzia?a na pocz?tku tylko paczki nie mo?na odda? do drugiego markera
addEventHandler("onClientMarkerHit", markerx, function(el, md)
[lua]
function startjob2()
if source ~= buttonstart2 then return end
if getElementData(localPlayer, "mamskrzynke") == true
then outputChatBox("Masz ju? skrzynke!") return end
losuj = math.random ( 1, #markery )
local markerx = createMarker(markery[losuj][1],markery[losuj][2],markery[losuj][3], markery[losuj][4], markery[losuj][5], markery[losuj][6], markery[losuj][7], markery[losuj][8], markery[losuj][9])
blip = createBlipAttachedTo(markerx, 41)
setElementData(localPlayer, "mamskrzynke", true)
box = createObject(2912, 0, 0, 0)
attachElements(box, localPlayer, 0, 0.78, 0.3)
toggleControl ("sprint", false)
toggleControl ("jump", false)
toggleControl ("fire", false)
end
setPedAnimation(localPlayer, "carry", "crry_prtial", 1, false, true)
addEventHandler("onClientMarkerHit", markerx, function(el, md)
if localPlayer == el and md then
setPedAnimation(localPlayer, "CARRY", "putdwn", -1, true, false, false)
setTimer(function()
setElementData(localPlayer, "wezpaczke", false)
setElementData(l...
2. isPlayerInTeam [player expected, got nil]
Wie kto? mo?e co tu jest nie tak? W konsoli wywala b??d "Bad argument 1 @ isPlayerInTeam [player expected, got nil]". Dopiero co zacz??em pisa? skrypty
Kod: brama = createObject ( 980, 1587.9000244141, -1638.3000488281, 13.89999961853, 0, 0, 0 )
function isPlayerInTeam(player, team)
assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]")
assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]")
return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true)))
end
addCommandHandler("open",function()
local team = getTeamFromName("Milicja")
if isPlayerInTeam(source, team) then
moveObject ( brama, 2500, 1587.9000244141, -1638.3000488281, 8.5 )
end
end)
addCommandHandler("close",function()
local team = getTeamFromName("Milicja")
if isPlayerInTeam(source, team) then
moveObject ( brama, 2500, 1587.9000244141, -1638.3000488281, 13.89999961853 )
end
end )