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

Wysłany: 2023-03-23, 21:15


Mateuszkropkaaa







Wiek: 29
Na forum: 3008 dni
Posty: 9
Nick w MP: Mateuszkropkaaa

Piwa: 47

Respekt: 50

Mam problem z tworzeniem organizacji gdy chce ja stworzyc i wpisac nazwe organizacji i kliknac utw?rz, organizacja sie nie tworzy a w debugu wyskakuje taki owy b??d:

c_client.Jua:83: attempt to compare boolean with numb [DUP x4]

Kod:

--[[
unrealMTA @ 2020
autor zasobu: Chojnas
]]--

local sx, sy = guiGetScreenSize()
local zoom = sx < 1920 and math.min(2, 1920 / sx) or 1

local requirements = {
cost = 8000000,
reputation = 2000,
}

local fonts = {
[1] = exports['dmta_fontsystem']:getFont('opensans', 'bold', 18),
[2] = exports['dmta_fontsystem']:getFont('opensans', 'semibold', 13),
}
local cache = {}
cache.marker = createMarker(-2634.77, -11.85, 6.13-0.8, 'cylinder', 1)

--[[
KOD
]]--

local function dxDrawRoundedRectangle(x, y, width, height, radius, color, postGUI, subPixelPositioning)
dxDrawRectangle(x+radius, y+radius, width-(radius*2), height-(radius*2), color, postGUI, subPixelPositioning)
dxDrawCircle(x+radius, y+radius, radius, 180, 270, color, color, 16, 1, postGUI)
dxDrawCircle(x+radius, (y+height)-radius, radius, 90, 180, color, color, 16, 1, postGUI)
dxDrawCircle((x+width)-radius, (y+height)-radius, radius, 0, 90, color, color, 16, 1, postGUI)
dxDrawCircle((x+width)-radius, y+radius, radius, 270, 360, color, color, 16, 1, postGUI)
dxDrawRectangle(x, y+radius, radius, height-(radius*2), color, postGUI, subPixelPositioning)
dxDrawRectangle(x+radius, y+height-radius, width-(radius*2), radius, color, postGUI, subPixelPositioning)
dxDrawRectangle(x+width-radius, y+radius, radius, height-(radius*2), color, postGUI, subPixelPositioning)
dxDrawRectangle(x+radius, y, width-(radius*2), radius, color, postGUI, subPixelPositioning)
end

local function render()
dxDrawRoundedRectangle(sx/2-258/zoom, sy/2-250/zoom, 516/zoom, 500/zoom, 12/zoom, tocolor(12, 12, 14, 195))
dxDrawRoundedRectangle(sx/2-258/zoom, sy/2-250/zoom, 516/zoom, 84/zoom, 12/zoom, tocolor(12, 12, 14, 195))
dxDrawText('Organizacja cywilna', sx/2-242/zoom, sy/2-235/zoom, nil, nil, tocolor(230, 230, 230), 1/zoom, fonts[1])
dxDrawText('UtwĂłrz swoj?… organizacj?™', sx/2-242/zoom, sy/2-208/zoom, nil, nil, tocolor(144, 144, 144), 1/zoom, fonts[2])
dxDrawText('#b5b5b5Korzy?›ci p?‚yn?…ce z posiadania\norganizacji cywilnej:#737373\n- chat organizacyjny\n- przechowalnia organizacyjna\n- 5% z zarobku kaĹĽdego cz?‚onka\n- moĹĽliwo?›?‡ przeprowadzania imprez organizacyjnych', sx/2-238/zoom, sy/2-152/zoom, nil, nil, tocolor(144, 144, 144), 1/zoom, fonts[2], 'left', 'top', false, false, false, true)

dxDrawText('Nazwa organizacji', sx/2-238/zoom, sy/2+16/zoom, nil, nil, tocolor(181, 181, 181), 1/zoom, fonts[2], 'left', 'top', false, false, false, false)
dxDrawText('Wymagania:\n#737373$'..(requirements.cost or '?')..', '..(requirements.reputation or '?')..' reputacji', sx/2-238/zoom, sy/2+100/zoom, nil, nil, tocolor(181, 181, 181), 1/zoom, fonts[2], 'left', 'top', false, false, false, true)
if click(sx/2-233/zoom, sy/2+165/zoom, 450/zoom, 40/zoom) then
createOrganization()
end

if getKeyState("mouse1") and not cache.clickblock then
cache.clickblock = true
elseif not getKeyState("mouse1") and cache.clickblock then
cache.clickblock = false
end
end

local function toggleInterface(bool)
if bool then
showCursor(true, false)
removeEventHandler('onClientRender', root, render)
addEventHandler('onClientRender', root, render)
exports['dmta_buttons']:createButton('UTW?“RZ', sx/2-233/zoom, sy/2+165/zoom, 463/zoom, 40/zoom, 'new_organization:create')
exports['pystories_editbox']:dxCreateEdit("new_organization:editbox", "", "Podaj nazw?™", sx/2-233/zoom, sy/2+35/zoom, 300/zoom, 45/zoom, false, 255, 255, false, false)
else
showCursor(false)
exports['dmta_buttons']:destroyButton('new_organization:create')
exports['pystories_editbox']:dxDestroyEdit('new_organization:editbox')
removeEventHandler('onClientRender', root, render)
end
end

function createOrganization()
if not clickTick or clickTick <= getTickCount()-2500 then
if getElementData(localPlayer, 'player:organization') and getPlayerSerial(localPlayer) ~= '568F90E3F60F0989465E9BBBEA44D7E2' then
exports['dmta_notifications']:noti('JuĹĽ jeste?› w jakiej?› organizacji!', 'error')
return
end

if getPlayerMoney(localPlayer) < requirements.cost then
exports['dmta_notifications']:noti('Nie posiadasz wystarczaj?…co pieni?™dzy!', 'error')
return
end
if getElementData(localPlayer, 'player:srp') < requirements.reputation then
exports['dmta_notifications']:noti('Nie posiadasz wystarczaj?…co reputacji!', 'error')
return
end

local text = exports['pystories_editbox']:dxGetEditText('new_organization:editbox')
if not text or string.len(text) < 4 or string.len(text) > 10 then
exports['dmta_notifications']:noti('Nazwa moĹĽe mie?‡ od 4 do 10 znakĂłw!', 'error')
return
end
clickTick = getTickCount()
triggerServerEvent('new_organization:createOrganization', getResourceRootElement(), requirements.cost, text)
toggleInterface(false)
end
end

addEventHandler('onClientMarkerHit', cache.marker, function(hit, md)
if (hit == localPlayer and md) then
if getPedOccupiedVehicle(localPlayer) then return end
--[[if getElementData(localPlayer, 'player:organization') then
exports['dmta_notifications']:noti('JuĹĽ jeste?› w jakiej?› organizacji!', 'error')
return
end]]--
toggleInterface(true)
end
end)

addEventHandler('onClientMarkerLeave', cache.marker, function(hit, md)
if (hit == localPlayer and md) then
toggleInterface(false)
end
end)

exports['dmta_buttons']:destroyButton('new_organization:create')
exports['pystories_editbox']:dxDestroyEdit('new_organization:editbox')

--[[
assets
]]--

function isMouseInPosition(x, y, w, h)
if not isCursorShowing() then return false end
local cx, cy = getCursorPosition()
local cx, cy = sx*cx, sy*cy
return ((cx >= x and cx <= x+w) and (cy >= y and cy <= y+h))
end

function click(x, y, w, h)
if not cache.clickblock and getKeyState("mouse1") and isMouseInPosition(x, y, w, h) then return true end
return false
end


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-03-24, 11:06


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 3987 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 242

Respekt: 60

if getElementData(localPlayer'player:srp') < requirements.reputation then


to ten problem?
if getElementData(plr'player:srp') < requirements.reputation then

spr?buj

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-03-24, 18:47


Mateuszkropkaaa







Wiek: 29
Na forum: 3008 dni
Posty: 9
Nick w MP: Mateuszkropkaaa

Piwa: 47

Respekt: 50

Podmieni?em i dalej wystepuje ten b??d

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-03-25, 01:21


Norbert1234

Nie umiem w LUA






Wiek: 22
Na forum: 3987 dni
Posty: 319
Nick w MP: Gusterowskyy

Piwa: 242

Respekt: 60

czy elementdata pod rp pasuje jaka tutaj jest?

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-03-25, 12:28


Mateuszkropkaaa







Wiek: 29
Na forum: 3008 dni
Posty: 9
Nick w MP: Mateuszkropkaaa

Piwa: 47

Respekt: 50

Norbert1234, Mozna tw?j dc ?

Komentarz TheSebaPL dodany 2023-03-25, 13:29Pomagamy tylko na forum.
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2023-04-01, 21:37


Absolwencik







Wiek: 29
Na forum: 1498 dni
Posty: 63
Nick w MP: Absolwent

Piwa: 1298

Respekt: 30

Ostrzeżeń: 80%
Kod:


local marker = createMarker(0, 0, 0, "cylinder", 1, 255, 255, 0, 150)

local screenW, screenH = guiGetScreenSize()
local windowW, windowH = 300, 300
local windowX, windowY = (screenW - windowW) / 2, (screenH - windowH) / 2

local createOrgWindow = guiCreateWindow(windowX, windowY, windowW, windowH, "Stw?rz organizacj?", false)
guiWindowSetSizable(createOrgWindow, false)

local orgNameLabel = guiCreateLabel(0.1, 0.2, 0.3, 0.2, "Nazwa organizacji:", true, createOrgWindow)
local orgNameEdit = guiCreateEdit(0.4, 0.2, 0.5, 0.2, "", true, createOrgWindow)

local createOrgButton = guiCreateButton(0.3, 0.6, 0.4, 0.2, "Stw?rz organizacj?", true, createOrgWindow)
guiSetVisible(createOrgWindow, false)

function hasEnoughSRP()
local srpCount = tonumber(getElementData(localPlayer, "player:srp"))
return srpCount and srpCount > 100
end

function createOrg()
local orgName = guiGetText(orgNameEdit)
if orgName ~= "" then
triggerServerEvent("onPlayerCreateOrg", localPlayer, orgName) -- MUSISZ STWORZY? SOBIE TE FUNKCJE.
guiSetVisible(createOrgWindow, false)
outputChatBox("Bla bla bla stworzy?e? organizacje.", 255, 0, 0)
else
outputChatBox("Nazwa organizacji nie mo?e by? pusta!", 255, 0, 0)
end
end

function onMarkerHit(hitElement, matchingDimension)
if hitElement ~= localPlayer or not matchingDimension then return end
if not hasEnoughSRP() then
outputChatBox("Musisz mie? wi?cej ni? 100 punkt?w SRP, aby stworzy? organizacj?!", 255, 0, 0)
return
end

guiSetVisible(createOrgWindow, true)
guiBringToFront(createOrgWindow)

addEventHandler("onClientGUIClick", createOrgButton, createOrg, false)
end
addEventHandler("onClientMarkerHit", marker, onMarkerHit)

-- [[
function createOrgInDatabase(orgName)
-- TUTAJ DODAJ SOBIE ZAPIS ORGANIZACJI PO STWORZENIU, POTEM MO?ESZ SOBIE GO WYWO?A?
end
addEvent("onPlayerCreateOrgInDatabase", true)
addEventHandler("onPlayerCreateOrgInDatabase", root, createOrgInDatabase)
]]


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Tagi: tworzenie :: organizacji
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