Wysłany: 2015-10-05, 10:34
Dexnes_
Tiger
Wiek: 26 Na forum: 4401 dni Posty: 620
Nick w MP: Dexnes
Piwa : 1394
Witam mam problem z blokad? bicia , pr?bowa?em zrobi? blokade dla broni , lecz mi nie wychodzi i ca?y czas mozna bi? . Prosz? o pomoc stawiam zimne browce
Wysłany: 2015-10-05, 14:38
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
BlackGamePL , poka? ten kod, kt?ry zrobi?e? a zobaczymy co jest w nim ?le.
Wysłany: 2015-10-05, 18:57
Dexnes_
Tiger
Wiek: 26 Na forum: 4401 dni Posty: 620
Nick w MP: Dexnes
Piwa : 1394
function blokada ()
local weapon = getPedWeapon ( localPlayer )
if weapon == 22 then
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
toggleControl ( "aim_weapon" , true )
toggleControl ( "vehicle_fire" , true )
else if weapon == 29 then
toggleControl ( "fire" , true )
toggleControl ( "action" , true )
toggleControl ( "aim_weapon" , true )
end
Wysłany: 2015-10-05, 19:00
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
BlackGamePL , tak, pewnie zgubi?e? event, ale tu Ci troszk? pomog?
I teraz zbudujemy funkcje:
function blokada ( poprzednia_bron , aktualna_bron )
-- i teraz najprosciej jak sie da
if aktualna_bron == jakies_id then
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
elseif aktualna_bron == inne_id then
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
else
toggleControl ( "fire" , true )
toggleControl ( "action" , true )
end
end
-- tutaj ten event
Wysłany: 2015-10-05, 19:17
Dexnes_
Tiger
Wiek: 26 Na forum: 4401 dni Posty: 620
Nick w MP: Dexnes
Piwa : 1394
Mam co? takiego :
function blokada ( poprzednia_bron , aktualna_bron )
if aktualna_bron == 22 then
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
elseif aktualna_bron == 0 then
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
else
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
end
end
addEventHandler ( "onPlayerLogin" , getRootElement (), blokada )
Wysłany: 2015-10-05, 19:21
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
BlackGamePL , poda?em Ci event w po?cie wy?ej, u?yj jego, inaczej osi?gniesz nieco inne efekty ni? zamierzasz.
Dos?ownie daj tam ten event i skrypt jest po stronie client'a.
Wysłany: 2015-10-05, 19:34
Dexnes_
Tiger
Wiek: 26 Na forum: 4401 dni Posty: 620
Nick w MP: Dexnes
Piwa : 1394
mam cos takiego :
function blokada ( poprzednia_bron , aktualna_bron )
if aktualna_bron == 22 then
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
elseif aktualna_bron == 0 then
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
else
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
end
end
addEventHandler ( "onClientPlayerWeaponSwitch" , blokada )
Wysłany: 2015-10-05, 20:01
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
BlackGamePL ,
addEventHandler ( "onClientPlayerWeaponSwitch" , getRootElement (), blokada )
takie co? powinno dzia?a?, pami?taj tylko, ?eby da? to po stronie client'a.
Wysłany: 2015-10-05, 20:19
Dexnes_
Tiger
Wiek: 26 Na forum: 4401 dni Posty: 620
Nick w MP: Dexnes
Piwa : 1394
Nie dzia??
oto kod :
Meta:
< meta >
< info author = "BlackDGame" version = "1.0" type = "Blokada" name = "Blokada_Bicia" />
< script src = "blokada.lua" type = "client" />
</ meta >
a tutaj kod :
function blokada ( poprzednia_bron , aktualna_bron )
if aktualna_bron == 22 then
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
elseif aktualna_bron == 0 then
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
else
toggleControl ( "fire" , false )
toggleControl ( "action" , false )
end
end
aaddEventHandler ( "onClientPlayerWeaponSwitch" , getRootElement (), blokada )
Wysłany: 2015-10-05, 21:31
AteX
Wiek: 26 Na forum: 4015 dni Posty: 927
Nick w MP: #AteX
Piwa : 8360
"BlackGamePL" napisał/a :
aaddEventHandler ( "onClientPlayerWeaponSwitch" , getRootElement (), blokada )
O jedno "a" za du?o na samym pocz?tku.
Wysłany: 2015-10-05, 22:17
Dexnes_
Tiger
Wiek: 26 Na forum: 4401 dni Posty: 620
Nick w MP: Dexnes
Piwa : 1394
O nie zauwazylem tego , dziekuje , tymczasowo nie ma mnie na komputerze , ale gdy bede mial dostep to odpowiem 😁
Wysłany: 2015-10-06, 14:52
Dexnes_
Tiger
Wiek: 26 Na forum: 4401 dni Posty: 620
Nick w MP: Dexnes
Piwa : 1394
Skrypt dzia?a , lecz da sie bic gdy przytrzymam prawy klawlawisz myszy i klikaj?c klawisz F
[ Dodano : 2015-10-06, 15:00 ]
Zauwa?y?em te? ze nie da sie bic z zadnej broni
Wysłany: 2015-10-06, 15:19
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
BlackGamePL , tak nie da si? z ?adnej bo pokie?basi?e? ostatnie argumenty + dorobi?em, ?eby nie da?o si? celowa?, rozwi??e to problem z F.
function blokada ( poprzednia_bron , aktualna_bron )
if aktualna_bron == 22 then
toggleControl ( "fire" , false )
toggleControl ( "aim_weapon" , false )
toggleControl ( "action" , false )
elseif aktualna_bron == 0 then
toggleControl ( "fire" , false )
toggleControl ( "aim_weapon" , false )
toggleControl ( "action" , false )
else
toggleControl ( "fire" , true )
toggleControl ( "aim_weapon" , true )
toggleControl ( "action" , true )
end
end
Wysłany: 2015-10-06, 16:00
Dexnes_
Tiger
Wiek: 26 Na forum: 4401 dni Posty: 620
Nick w MP: Dexnes
Piwa : 1394
Bardzo ci DestroY dzi?kuje za t? pomoc , lecz z broni o id 22 da si? normalnie bi? ;/
Kod :
function blokada ( poprzednia_bron , aktualna_bron )
if aktualna_bron == 22 then
toggleControl ( "fire" , false )
toggleControl ( "aim_weapon" , false )
toggleControl ( "action" , false )
elseif aktualna_bron == 0 then
toggleControl ( "fire" , false )
toggleControl ( "aim_weapon" , false )
toggleControl ( "action" , false )
else
toggleControl ( "fire" , false )
toggleControl ( "aim_weapon" , true )
toggleControl ( "action" , true )
end
end
addEventHandler ( "onClientPlayerWeaponSwitch" , getRootElement (), blokada )
[ Dodano : 2015-10-06, 16:03 ]
I jeszcze jedno , gdy wejde na serwer to mog? normalnie bi? , a gdy dam sobie bro? i zmienie na pi??? to juz nie mog? bi?
Wysłany: 2015-10-06, 16:04
#404
Wiek: 26 Na forum: 4771 dni Posty: 1438
Piwa : 2512
Wybacz, moje niedoczytanie zwi?zane z tym eventem.
Tak powinno dzia?a?:
function Block ( prevSlot , newSlot )
local aktualna_bron = getPedWeapon ( localPlayer , newSlot )
if aktualna_bron == 22 then
toggleControl ( "fire" , false )
toggleControl ( "aim_weapon" , false )
toggleControl ( "action" , false )
elseif aktualna_bron == 0 then
toggleControl ( "fire" , false )
toggleControl ( "aim_weapon" , false )
toggleControl ( "action" , false )
else
toggleControl ( "fire" , false )
toggleControl ( "aim_weapon" , true )
toggleControl ( "action" , true )
end
end
addEventHandler ( "onClientPlayerWeaponSwitch" , getRootElement (), Block )
Tagi: blokada :: bicia :: dla :: poszczególnych :: broni
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: