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

Wysłany: 2015-10-05, 10:34


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

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 :piwo: :piwo: :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-05, 14:38


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
BlackGamePL, poka? ten kod, kt?ry zrobi?e? a zobaczymy co jest w nim ?le.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-05, 18:57


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-05, 19:00


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
BlackGamePL, tak, pewnie zgubi?e? event, ale tu Ci troszk? pomog?


Więcej informacji znajdziesz w Wikipedii MTA:

onClientPlayerWeaponSwitch


I teraz zbudujemy funkcje:


function blokada(poprzednia_bronaktualna_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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-05, 19:17


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Mam co? takiego :

function blokada(poprzednia_bronaktualna_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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-05, 19:21


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
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.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-05, 19:34


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

mam cos takiego :

function blokada(poprzednia_bronaktualna_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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-05, 20:01


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
BlackGamePL,

addEventHandler("onClientPlayerWeaponSwitch",getRootElement(), blokada)

takie co? powinno dzia?a?, pami?taj tylko, ?eby da? to po stronie client'a.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-05, 20:19


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

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_bronaktualna_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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-05, 21:31


AteX







Wiek: 26
Na forum: 4015 dni
Posty: 927
Nick w MP: #AteX

Piwa: 8360

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

"BlackGamePL" napisał/a:


aaddEventHandler("onClientPlayerWeaponSwitch",getRootElement(), blokada)

O jedno "a" za du?o na samym pocz?tku. ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-05, 22:17


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

O nie zauwazylem tego , dziekuje , tymczasowo nie ma mnie na komputerze , ale gdy bede mial dostep to odpowiem 😁

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-06, 14:52


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

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

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-06, 15:19


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
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_bronaktualna_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


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-06, 16:00


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Bardzo ci DestroY dzi?kuje za t? pomoc , lecz z broni o id 22 da si? normalnie bi? ;/

Kod :
function blokada(poprzednia_bronaktualna_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? :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-10-06, 16:04


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
Wybacz, moje niedoczytanie zwi?zane z tym eventem.

Tak powinno dzia?a?:

function BlockprevSlotnewSlot )
local aktualna_bron getPedWeapon(localPlayernewSlot)
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)



Postaw piwo autorowi tego posta
 

 
Tagi: blokada :: bicia :: dla :: poszczególnych :: broni
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Blokada bicia dla poszczególnych broni 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