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

Wysłany: 2019-12-15, 11:38


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

Witam posiadam skrypt na kupno broni lecz gdy wchodze w marker wyskakuje gui wszyskim :/
client.lua
-- Enkanet Scripting Lab © 2015 - All rights are reserved.
local shopkeeper createPed(179,269.014562027.3664617.64063)
setElementFrozen(shopkeepertrue)
local weaponmarker createMarker(268.992802029.2542716.64063'cylinder'2.025500150)
local player getLocalPlayer()

function weaponGui ()
        local screenWscreenH guiGetScreenSize()
        guiwindow guiCreateWindow400250663162"Weapon Shop System - Enkanet v1.0.0 [5.1.2015]"false)
        guiWindowSetSizable(guiwindowfalse)

        button1 guiCreateButton(103216454"Colt 45 - Ammo 200 \n$1250 \nBuy"falseguiwindow)
        button2 guiCreateButton(1843216454"Desert Eagle - Ammo 200 \n$1750\nBuy"falseguiwindow)
        button3 guiCreateButton(3583216454"M4 - Ammo 200 \n$3000\nBuy"falseguiwindow)
        button4 guiCreateButton(5293212454"Sniper - Ammo 200 \n$7000\nBuy"falseguiwindow)
        button5 guiCreateButton(1010116442"Close"falseguiwindow)
        addEventHandler("onClientGUIClick"button5btnClosefalse)
        addEventHandler("onClientGUIClick"button1btnColtfalse)
        addEventHandler("onClientGUIClick"button2btnDeaglefalse)
        addEventHandler("onClientGUIClick"button3btnM4false)
        addEventHandler("onClientGUIClick"button4btnSniperfalse)
end
addEventHandler("onClientResourceStart"getRootElement(), weaponGui)
addEventHandler("onClientResourceStart"getRootElement(), function() guiSetVisible(guiwindowfalseend)

function markerhit (playerweaponmarker)
    guiSetVisible(guiwindowtrue)
    showCursor(true)
end
addEventHandler("onClientMarkerHit"weaponmarkermarkerhit)

function btnClose(button5)
    guiSetVisible(guiwindowfalse)
    showCursor(false)
end

function btnColt(button1thePlayer)
    local money getPlayerMoney(thePlayer)
    if (money 1250) or (money == 1250then
        triggerServerEvent("giveweaponPistol"root)
    else
        outputChatBox("You can't afford to buy this Colt 45"2550,0)    
    end
end

function btnDeagle(button2thePlayer)
    local money getPlayerMoney(thePlayer)
    if (money 1750) or (money == 1750then
        triggerServerEvent("giveweaponDeagle"root)
    else
        outputChatBox("You can't afford to buy this Desert Eagle"2550,0)    
    end
end

function btnM4(button3thePlayer)
    local money getPlayerMoney(thePlayer)
    if (money 3000) or (money == 3000then
        triggerServerEvent("giveweaponM4"root)
    else
        outputChatBox("You can't afford to buy this M4"2550,0)    
    end
end

function btnSniper(button4thePlayer)
    local money getPlayerMoney(thePlayer)
    if (money 7000) or (money == 7000then
        triggerServerEvent("giveweaponSniper"root)
    else
        outputChatBox("You can't afford to buy this Sniper"2550,0)    
    end
end
-- Enkanet Scripting Lab © 2015 - All rights are reserved.


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-15, 12:43


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Sprawd? czy gracz, kt?ry wszed? w marker to lokalny gracz (localPlayer lub getLocalPlayer()).

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-15, 14:52


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

No to jest tutaj localplayer:
-- Enkanet Scripting Lab © 2015 - All rights are reserved.
local shopkeeper createPed(179,269.014562027.3664617.64063)
setElementFrozen(shopkeepertrue)
local weaponmarker createMarker(268.992802029.2542716.64063'cylinder'2.025500150)
local player getLocalPlayer()


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-15, 15:28


BlueCry

ŚĆRIPTER LUJA






Wiek: 25
Na forum: 4006 dni
Posty: 78
Nick w MP: BlueCry

Piwa: 2176

Respekt: 110
Respekt: 110

Podmie?
function markerhit (playerweaponmarker)
    guiSetVisible(guiwindowtrue)
    showCursor(true)
end
addEventHandler("onClientMarkerHit"weaponmarkermarkerhit)

Na
addEventHandler("onClientMarkerHit"weaponmarker, function(el,md)
        if el==localPlayer then
 guiSetVisible(guiwindowtrue)
    showCursor(true)
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-15, 16:09


Fl!k







Wiek: 26
Na forum: 3592 dni
Posty: 162

Piwa: 18

Respekt: 50

Dzieki juz dzia?a tylko teraz jest problem z tym ze jak kupisz bron to kazy to widzi i kazy ja dostaje a nie tylko dana osoba :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-12-15, 16:19


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Triggeruj event (triggerServerEvent) tylko dla lokalnego gracza, a nie wszystkich (u siebie masz root w kodzie). Mo?e teraz sam co? zrobisz? :mrgreen:
Rozwi?zanie podane:

Więcej informacji znajdziesz w Wikipedii MTA:

triggerServerEvent


Postaw piwo autorowi tego posta
 

 
Tagi: gui
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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