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

Wysłany: 2016-07-22, 14:24


_Haze

Peace Yo!






Wiek: 25
Na forum: 4325 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

Hej mam pewien b??d insertuje po stronie serwera przy rejestracji startowe itemy i testowa?em czy wszystko dzia?a i natkn??em si? na b??d kt?rego nie moge naprawi?. Mianowicie chodzi i to ?e mam 2itemy "Pieni?dze" i "jablko" mam w 1slocie "Pieni?dze" ale i klikam na oboj?tnie jaki slot to dzia?a tylko "Pieni?dze".
Nie wiem zbytnio o co chodzi bo wcze?niej dzia?a?o mi normalnie musia?em co? przez przypadek zmieni? i teraz nie mam poj?cia o co chodzi ;d
Strona clienta
function isCursorOnElement(x,y,w,h)
    local mx,my = getCursorPosition ()
    local fullx,fully = guiGetScreenSize()
    cursorx,cursory = mx*fullx,my*fully
    if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
        return true
    else
        return false
    end
end
asd = 0

local screenW, screenH = guiGetScreenSize()
i = {}
 i[1] = ""
 i[2] = ""
 i[3] = ""
 i[4] = ""
 i[5] = ""
 i[6] = ""
 i[7] = ""
 i[8] = ""
 i[9] = ""
 i[10] = ""
 i[11] = ""
 i[12] = ""

addEvent("giveInv",true)
function invgive(inv1,inv2,inv3,inv4,inv5,inv6,inv7,inv8,inv9,inv10,inv11,inv12)
 i[1] = tostring(inv1)
 i[2] = tostring(inv2)
 i[3] = tostring(inv3)
 i[4] = tostring(inv4)
 i[5] = tostring(inv5)
 i[6] = tostring(inv6)
 i[7] = tostring(inv7)
 i[8] = tostring(inv8)
 i[9] = tostring(inv9)
 i[10] = tostring(inv10)
 i[11] = tostring(inv11)
 i[12] = tostring(inv12)
end
addEventHandler("giveInv",root,invgive)

    
interakcja = {
    ["jablko"] = function() outputChatBox("jesz jablko hehe",255,255,255,true) end,
    ["Pieni?dze"] = function() outputChatBox("#00ff00Posiadasz ich: "..getPlayerMoney(localPlayer),255,255,255,true) end,
}


addEventHandler("onClientRender", root,
    function()
        if asd == 1 then
        dxDrawRectangle(screenW * 0.6750, screenH * 0.3919, screenW * 0.3206, screenH * 0.4544, tocolor(133, 247, 0, 150), false)
        dxDrawRectangle(screenW * 0.6823, screenH * 0.4049, screenW * 0.3067, screenH * 0.4284, tocolor(0, 0, 0, 200), false)
        dxDrawRectangle(screenW * 0.6896, screenH * 0.4180, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawRectangle(screenW * 0.6896, screenH * 0.5404, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawRectangle(screenW * 0.6896, screenH * 0.6628, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawRectangle(screenW * 0.7643, screenH * 0.4180, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawRectangle(screenW * 0.7643, screenH * 0.5404, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawRectangle(screenW * 0.8389, screenH * 0.4180, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawRectangle(screenW * 0.9136, screenH * 0.4180, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawRectangle(screenW * 0.8389, screenH * 0.5404, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawRectangle(screenW * 0.9143, screenH * 0.5404, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawRectangle(screenW * 0.7643, screenH * 0.6628, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawRectangle(screenW * 0.8389, screenH * 0.6628, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawRectangle(screenW * 0.9143, screenH * 0.6628, screenW * 0.0673, screenH * 0.1094, tocolor(133, 247, 0, 100), false)
        dxDrawText(i[1], screenW * 0.6896, screenH * 0.4193, screenW * 0.7570, screenH * 0.5273, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText(i[2], screenW * 0.7643, screenH * 0.4193, screenW * 0.8316, screenH * 0.5273, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText(i[3], screenW * 0.8389, screenH * 0.4193, screenW * 0.9063, screenH * 0.5273, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText(i[4], screenW * 0.9143, screenH * 0.4193, screenW * 0.9817, screenH * 0.5273, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText(i[5], screenW * 0.6896, screenH * 0.5404, screenW * 0.7570, screenH * 0.6484, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText(i[6], screenW * 0.7643, screenH * 0.5404, screenW * 0.8316, screenH * 0.6484, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText(i[7], screenW * 0.8389, screenH * 0.5404, screenW * 0.9063, screenH * 0.6484, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText(i[8], screenW * 0.9136, screenH * 0.5417, screenW * 0.9810, screenH * 0.6497, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText(i[9], screenW * 0.6896, screenH * 0.6615, screenW * 0.7570, screenH * 0.7695, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText(i[10], screenW * 0.7643, screenH * 0.6641, screenW * 0.8316, screenH * 0.7721, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText(i[11], screenW * 0.8389, screenH * 0.6628, screenW * 0.9063, screenH * 0.7708, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText(i[12], screenW * 0.9136, screenH * 0.6628, screenW * 0.9810, screenH * 0.7708, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        end
    end
)

bindKey("I", "up",function()
if asd == 0 then 
triggerServerEvent("pobierzSloty",localPlayer,localPlayer)
asd = 1 
showCursor(true)
else
showCursor(false)
asd = 0
end
end)


addEventHandler("onClientClick", root,function()
        if isCursorOnElement(screenW * 0.6896, screenH * 0.4193, screenW * 0.7570, screenH * 0.5273) and getKeyState("mouse1") then
            if interakcja[i[1]] then
                interakcja[i[1]]()
            end
        elseif isCursorOnElement(screenW * 0.7643, screenH * 0.4193, screenW * 0.8316, screenH * 0.5273) and getKeyState("mouse1") then
            if interakcja[i[2]] then
                interakcja[i[2]]()
            end
        elseif isCursorOnElement(screenW * 0.8389, screenH * 0.4193, screenW * 0.9063, screenH * 0.5273) and getKeyState("mouse1") then
            if interakcja[i[3]] then
                interakcja[i[3]]()
            end
        elseif isCursorOnElement(screenW * 0.9143, screenH * 0.4193, screenW * 0.9817, screenH * 0.5273) and getKeyState("mouse1") then
            if interakcja[i[4]] then
                interakcja[i[4]]()
            end
        elseif isCursorOnElement(screenW * 0.6896, screenH * 0.5404, screenW * 0.7570, screenH * 0.6484) and getKeyState("mouse1") then
            if interakcja[i[5]] then
                interakcja[i[5]]()
            end
        elseif isCursorOnElement( screenW * 0.7643, screenH * 0.5404, screenW * 0.8316, screenH * 0.6484) and getKeyState("mouse1") then
            if interakcja[i[6]] then
                interakcja[i[6]]()
            end
        elseif isCursorOnElement(screenW * 0.8389, screenH * 0.5404, screenW * 0.9063, screenH * 0.6484) and getKeyState("mouse1") then
            if interakcja[i[7]] then
                interakcja[i[7]]()
            end
        elseif isCursorOnElement(screenW * 0.9136, screenH * 0.5417, screenW * 0.9810, screenH * 0.6497) and getKeyState("mouse1") then
            if interakcja[i[8]] then
                interakcja[i[8]]()
            end
        elseif isCursorOnElement(screenW * 0.6896, screenH * 0.6615, screenW * 0.7570, screenH * 0.7695) and getKeyState("mouse1") then
            if interakcja[i[9]] then
                interakcja[i[9]]()

            end
        elseif isCursorOnElement(screenW * 0.7643, screenH * 0.6641, screenW * 0.8316, screenH * 0.7721) and getKeyState("mouse1") then
            if interakcja[i[10]] then
                interakcja[i[10]]()

            end
        elseif isCursorOnElement(screenW * 0.8389, screenH * 0.6628, screenW * 0.9063, screenH * 0.7708) and getKeyState("mouse1") then
            if interakcja[i[11]] then
                interakcja[i[11]]()

            end
        elseif isCursorOnElement(screenW * 0.9136, screenH * 0.6628, screenW * 0.9810, screenH * 0.7708) and getKeyState("mouse1") then
            if interakcja[i[12]] then
                interakcja[i[12]]()
            end
        end

end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-22, 15:03


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Hazmudex, zobacz na wiki co pisz? o funkcji:

Więcej informacji znajdziesz w Wikipedii MTA:

IsCursorOnElement


bool isCursorOnElement( int x, int y, int width, int height )



Cytat:


x: The X absolute position at the Screen.
y: The Y absoulte position at the Screen.
width: The absolute width of the Area.
height: The absolute height of the Area.


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-22, 15:31


_Haze

Peace Yo!






Wiek: 25
Na forum: 4325 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

rozumiem to ale co to ma do tego i jak mam inaczej to zrobic

Postaw piwo autorowi tego posta
 

 
Tagi: system :: inventory :: (client)
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