Tematy otagowane jako: addeventhandler
1. czemu to nie działa? sypie addEventHandler
local spadamXD = createPickup ( -1531.28, 686.95, 133.05, 46, 11, 1, 1 )
function spadochron ()
giveWeapon( source, 46, 1 )
end
addEventHandler("onPickupHit", spadamXD, spadochron)
2. Bad argument @ 'addEventHandler' [Expected element at argume
Witam mam pewien problem bawi? si? w bramki na autostradach lecz mam pewien problem
kod
local markery = {
{- 2668.07 , 1273.93 , 55.43 },
{- 2677.32 , 1274.63 , 55.43 },
}
for i , v in ipairs ( markery ) do
local markery = createMarker ( v [ 1 ], v [ 2 ], v [ 3 ]- 1 , "cylinder" , 9 , 0 , 0 , 0 , 170 )
end
addEventHandler ( "onClientMarkerHit" , markery ,
function( el )
local kasa = getPlayerMoney ( el )
local hajs = 10
local veh = getPedOccupiedVehicle ( el )
if kasa < hajs then outputChatBox ( "Nie posiadasz wystarczaj?co pini?dzy aby przejecha?." , client , 255 , 255 , 255 , true ) return end
if not veh then outputChatBox ( "Nie jeste? w aucie" , client , 255 , 255 , 255 , true ) return end
setPedFrozen ( veh , true )
takePlayerMoney ( veh , hajs )
setPedFrozen ( veh , false )
-- end
end )
b??d
Bad argument @ 'addEventHandler' [Expected element at argument 2, got table]
addEventHandler( "onClientMarkerHit" , markery ,
function( el )
3. 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...
4. addEventHandler, argument 2
Kod: function usuwanie (source)
local pojazdy = getElementsByType("vehicle")
local nick = getPlayerName(source)
local ElementGracza = setElementData(source, "XD", nick)
for i,pojazdy in ipairs(pojazdy) do
if getElementData(source, "XD") == getElementData(pojazdy,"wlasciciel") then
destroyElement(pojazdy)
setElementData(source, "zrespione_pojazdy", 0)
end
end
end
addCommandHandler("odresp", usuwanie)
addEventHandler("onPlayerQuit",source,usuwanie)
Chc? zrobi?, ?eby po wyj?ciu gracza z serwera usuwa?o pojazdy, kt?re zrespi?. Komenda dzia?a ale Event Handler ju? nie
5. removeEventHandler + addEventHandler
Witam kieruj? si? do was tutaj w sprawie pomocy przy skrypcie ot?? robi? skrypt na lini? ga?nicz? i chc? ?e jak wejdziesz w marker 1-szy raz to daje ci event "onClientRender", a gdy wejde 2-gi raz w marker to removeEventHandler("onClientRender") przyk?adziki mile widziane
6. addEventHandler ( "onPlayerJoin", getRootElement()
Czemu mi to nie wyswietla button?w i dx?
Brak db3
addEventHandler ( "onPlayerJoin" , getRootElement (),
function ()
editNick = guiCreateEdit ( 619 , 345 , 351 , 35 , "" , false )
editHaslo = guiCreateEdit ( 619 , 421 , 351 , 35 , "" , false )
buttonZaloguj = guiCreateButton ( 598 , 483 , 191 , 39 , "" , false )
guiSetAlpha ( buttonZaloguj , 0.00 )
guiSetProperty ( buttonZaloguj , "NormalTextColour" , "FFAAAAAA" )
buttonZarejestruj = guiCreateButton ( 809 , 483 , 191 , 39 , "" , false )
guiSetAlpha ( buttonZarejestruj , 0.00 )
guiSetProperty ( buttonZarejestruj , "NormalTextColour" , "FFAAAAAA" )
addEventHandler ( "onClientRender" , getRootElement (), drawLoginPanel )
showCursor ( true )
outputChatBox ( "[1]" , source , 255 , 255 , 255 )
end )
[ Dodano : 2014-12-27, 03:01 ]
Sry za nazwe tematu ale na szybko pisane xd
7. addEventHandler
Witam. Mam taki problem gdy? polega on na tym ?e mam zrobione okno na dx i jak ktos wejdzie w marker to pokazuje si? ono ka?demu oto kod:
function funkcjamarkera ( hitElement )
if hitElement == getLocalPlayer () then
if getElementData ( source , "salonek" ) == true then
addEventHandler ( "onClientRender" , getRootElement (), sklepsalon )
guiSetVisible ( tabela , true )
guiSetVisible ( kupse , true )
guiSetVisible ( wyjscie , true )
showCursor ( true )
end
end
end
addEventHandler ( "onClientMarkerHit" , root , funkcjamarkera )
8. Kłopot z addEventHandler
Witam, gdy robi?em szlaban w bazie policji wyst?pi? taki b??d:
Kod: [22] WARNING: [gameplay]Policjabaza.lua:12: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil]
Oto kod:
szlabanpPed = createPed ( 281 , - 1572.7000732422 , 657.52966308594 , 7.1875 , 270 )
szlabanpMarker = createMarker ( - 1572.7000732422 , 657.52966308594 , 6 , "cylinder" , 3 , 0 , 0 , 0 , 0 )
szlabanp = createObject ( 968 , - 1572.1999511719 , 658.90002441406 , 6.9000000953674 , 0 , 90 , 90 )
function szlabanpPedOpcje ( gracz )
local gr = getPlayerFromName ( gracz )
outputChatBox ( "Policjant m?wi: Witam pana policjanta. Otworzy? ?" )
setTimer ( outputChatBox ( gr .. " m?wi: Oczywi?cie." ), 1500 , 1 )
setTimer ( outputChatBox ( "Policjant m?wi: Ok, otworz? na 10 sekund." ), 3000 , 1 )
setTimer ( szlabanpRuch , 3000 , 1 )
end
addEventHandler ( "onMarkerHit" , szlabanpMarker , szlabanPedOpcje )
function szlabanpRuch ( cmd )
moveObject ( szlabanp , 968 , - 1572.1999511719 , 658.90002441406 , 6.9000000953674 , 0 , - 90 , 0 )
removeCommandHandler ( "szlaban" )
setTimer ( function()
moveObject ( szlabanp , 968 , - 1572.1999511719 , 658.90002441406 , 6.9000000953674 , 0 , 90 , 0 )
addCommandHandler ( "szlaban" , szlabanprzod )
end ,
10000 , 1 )
end
PS: Linijka 12 to:
addEventHandler ( "onMarkerHit" , szlabanpMarker , szlabanPedOpcje )
9. Paralizator kłopot a addEventHandler
Witam. Mam problem z addEventHandler
Kod Serwera
local time = 10
function Paraliz()
setElementFrozen ( source, true )
setPedAnimation( source, ped, KO_shot_stom)
setTimer(setElementFrozen, time * 1000, 1, source, false)
setTimer(setPedAnimation, time * 1000, 1, source)
end
addEvent( "Paraliz", true )
addEventHandler( "Paraliz", getRootElement(),Paralizd)
A teraz b??d w logach:
[2012-06-12 19] WARNING: paral/paral_s.lua:12: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil]