-
Posts
269 -
Joined
-
Last visited
Everything posted by fairyoggy
-
Did as you wrote, and used for display number dxDrawText("Мясо: "..math.floor(meatnz).." ед", 1800*x, 750*y, 1670*x, 25*y, tocolor(255, 255, 255, 255), 2, "Arial", "center", "center", false, false, true, true, false) newElement = createPickup (1322.2575683594,358.23822021484,19.5546875, 3, 2663, 1, 1 ) function HudOpening () local meatn = getElementData(localPlayer, "meat") or 0 local meatnz = getElementData(newElement, "meat") or 0 dxDrawText("Мясо: "..math.floor(meatnz).." ед", 1800*x, 750*y, 1670*x, 25*y, tocolor(255, 255, 255, 255), 2, "Arial", "center", "center", false, false, true, true, false) end addEventHandler("onClientRender",root,HudOpening) local player = getLocalPlayer() function initGUI( ) --showCursor(true) btnOutput = DGS:dgsCreateButton( 0.7, 0.1, 0.2, 0.1, "+", true ) addEventHandler ( "onDgsMouseClick", btnOutput, outputEditBox ) end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), initGUI ) function outputEditBox ( button, state) if button == "left" and state == "down" then if (newElement) then setElementData(newElement, "meat", (getElementData(newElement, "meat") or 0) + 10) --triggerServerEvent( "m9cko", root, 0, 24, 35 ) end end end Not working, what am I doing wrong or again I do not understand It works as intended for localplayer and used in server part: function hhh () takePlayerMoney(client,2) setElementData(client, "meat", (getElementData(client, "meat") or 0) + 10) end addEvent("m9cko",true) addEventHandler("m9cko",root,hhh) UPDATE: SOLVED. Your example helped me a lot. Did everything as intended. Thank you all very much for the answers.
-
I do not understand how I use it to work like for Locaplayer but now for new variable.
-
local newElement = createElement("elementName") local meatn = getElementData(localPlayer, "meat") or 0 -- old local meatn = getElementData(elementName, "meat") or 0 -- new -- setElementData(client, "meat", (getElementData(client, "meat") or 0) + 10) -- old with localplayer setElementData(elementName, "meat", (getElementData(elementName, "meat") or 0) + 10) -- new And how to use it correctly?
-
--client function HudOpening () local meatn = getElementData(localPlayer, "meat") or 0 dxDrawText("Meat: "..math.floor(meatn).." ед", 1800*x, 750*y, 1670*x, 25*y, tocolor(255, 255, 255, 255), 2, "Arial", "center", "center", false, false, true, true, false) end addEventHandler("onClientRender",root,HudOpening) function initGUI( ) btnOutput = DGS:dgsCreateButton( 0.7, 0.1, 0.2, 0.1, "+", true ) addEventHandler ( "onDgsMouseClick", btnOutput, outputEditBox ) end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), initGUI ) function outputEditBox ( button, state ) if button == "left" and state == "down" then triggerServerEvent( "m9cko", getLocalPlayer(), 0, 24, 35 ) end end --server function hhh () takePlayerMoney(client,2) setElementData(client, "meat", (getElementData(client, "meat") or 0) + 10) end addEvent("m9cko",true) addEventHandler("m9cko",getRootElement(),hhh) ElementData = meatn When I press the button, it is added +10 (meat) for localplayer Everything works as it should, but how do I bind to some object or marker, or create a separate variable for this ElementData(not localPlayer) local meatn = getElementData(localPlayer, "meat") or 0 I mean Instead "localplayer" Create a variable instead or bind to an object. How to do it? --client local meatn = getElementData(localPlayer, "meat") or 0 --server setElementData(client, "meat", (getElementData(client, "meat") or 0) + 10) I just need instead "localPlayer", "client" create a variable that is not bound to the Localplayer.
-
Thanks for the reply, but I understand what I need to use "triggerServerEvent" but I need an example that I asked. Because I'm still too no experience. Just learning and your example in another topic I can not understand now.
-
Можете дать пример данной процедуры?У меня есть окно с edit и button.Если я напишу в edit(например: привет) тогда в файле internal.db будет создано новое поле с именем(test) для игрока , который ввел эту информацию в edit.Я имею ввиду, когда игрок ввел информацию в edit и нажал кнопку тогда для него в файле internal.db создаст поле (test) с той информацией , которую он ввел в edit. --client DGS = exports.dgs function initGUI( ) showCursor(true) btnOutput = DGS:dgsCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) addEventHandler ( "onDgsMouseClick", btnOutput, outputEditBox ) editBox = DGS:dgsCreateEdit( 0.3, 0.1, 0.4, 0.1, "Type your message here!", true ) end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), initGUI ) function outputEditBox ( button, state ) if button == "left" and state == "down" then end end
-
Can you write an example? I have a window with Edit and button I will write in edit(example: Hello) and in the file internal.db will be create a new field(field name = test) for player(who enters the text in edit) I mean, when a player enters the text in edit and press button then field will be create. --client DGS = exports.dgs function initGUI( ) showCursor(true) btnOutput = DGS:dgsCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) addEventHandler ( "onDgsMouseClick", btnOutput, outputEditBox ) editBox = DGS:dgsCreateEdit( 0.3, 0.1, 0.4, 0.1, "Type your message here!", true ) end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), initGUI ) function outputEditBox ( button, state ) if button == "left" and state == "down" then end end Can you help me?
-
addEventHandler("onDgsMouseClick", root, function() local sw, sh = guiGetScreenSize() local px, py = sw/1920,sh/1080 local myfontt = DGS:dgsCreateFont( "fonts/Roboto-Medium.ttf", 9 ) if source == buttont then if (DGS:dgsCheckBoxGetSelected(v11) ~= true) and (DGS:dgsCheckBoxGetSelected(v12) ~= true) and (DGS:dgsCheckBoxGetSelected(v13) ~= true) and (DGS:dgsCheckBoxGetSelected(v14) ~= true) then vibot1 = DGS:dgsCreateLabel(210,130,20,40,"Choose Answer!",false,vopros1) DGS:dgsLabelSetColor ( vibot1, tocolor(255, 0, 0, 255 ) ,true ) DGS:dgsSetFont(vibot1,myfontt) playSoundFrontEnd ( 4 ) else ... Hello! If checkboxes = false then Label and sound appears BUT If you press the button without releasing the left click(mouse) It works fine, but when you release the left mouse button then Label and sound are played again. How to fix it?
-
I use standard internal.db When a player registers, how to add a new field to the database? a new field there with the name TEST and have the properties of true and false
-
У меня есть два окна, после того как на первом окне нажимаешь кнопку отрисовывается второе окно, на котором изначально кнопка имеет свойство SetEnabled(false) , я сделал функцию спустя 2 секунды кнопка имеет свойство SetEnabled(true) , НО это только с момента старта скрипта, а мне нужно сделать так что бы этот таймер срабатывал после нажатия на кнопку на первом окне, как это сделать? setTimer( function() DGS:dgsSetEnabled ( buttAC2, true ) end, 2000, 1, root, source )
-
I have two windows, after the button is pressed on the first window , a second window starts to appear which has a button with the property (SetEnabled(false)) I made a function that after 2 seconds makes this property true BUT it works only after the start of the script How can I make this timer work after pressing the button on the first window? setTimer( function() DGS:dgsSetEnabled ( buttAC2, true ) end, 2000, 1, root, source )
-
Вопрос решен.
-
I solved this question, thanks for the answers.
-
If you just select (v11) open window6 - it's fine if you just select (v12) nothing happens ( need open window6) if you just select (v13) open window6 - it's fine if you just select (v14) nothing happens (need open window6) if you just select (v11 and v12) nothing happens(need open window6) if you just select (v11 and v13) open window6 - it's fine if you just select (v11 and v14) nothing happens(need open window6) if you select (v11 and v12 and v14) open window5 - and it is necessary that only when selected only (v12 and v14) Maybe I did not put it exactly what I want, but can you help me with this? and if none of the checkboxes are selected - open windows6 how to do it?
-
if source == bv2 then if DGS:dgsCheckBoxGetSelected(v12,true) then if DGS:dgsCheckBoxGetSelected(v14,true) then window5 = DGS:dgsCreateWindow((sw-424)/2,(sh-363)/2,400,200,"+",false) else if DGS:dgsCheckBoxGetSelected(v12,false) then else if DGS:dgsCheckBoxGetSelected(v14,false) then window6 = DGS:dgsCreateWindow((sw-424)/2,(sh-363)/2,400,200,"-",false) bv2 - кнопкаУ меня есть 4 чекбокса (v11,v12,v13,v14) Когда игрок нажимает на чекбоксы (v12 и v14) открывается окно5(это я сделал), но мне еще нужно когда чекбоксы не выбраны вообще тогда открывается окно6. Я имею ввиду еще такие примеры (когда выбран чекбокс v11 и v14 - открывается окно6, или выбран v12 и v13 также открывается окно6, и так далее) , но когда выбраны чекбосы (v12 и v14) открывается окно5.Как мне правильно сделать? Что то я не шарю. Первая часть кое как работает, а вторая нет. Я использую DGS(https://wiki.multitheftauto.com/wiki/Resource:Dgs) , но можно и пример на обычном CEGUI. Помогите.Я использовал еще код таким образом, вторая часть (elseif) все равно не работает должным образом if source == bv2 then if DGS:dgsCheckBoxGetSelected(v12,true) and DGS:dgsCheckBoxGetSelected(v14,true) then window5 = DGS:dgsCreateWindow((sw-424)/2,(sh-363)/2,400,200,"+",false) elseif DGS:dgsCheckBoxGetSelected(v12,false) and DGS:dgsCheckBoxGetSelected(v14,false) then window6 = DGS:dgsCreateWindow((sw-424)/2,(sh-363)/2,400,200,"-",false) end end
-
for v12 and v14 - true it's work fine but for elseif DGS:dgsCheckBoxGetSelected(v12,false) and DGS:dgsCheckBoxGetSelected(v14,false) then window6 = DGS:dgsCreateWindow((sw-424)/2,(sh-363)/2,400,200,"-",false) didn't work
-
if source == bv2 then if DGS:dgsCheckBoxGetSelected(v12,true) then if DGS:dgsCheckBoxGetSelected(v14,true) then window5 = DGS:dgsCreateWindow((sw-424)/2,(sh-363)/2,400,200,"+",false) else if DGS:dgsCheckBoxGetSelected(v12,false) then else if DGS:dgsCheckBoxGetSelected(v14,false) then window6 = DGS:dgsCreateWindow((sw-424)/2,(sh-363)/2,400,200,"-",false) bv2 - button There are 4 checkboxes .(v11,v12,v13,v14) When a player chooses checkboxes(v12 and v14) window5 open(it's fine) but i need when this checkboxes not selected then windows6 show. I mean (example you select v11 and v14 - window6 will be show or select v12 and v13 also window6 will be show or noone checkbox selected - windows6 will be show and etc) but when select v12 and v14 window5 will be open. How it's work? The first part works fine but second didn't work. I use dgs. https://wiki.multitheftauto.com/wiki/Resource:Dgs You can explain the example of CEGUI if can't on dgs.
-
hello! example: i have 2 windows with checkbox On each window 4 checkboxes. Only 1 checkbox with the correct answer for each window(a total of 2 correct checkboxes for two windows together). Total checkboxes 8 for two windows. So.. On the first window, the correct answer will be checkbox number 3. In the second window, the correct answer will be checkbox number 1. How do I make it so that if a player chooses the wrong checkboxes, a message would appear "You answered wrong" , If the player answered correctly "Congratulations you answered correctly"
-
I use your code (0.5,0.5,0.2,0.2). How to get the center point for 1920/1080 resolution. The window is not centered with that coordinates done.
-
How can I use this to, for example, optimize resolutions? Here are some strange numbers of coordinates Example: ruless = DGS:dgsCreateWindow(0.31,0.38,0.382,0.40,"Правила",true) There are small numbers of coordinates and I do not quite understand how it works. If in a normal window I had coordinates, for example (300,300,300,300) but here (0.31, 0.38, 0.382, 0.40) For normal windows I used optimization like that: local sW, sH = guiGetScreenSize() ((sW/2)-(300/2),(sH/2)-(300/2),300,300) I tried to do the same with the new coordinates like this (0.31,0.38,0.382,0.40) but the window disappeared or gone beyond screen radius. How it works ? Because I ran into problems at different screen resolutions.
-
memos = guiCreateMemo(15, 20, 370, 130,"Hello How are you?Hello How are you?Hello How are you?Hello How are you?Hello How are you?",false,ruless) See the end of the line - Hello How are you? He(and the rest of the word has gone beyond the region). How to fix it?
