-
Posts
269 -
Joined
-
Last visited
Everything posted by fairyoggy
-
i use it in "refreshrr" function but didn'e work
-
How to do it? How to open a saved option?
-
function onChatMessage(text) if(string.sub(text,1,6) == "login:" or string.sub(text,1,7) == "logout:") then cancelEvent() end end addEventHandler("onClientChatMessage",root,onChatMessage)
-
how to read the updated file? I mean 1) Added a new line to the file 2) Clear GridList 3) LoadFile But when I upload the file to the grid, there are no new lines, but they were saved to the file --client addEventHandler("onClientGUIClick", root, function () if ( source == buy_report ) then refreshrr() end end end) function refreshrr () guiGridListClear(gridSms) local node = xmlLoadFile ( "reports.xml" ) if ( node ) then local reports = 0 while ( xmlFindChild ( node, "report", reports ) ~= false ) do local report = xmlFindChild ( node, "report", reports ) local row = guiGridListAddRow(gridSms) guiGridListSetItemText(gridSms, row, columnInt1, xmlNodeGetAttribute(report, "vremya" ), false, true ) guiGridListSetItemText(gridSms, row, columnInt2, xmlNodeGetAttribute(report, "Name" ), false, false ) reports = reports + 1 end xmlUnloadFile(node) end end --server function repotvet (hours, minutes, second, name) local xml = xmlLoadFile("reports.xml") local child = xmlCreateChild(xml, "report") xmlNodeSetAttribute(child, "vremya", ""..hours..":"..minutes..":"..second.."") xmlNodeSetAttribute(child, "Name", name) xmlSaveFile(xml) xmlUnloadFile(xml) end addEvent("repotvet", true) addEventHandler("repotvet", resourceRoot, repotvet)
-
How to delete a specific line? <reports> <report vreamya="1" Name="1" Jaloba="1" Admin="1" Otvet="1"/> <report vreamya="2" Name="2" Jaloba="3" Admin="4" Otvet="5"/> </reports> Example line - 2 <report vreamya="2" ...
-
The file does not change in any way.
-
Can you show me the working code with which I can edit an XML file and save it? I tried to use the code on the wiki, but something does not work There is a file: How do I use code: 1) Delete Attribute (Admin, Otvet) and save xml file 2) Add a new line with the same attributes and save xml file
-
This completely clears the gridlist, BUT I need each record to be saved for other users. not duplication Is it possible to make records from the grid recorded in xml file and after read from this file for other players?
-
Yes it works, but with debugscript 3 getting this error. When you first add it goes well BUT when try to add second time double line is obtained. I mean, for example, for the first time added the name of the player in the grid Happened: PlayerName When is the second time trying to do the same operation it starts to duplicate. First time: PlayerName Second time: PlayerName PlayerName Third time: PlayerName PlayerName PlayerName PlayerName Fourth time: PlayerName PlayerName PlayerName PlayerName PlayerName PlayerName PlayerName PlayerName but I need it to save the data and another player could read them First time: PlayerName Second time: PlayerName PlayerName Thirt time: PlayerName PlayerName PlayerName
-
Where and how to announce "myTable" ?? Only in this function is it used
-
Yes, I already did it, in gridlist added but error about "bad argument #1 to 'ipairs' (table expected, got nil) Line - 2 function showText (myTable) for i, v in ipairs(myTable) do guiGridListAddRow(gridSms, v) end end addEvent("showText", true) addEventHandler("showText", root, showText)
-
--client function sendreport () local name = getPlayerName(getLocalPlayer(source)) triggerServerEvent("sendText", resourceRoot, name) end addEvent("sendreport", true) addEventHandler("sendreport",root, sendreport) function showText (myTable) for i, v in ipairs(myTable) do guiGridListAddRow(gridSms, v) end end addEvent("showText", true) addEventHandler("showText", root, showText) addEventHandler("onClientGUIClick", root, function () if ( source == buy_report ) then sendreport() showText() end end) --server local savedText = {} function savedText(name) table.insert(savedText, name) triggerClientEvent(root, "showText", root, savedText) end addEvent("sendText", true) addEventHandler("sendText", resourceRoot, sendText) it's this line - 2 line. function showText (myTable) for i, v in ipairs(myTable) do guiGridListAddRow(gridSms, v) end end addEvent("showText", true) addEventHandler("showText", root, showText) What am i doing wrong i don't understand i fix it but now 639 - for i, v in ipairs(myTable) do 56 - table.insert(savedText, name) Now I used this code and the line was added to gridlist BUT i still have this error "bad argument #1 to 'ipairs' (table expected, got nil) Line - 2 function showText (myTable) for i, v in ipairs(myTable) do guiGridListAddRow(gridSms, v) end end addEvent("showText", true) addEventHandler("showText", root, showText)
-
function showText (myTable) for i, v in ipairs(myTable) do guiGridListAddRow(gridSms, v) end end addEvent("showText", true) addEventHandler("showText", root, showText) line - 2
-
Where and how do I need to fix it? addEventHandler("sendText", root, sendText)
-
Without this line does not add even for 1 player
-
I understood correctly? --client function sendreport () local name = getPlayerName(getLocalPlayer(source)) guiGridListAddRow(gridSms,name) triggerServerEvent("sendText", resourceRoot, name) end addEvent("sendreport", true) addEventHandler("sendreport",root, sendreport) function showText (myTable) for i, v in ipairs(myTable) do guiGridListAddRow(gridSms, v) end end addEvent("showText", true) addEventHandler("showText",root, showText) --server local savedText = {} function savedText(name) table.insert(savedText, name) triggerClientEvent(root, "showText", root, savedText) end addEvent("sendText", true) addEventHandler("sendText", root, sendText)
-
I haven't mastered the tables yet. I do not understand You can 1 example, save at least one line from gridlist and then transfer it to the server that other players would see?
-
--client addEventHandler("onClientGUIClick", root, function () if ( source == button ) then local jaloba = guiGetText(edit1) local name = getPlayerName(getLocalPlayer(source)) servertime = getRealTime () hours = (servertime.hour) minutes = string.format("%02d", servertime.minute) second = string.format("%02d", servertime.second) guiGridListAddRow(gridSms,hours..":"..minutes..":"..second,name,jaloba) end end) The player stores the information in the gridlist only for himself, how to do the same for the server? I mean, if a player adds this information to the gridlist, only he sees it, and others do not
-
Works as intended. You have already helped me in many questions, thanks!
-
What's wrong with my code? --client(onClientGUIClick) local idrep = guiGetText(edit1_Report) triggerServerEvent("repotvet",getRootElement(),localPlayer, idrep) --server function repotvet (player, idrep, otvet, target, id) for k, player in ipairs ( getElementsByType ( "player" ) ) do local id = getElementData ( player, "ID" ) outputChatBox("#FFD700ID Player: ["..id.. "] Test: " ..tonumber(idrep).."", source, 255, 255, 255, true) if id == idrep then outputChatBox("+", source, 255, 255, 255, true) else outputChatBox("-", source, 255, 255, 255, true) end end end addEvent("repotvet", true) addEventHandler("repotvet", resourceRoot, repotvet) For example, a player with id(1) on the server When I enter "1" in idrep(Edit(edit1_Report)) a message " +" should appear in the chat but appears "-" What am I doing wrong?
-
UP. I do not understand how to do it . pls help
-
Does anyone have such a script? or help write pls smth like map teleport from freeroom Window with a picture map and 3 edit's. When you click on the map area, coordinates are recorded in edits.
-
no problems, thanks!
-
For example, you are 14 meters away from the player, he will press the button - you will see the inscription - it's fine you are 16 meters away from the player, he will press the button - the inscription you will not see - it's fine The player presses (and holds) the button (at this time you are 16 meters away) - the inscription can't see The player does not release the button, and at this time you are go to the player (and now the distance is already 14 meters) The player did not release the button and you do not see the inscription. Of course, if the player releases the button and presses again - you will see the inscription. But we are talking about the holding button.
