Jump to content

Po wjechaniu w marker -okno z przyciskiem spawnującym marker


Recommended Posts

Witam próbuje zrobić skrypt że jak wejdziesz w marker to pokaze sięgui i np jak nacisniesz zbutton to pokaze sie inny marker lecz cały czas jest problem bo jak dałem funkcje na ten 2 marker to ona nie działą pisze że problem z Eventem lecz ja problemu nie widz ...

function kl() 
if (source == sf) then 
niet = createMarker ( -1124.6586914063, -1009.0390625, 129.21875, 'cylinder', 3, 0, 0, 190 ) 
guiSetVisible (akna, false ) 
showCursor (false) 
end 
end 
addEventHandler("onClientGUIClick", sf, kl ) 
  
function mark() 
setElementHealtch (setElementPlayer(),getLocalPlayer(), 90) 
end 
addEventHandler("onClientMarkerHit", niet, mark ) 

Edited by Guest
Link to comment

https://wiki.multitheftauto.com/wiki/SetElementHealth

function kl() 
if (source == sf) then 
local niet = createMarker ( -1124.6586914063, -1009.0390625, 129.21875, 'cylinder', 3, 0, 0, 190 ) 
guiSetVisible (akna, false ) 
showCursor (false) 
end 
end 
addEventHandler("onClientGUIClick", sf, kl ) 
  
function mark() 
local gracz = getLocalPlayer() 
setElementHealth (gracz, 90) 
end 
addEventHandler("onClientMarkerHit", niet, mark ) 

Nie testowane ale spróbuj ;)

Link to comment

Może pochwaliłbyś się swoim logiem z debugu ? Mówisz że wywala błąd z Eventem... a ich trochę może być. Podaj wpis z debugu .

Co do kodu - spróbuj tego : V

function kl() 
if (source == sf) then 
local niet = createMarker ( -1124.6586914063, -1009.0390625, 129.21875, 'cylinder', 3, 0, 0, 190 ) 
guiSetVisible (akna, false ) 
showCursor (false) 
end 
end 
addEventHandler("onClientGUIClick", sf, kl ) 
  
function mark(hitElement) 
if getElementType(hitElement) == "player" then 
outputChatBox ( "Graczu ! Zostałeś uleczony! ", hitElement, 0, 255, 0 ) 
setElementHealth (hitElement, 90) 
end 
addEventHandler("onClientMarkerHit", niet, mark )  

Link to comment

zmienna `niet` tworzona jest dopiero PO kliknieciu czegostam (nazwy zmiennych i funkcji masz TRAGICZNE, z takimi nazwami szybko sie zgubisz we wlasnym kodzie), a ty probujesz przypiac do niej zdarzenie zanim ja utworzysz.

local bodajze ograniczy widocznosc zmiennej tylko do danej funkcji (tu juz zapomnialem, ale we wszystkich jezykach tak jest, wiec tutaj raczej tez)

kod niepoformatowany = kolejne utrudnienia w czytelnosci, brak jednolitosci w pisaniu (zapewne kopiowane kawalkami z roznych zrodel)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...