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

Wysłany: 2019-02-20, 18:15


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

Witam. Chcia?em sobie zablokowa? strzelanie przy danej broni pod id. Chcia?bym aby strzelanie z danej broni zosta?o zablokowane poniewa? to mi przeszkadza przy tankowaniu.

ID broni to 32


function blokada prevSlotnewSlot )
    if getPedWeapon(getLocalPlayer(),newSlot) == and getElementData(getLocalPlayer(),"player:admin") == true then 
        toggleControl "fire"true )
        toggleControl("aim_weapon"true)
    elseif getPedWeapon(getLocalPlayer(),newSlot) == 7 then
        toggleControl ("fire"false ) 
        toggleControl("aim_weapon"false)
        return false
    elseif getPedWeapon(getLocalPlayer(),newSlot) ~= and  getPedWeapon(getLocalPlayer(),newSlot) ~= 22 then
        toggleControl ("fire"true ) 
        toggleControl("aim_weapon"true)
    elseif getPedWeapon(getLocalPlayer(),newSlot) == 22 and getElementData(getLocalPlayer(),"player:admin") == true then
        toggleControl ("fire"false ) 
        toggleControl("aim_weapon"true)
    elseif getPedWeapon(getLocalPlayer(),newSlot) == 22 and getElementData(getLocalPlayer(),"player:admin") == false then
        toggleControl ("fire"true ) 
        toggleControl("aim_weapon"true)
    elseif getPedWeapon(getLocalPlayer(),newSlot) == 32 and getElementData(getLocalPlayer(),"player:admin") == false then
        toggleControl ("fire"false ) 
        toggleControl("aim_weapon"false)
    else
        toggleControl "fire"false ) 
        toggleControl("aim_weapon"false)
    end
end
addEventHandler "onClientPlayerWeaponSwitch"getRootElement(), blokada )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-21, 22:29


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

wywal return false z kodu bo ci konczy tam funkcje albo nie dawaj "else if" tylko samo "if" z kazdym id z broni i na koncu dawaj returna jezeli potrzebna ci informacja

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Tagi: blokowanie :: strzału :: nie :: działa
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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