![](https://forum.multitheftauto.com/uploads/set_resources_22/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Dealman
Members-
Posts
1,421 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Dealman
-
You'll want to make a server-sided script for this. First off, start with using the event onPlayerLogin, this will trigger an event every time a player logs in. Now that you have a player element, you can use getPlayerAccount to get the player's account and then use isObjectInACLGroup to check if that account belongs in a specific group - such as VIP. If the player is a VIP, you then use setPlayerTeam to set the player to the team you want. That should be all you need, you have plenty of examples on how to use the event and the functions on the wiki.
- 1 reply
-
- 1
-
-
I'm a bit curious since I don't know how bandwidth_reduction works, but wouldn't having a lower setting be better for more frequent updating? Or do they work in co-junction somehow?
-
Then I'm not quite sure, I don't really have the ability to reliably test this on my end at the moment. Best bet is if one of the higher-ups shed some light on this subject, such as @ccw. What exactly is it you need this for? Might help to come up with a solution/workaround. One thing is always predicting where they're going using the position, velocity and rotation I suppose - but prediction is a pain to try and get half-decent.
-
Most of the time you can get away by doing what @KariiiM did, in that you change the scale depending on the resolution. Depending on the font and how much smaller the resolution is, it may or may not work.
-
Oh good heavens... Oh well, first for all try and narrow it down a bit so you know what function causes the lagging. Also are you sure this is the right script? I can't seem to find anything obvious to do with skin changing - but rather mostly about drawing HUD elements?
-
Kind of hard to help you when I don't know how the file's structured. You'll just have to do a bit of trial and error, use outputChatBox to debug, see what values you are getting - use that to try and pin-point where in the file you are. Remember that children can have children and so on, XML is like navigating in a spider-web or finding a needle in a haystack sometimes
-
Yes, use xmlNodeGetChildren to loop through them. Use xmlNodeGetAttribute to check if the attribute equals "sourceName". If true, use xmlNodeGetValue to get the value.
-
It should work if your XML file looks like you showed above; <body> <td class="sourceName">Tn6eL</td> </body> If not, the error is elsewhere in your code - use debugscript.
-
You should read up on XML a bit, you're confusing the child, attribute and value. In this particular scenario; <td class="sourceName">Tn6e</td> Red is the child, green is an attribute and blue is the value. So in order to get the value, you'd have to use this code; addCommandHandler("getSourceName", function (p) local fileName = "sourceCode.xml" local xmlFile = xmlLoadFile(fileName) if xmlFile then local findNode = xmlFindChild(xmlFile, "td", 0) if(findNode) then outputChatBox(tostring(xmlNodeGetValue(findNode, "class")), p) end xmlUnloadFile(xmlFile) end end)
-
You use the event onClientGUIClick to detect whenever a button is clicked. Then you compare the source of the event to find what button was clicked, for example; if(source == GUIEditor.button[1]) then -- Code here end
-
Your best bet would be to use it server-side and use the event onResourceStart to run it whenever a resource is started. As far as I know there's no actual way of checking whether the resource is a map or not(well, I guess you can check if a file with the .map extension exists either via fileExists or reading the meta via XML functions). Another workaround would be to make a table containing names of resources to ignore, so the script isn't run if for example you restart a resource that is not a map.
-
Tried looking at some of the custom radars available and see how they sync things? Other than that, all I can really think of is getElementData. If I recall correctly you can get the posX, posY and posZ values via their element data. Though, I don't really see why this would be updated differently.
-
Well yeah, you can't really expect the game to magically know what it is you're trying to do So did you fix it? client is a pre-defined variable so you should be able to use this since you're using a custom event.
-
Use fetchRemote to save it as text, you then pass this onto the client to read through it using the XML functions(unless you need to do it on the server). To see how things are structured, right-click your own page and save as. I was working on a resource before which would fetch internet radios from internet-radio.com and parse through them for easy streaming. Here's a snippet of the code to see how I parsed through it; for nodeIndex, theNode in ipairs(stationNodes) do if(xmlNodeGetName(theNode) == "tr") then if(nodeIndex <= #stationNodes-1) then local stationInfo = xmlNodeGetChildren(theNode); for nodeIndex, theNode in ipairs(stationInfo) do if(xmlNodeGetName(theNode) == "td") then if(nodeIndex == 1) then -- Parse URL local urlNode = xmlFindChild(theNode, "a", 0); local onclickAttribute = xmlNodeGetAttribute(urlNode, "onclick") local findURL = string.match(onclickAttribute, "http?://[%w-_%.%?%.:/%+=&]+"); --outputChatBox("Debug URL: ["..tostring(findURL).."]"); table.insert(g_RadioStations_URL, #g_RadioStations_URL, findURL); elseif(nodeIndex == 2) then -- Parse Name local nameNode = (xmlFindChild(theNode, "span", 0) or xmlFindChild(theNode, "a", 0)); if(theName ~= false) then local theName = xmlNodeGetValue(nameNode); local theNameFix = string.gsub(theName, "[\n+]", ""); local theNameFix = string.gsub(theName, "&", ""); --outputChatBox("Debug Name: ["..tostring(theNameFix).."]"); table.insert(g_RadioStations_Name, #g_RadioStations_Name, theNameFix); end elseif(nodeIndex == 3) then -- Parse Bitrate local bitRateRaw = xmlNodeGetValue(theNode); local bitRateFix = string.gsub(bitRateRaw, "[\n+]", ""); --outputChatBox("Debug Bitrate: ["..tostring(bitRateFix).."]"); table.insert(g_RadioStations_Bitrate, #g_RadioStations_Bitrate, bitRateFix); end end end end end end
-
That's not the problem, client returns the player element for the client that triggered the server event which is what he wants. So it should work as intended. Try debugging it yourself, it's a pain to try and read on these forums. Output the value you get from getElementData. Never assume something is working, check and make sure it is working.
-
Well, if it's using XHTML you can use the regular XML functions to parse through it and find what you need. Using PHP should work for you as well but I haven't really touched any PHP yet so I'm rather inexperienced with that.
-
function vidacolete() local marcos = getTeamName(getPlayerTeam( source )) local armor = getPedArmor( source As far as I can tell, source is never defined. Try replacing source with client.
-
Just because it has parameters for a Z-axis doesn't necessarily mean it's "meant" for 3D objects, it works perfectly fine for 2D animations. You're absolutely right though; using a render target probably is a better alternative.
- 4 replies
-
- interpolatebetween
- animation
-
(and 1 more)
Tagged with:
-
How are you drawing it? Is it all in one dxDrawText or multiple ones? As for how to use interpolateBetween, it's thoroughly explained on the wiki how to use it. You just gotta read it and try it a few times and you'll get the hang of it.
- 4 replies
-
- interpolatebetween
- animation
-
(and 1 more)
Tagged with:
-
I'm assuming MTA uses prediction and/or interpolation for vehicles to minimize network load, probably in co-junction with whether they're streamed in or not. Tried getting the position via the server(the server should know where they are at any given time) and then passing it on to clients, alternatively maybe using element data? Not the most efficient way of doing things, but works for testing purposes. Is this something you need to do every frame?
-
The variable message is empty, thus it returns a nil value. As far as I can tell it's not defined anywhere. addCommandHandler stores all the messages as parameters, by using ... you can then store these in a table. You then use table.concat to concatenate them into a string. See this example; function adminMessage(thePlayer, theCommand, ...) local playerName = getAccountName(getPlayerAccount(thePlayer)) local messageParameters = {...} local fullString = table.concat(messageParameters, " ") if(isObjectInACLGroup("user."..playerName, aclGetGroup("Admin"))) then outputAdminMessage(thePlayer, fullString) elseif(isObjectInACLGroup("user."..playerName, aclGetGroup("SuperModerator"))) then outputAdminMessage(thePlayer, fullString) elseif(isObjectInACLGroup("user."..playerName, aclGetGroup("Moderator"))) then outputAdminMessage(thePlayer, fullString) elseif(isObjectInACLGroup("user."..playerName, aclGetGroup("Console"))) then outputAdminMessage(thePlayer, fullString) elseif(isObjectInACLGroup("user."..playerName, aclGetGroup("Administrator"))) then outputAdminMessage(thePlayer, fullString) else outputChatBox("ACCESS DENIED, You are not Admin", thePlayer, 255, 0, 0, true) end end addCommandHandler("adm", adminMessage) function outputAdminMessage(thePlayer, theMessage) outputChatBox("#ff0000~>#ff8c00Announcement: "..theMessage, root, 255, 255, 255, true) end
-
You'll have to use onClientClick to detect if a user has clicked within the text-field. If true, you'll want to prevent MTA from registering input if necessary, this can be done via toggleAllControls for example. Once the text-field has "focus", you can use the event onClientCharacter to allow them to type text into that text-field. Store the letters in a table and also use this table to display the text entered on-screen. If it's a masked text-field for passwords, you can use gsub on the string to replace all characters with * for example(not on the table itself, obviously). Then there are some other workarounds you need to do such as deleting characters via backspace/delete, moving the caret index left and right via arrow keys or whatnot. Depends on how much functionality you want to add.
-
I don't think he wants to edit the files, but rather add them to a meta so they can be used by the server/client. Considering a lot of resources nowadays are released compiled in an attempt to stop theft, this is fine and y'all should stop jumping to assumptions like that. MasterMind200; You need to add the scripts to a meta.xml file and start that resource for the scripts to be loaded. What are the names of the scripts?
-
A quick look at the MTA Wiki and you would have found this page, explaining in detail how to use the meta file.