Jump to content

fairyoggy

Members
  • Posts

    269
  • Joined

  • Last visited

Everything posted by fairyoggy

  1. @N3xT Can I have an example with this function? I do not understand how to apply it correctly
  2. Hello! I have edit. How do I make a restriction for the first character? I Mean For example, so that the first character was just with a capital letter smth like that but only for first symbol DGS:dgsEditSetWhiteList(Edit ,"[^a-zA-Z]") Example: hello - wrong Hello - good
  3. @IIYAMA Used your code local players = getElementsByType("player", root, true) for i=1, #players do local player = players[i] local fullName = tostring(getElementData(player, "fullName") or "") DGS:dgsSetText ( tester2owibka123, fullName.."_") I do not understand what it gives. After restarting the values are different and should be Lyashko_Lolka Lyashko = fname Lolka = sname What's wrong? function onClientRender() local cx, cy, cz, lx, ly, lz = getCameraMatrix() for k, player in pairs(g_StreamedInPlayers) do if isElement(player) and isElementStreamedIn(player) then do local vx, vy, vz = getPedBonePosition(player, 8) local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz) if dist < drawDistance and isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false) then local x, y = getScreenFromWorldPosition(vx, vy, vz + 0.3) if x and y then local name = getPlayerName(player) local id = getElementData ( player, "ID", s_id ) local w = dxGetTextWidth(name, 1, "default-bold") local h = dxGetFontHeight(1, "default-bold") local name3 = DGS:dgsGetText(rpnickname) dxDrawText("#FFFFFF"..name3.."#1E90FF ["..id.."]", x - 2 - w / 2, y - 0 - h - 12, w, h, tocolor(255, 0, 0), 1, "default-bold","left","top",false,false,false,true) local health = getElementHealth(player) local armour = getPedArmor(player) if health > 0 then local rate = 500 / getPedStat(player, 24) drawHPBar(x, y - 6, health * rate, dist) if armour > 0 then drawArmourBar(x, y - 12, armour, dist) end end end end end else table.remove(g_StreamedInPlayers, k) end end end addEventHandler("onClientRender", root, onClientRender) @IIYAMA This is a script displaying health, armor, nickname and id . And I need to instead of "getPlayerName(player)" need "First _ SecondName"(fname_sname) from table .db
  4. @IIYAMA how to fix this problem in my code?
  5. --label rpnickname = DGS:dgsCreateLabel(100,310,100,40,"Nick:",false) addEvent ( "DBTABLE" , true ) addEventHandler ( "DBTABLE" , root , function ( Table ) local d1 = Table[1]["fname"] local d2 = Table[1]["sname"] if Table and #Table > 0 then DGS:dgsSetText ( rpnickname, d1.."_"..d2) end end ) -- display nick in other function local name3 = DGS:dgsGetText(rpnickname) The database has data (fname = first name, sname = second name) Each player is different, indicated by the player himself during registration. I made the player see his name like that: FirstName_SecondName but now the player sees his name above ALL PLAYERS but i need to do so that everyone would have a different nickname above their heads (which they type in register(fname and sname field in .db) What am I doing wrong? How to fix it For example, you entered during registration in the field(fname = Alex, sname = Faber) and now you will see this nickname above ALL PLAYERS. NOW IT"S DONE BUT I need to make sure everyone has their own nickname(fname, sname) and this should see all players
  6. and how to make that united in 1 label. (fname and sname)
  7. local dbSecurityConnection = dbConnect( 'sqlite', 'accs.db') local getAnswerData = dbQuery( dbSecurityConnection, ' SELECT `fname`,`sname` FROM `accountsSecurity` WHERE Login = ? ', getAccountName(getPlayerAccount(source)) ) local result = dbPoll( getAnswerData, -1 ) if result then for rid, row in ipairs ( result) do for column, value in pairs ( row ) do end local fname = row["fname"] local sname = row["sname"] outputChatBox (fname..'_'..sname, source, 0, 255, 0, true ) end end end How do I use this on the client side? I mean, for example, I have a label on a client And how to make "fname" from server side to client in this label? smth like that guiSetText ( myLabel, fname )
  8. fairyoggy

    dbQuery

    local dbSecurityConnection = dbConnect( 'sqlite', 'accs.db') local getAnswerData = dbQuery( dbSecurityConnection, ' SELECT `fname`,`sname` FROM `accountsSecurity` WHERE Login = ? ', getAccountName(getPlayerAccount(source)) ) local result = dbPoll( getAnswerData, -1 ) if result then for rid, row in ipairs ( result) do for column, value in pairs ( row ) do end local fname = row["fname"] local sname = row["sname"] outputChatBox (fname..'_'..sname, source, 0, 255, 0, true ) end end end How do I use this on the client side? I mean, for example, I have a label on a client And how to make "fname" from server side to client in this label? smth like that guiSetText ( myLabel, fname )
  9. fairyoggy

    dbQuery

    local dbSecurityConnection = dbConnect( 'sqlite', 'accs.db') local getAnswerData = dbQuery( dbSecurityConnection, ' SELECT `fname` FROM `accountsSecurity` WHERE Login = ? ', getAccountName(getPlayerAccount(source)) ) local checkAnswerValue = dbPoll( getAnswerData, -1 ) local getAnswerData2 = dbQuery( dbSecurityConnection, ' SELECT `sname` FROM `accountsSecurity` WHERE Login = ? ', getAccountName(getPlayerAccount(source)) ) local checkAnswerValue2 = dbPoll( getAnswerData2, -1 ) for rid, row in ipairs (checkAnswerValue2) do -- row represents the tables that are in 'result', which represent the rows for column, value in pairs (row) do -- column represents column name, value represents column value outputChatBox(column..'_'..value) end end Did this way. In the chat, the column name is displayed and it contains . How to make the chat displayed 2 columns at once? outputChatBox(column..'_'..value) Instead column.. need getAnswerData(fname) How it's correctly ?
  10. fairyoggy

    dbQuery

    connection = dbConnect("sqlite", "accs.db") queryhandle = dbQuery( connection, 'SELECT * FROM accountsSecurity') result = dbPoll(queryhandle, -1) for rid, row in ipairs (result) do -- row represents the tables that are in 'result', which represent the rows for column, value in pairs (row) do -- column represents column name, value represents column value outputChatBox(column..', '..value) end end I need it to work like this, just need to select a specific column, and not the whole table.
  11. fairyoggy

    dbQuery

    local accountName = getPlayerAccount(source) local qh = dbQuery(dbSecurityConnection, "SELECT `fname` FROM `accountsSecurity` WHERE " ..accountName.. " = `login` LIMIT 1" ) outputChatBox( 'Ваш ник: '..qh, source, 255, 0, 0, true ) fname = name accountsSecurity = 123 What am I doing wrong?
  12. fairyoggy

    dbQuery

    Earlier I used elementData only values in numbers. Can this be used in words?
  13. Создал таблицу с названием "123" , которая имеет столбцы с названием login, nameСоздавал с помощью dbQuery . Как мне сделать вывод в чат содержащее в колонке name?Вот такое outputToChat(" " ..getPlayerName(source).. " say: " ..message, v, 255, 100, 200, true) Только вместо getPlayerName(source) нужна информация из колонки "name"
  14. fairyoggy

    dbQuery

    Created a table called "123" with columns "login, "name" Created a table with dbQuery How can I make a chat message from the column "name" ? or just in label Smth like that outputToChat(" " ..getPlayerName(source).. " say: " ..message, v, 255, 100, 200, true) but instead getPlayerName(source) need information from the column (name)
  15. I need to write a function. That would work just like with a standard id in internal.db I mean There is a window with a button and label And when the button is pressed in the label appears figure "0001" when you press the second time "0002" and so on up to 9999 When the number 9999 arrives, the countdown begins anew 0001 And all this should be saved. Can you help me?
  16. fairyoggy

    Edit

    I decided it is much easier, but thanks for the answer!
  17. Задача немного изменилась, У меня есть 3 эдита. Edit1 = PasseditBox Edit2 = LogineditBox Edit3 = Hello Если я впишу в editт 1 текст "444" то в edit2 впишется текст 321. Как мне сделать так, что бы если edit1=edit2 тогда впишется "321" в edit3? if (DGS:dgsGetText(PasseditBox) == "444") then DGS:dgsSetText(LogineditBox , "321") else DGS:dgsSetText(LogineditBox , "")
  18. fairyoggy

    Edit

    The task has changed a bit if (DGS:dgsGetText(PasseditBox) == "444") then DGS:dgsSetText(LogineditBox , "321") else DGS:dgsSetText(LogineditBox , "") I did so what if I type in PasseditBox = "444" then LogineditBox = "321" How to make it so that if edit 1 = edit 2 then text will be "321" in edit3 Edit 1 = PasseditBox Edit 2 = LogineditBox Edit 3 = Hello
  19. Помогите решить элементарную задачу, не могу решить, ужас. Вообщем есть Edit1 , если в него вписать текст, например, "123" тогда в Edit2 запишется текст "321" Как это сделать?
  20. fairyoggy

    Edit

    Hello! how to write correctly? If in edit1 write text "123" then edit 2 will be "321" I can not solve such an easy task. Horror
  21. and how to make it work on the server side? Ie other players do not see the change in these numbers
  22. Another question, how to make the numbers saved? On the local player, they are saved after restarting the script, but on "NewElement" not save How to save these numbers for variable "NewElement" or create xml file and to keep these numbers there, and then read. The main thing to do is save, the method is not important
×
×
  • Create New...