![](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
-
Well of course if you have over 4000 accounts and loop through them all, while triggering a client event with every entry it's gonna lag. Lets say you have 4500 accounts, for every 1 account it founds it will do this; local nick = getAccountData(ac,"nick") local accname= getAccountName(ac) table.insert(theTable, {nick,accname}) triggerClientEvent(source,"gridlist",resourceRoot,theTable,clan) Now you repeat this for the remaining 4499 accounts. Hardly very efficient. And since I don't know what you're trying to do, I can't really help you make it any better. First of all, trigger the client event ONCE and not 4000+ times. To do that, simply move the event out of the loop - it makes no sense to have it inside the loop. function gridlist(clan) theTable = {} for index, ac in pairs(getAccounts()) do local keyclan = getAccountData(ac, "ortakveri") if keyclan and keyclan == clan then local nick = getAccountData(ac, "nick") local accname= getAccountName(ac) table.insert(theTable, {nick, accname}) end end -- Loop stops executing here triggerClientEvent(source,"gridlist", resourceRoot, theTable, clan) end Edit: You might have to make the table theTable global instead of local, I can't recall how strict Lua is with local variables.
-
The difference would be a matter of few milliseconds, so the difference is barely worth mentioning. Whichever is more convenient.
-
Just the username or what...? Look up the XML writing functions on the MTA Wiki, there's plenty of information on how to read and write using those functions. If you plan to store passwords as well, I suggest you do some research on password encryption. Storing password as plaintext is a terrible idea. Then you simply store the account username in the XML file once they register an account. You'll need to write your own register function.
-
Because you need to call this function somewhere; function TriggerServerEvent_Handler() triggerServerEvent("onPlayerRequestSoundStart", localPlayer) end I didn't call or add a trigger for it because I assumed you could figure that out yourself
-
That event is triggered when a player enters the vehicle, not when it spawns. Try using onClientResourceStart instead and loop through all the spawned vehicles. You'll need to use this getElementsByType.
-
Not quite sure what you're trying to do here, doesn't make a whole lot of sense. What is this meant to do...?
-
Client: function TriggerServerEvent_Handler() triggerServerEvent("onPlayerRequestSoundStart", localPlayer) end function SendServerSoundRequest(theURL) if(type(theURL) == "string") then theSound = playSound(theURL) outputChatBox("Starting to play: "..theURL) else outputDebugString("Expected a string, but received "..tostring(type(theURL))) end end addEvent("startPlayingSound", true) addEventHandler("startPlayingSound", root, SendServerSoundRequest) Server: local theURL = "www.example.com/example.mp3" function HandleClientSoundRequest() triggerClientEvent("startPlayingSound", client, theURL) -- All players -- triggerClientEvent(root, "startPlayingSound", client, theURL) -- All players -- triggerClientEvent(client, "startPlayingSound", client, theURL) -- Only the client that triggered this event -- triggerClientEvent(getRandomPlayer(), "startPlayingSound", client, theURL) -- Trigger for a random player end addEvent("onPlayerRequestSoundStart") addEventHandler("onPlayerRequestSoundStart", root, HandleClientSoundRequest)
-
That's rather unnecessary, this does the same thing; addEventHandler("onClientResourceStart", resourceRoot, function() pytTestMusic = playSound(tostring( url ), true) end )
-
You'll have to use both triggerServerEvent and triggerClientEvent. When you use functions such as playSound and playSound3D much like the Wiki states - they are client-sided. Meaning, they only execute on the client calling it. And that client only. Example; Player 1 calls playSound, sound starts playing. Player 2 does nothing, no sound starts playing. This is intended behaviour in order for clients to perform their own unique operations. The solution? Use the server to call this function for all current clients - or the clients(player element) you specify. Example; Player 1 requests to play a song Server handles the request Server tells all clients to call playSound with specified filepath or URL. Player 1 calls playSound, sound starts playing. Player 2 calls playSound, sound starts playing. This is how you communicate between clients and servers and is a critical part to be able to understand in order to create more advanced scripts. Functions needed for Clients; triggerServerEvent -- Trigger a custom server-sided event addEvent -- Create a custom event addEventHandler -- Handle the custom event playSound -- To play the sound Functions needed for the Server; addEvent -- Create a custom event addEventHandler -- Handle the custom event triggerClientEvent -- Trigger a custom client-sided event for specific player(s), or all players
-
Only video I would know of would be how to export from 3ds Max into MTA. Other than that, you'll have to google to find what you need to extract the models and textures from the game you want.
-
Does anyone know if there's a way to launch multiple MTA Clients for testing purposes? Or am I gonna have to use a virtual machine to accomplish this? I can't recall if I tried symbolic links or not, but for some reason I don't think it'll work.
-
It should be possible. First of all, you'll have to find a way to extract the models from the game files. Secondly, you'll need to find a way to import them into a 3D modeling software such as 3ds Max or Blender. You're probably best off with 3ds Max due to Max Script. After that, you should be able to use the GTA tools for 3ds Max to export it as a .dff file. Use TXD Workshop to create and manage the .txd files.
-
Use triggerServerEvent, read the information and examples thoroughly and it's rather easy to understand. Simply put, you have a server-side function which is remotely triggered by a client. You use addEvent to create a custom event for that function, then trigger that event via triggerServerEvent. Same logic applies for triggerClientEvent.
-
So...can you tell me what do I have to do to create a DayZ server, simple as it's possible, I have all the resources I need for radar, GP and things, I just need a version without bugs and simple, oh, a tent save system will be great, because they dissapear when I restart the server There's too much to tell. If you want to make it on your own, you'll want to start with the basic tutorials on the MTA Wiki. Be prepared to invest some time though, it's not something you learn in a matter of hours. You'd probably be best off to contact the original author and ask him for advice, since the scripts are compiled I can't check them to see what's wrong.
-
Sorry, I don't use Skype. I downloaded the resource and took a look, the scripts are indeed compiled. You'll have to contact the original author for further assistance.
-
Neither of those are any helpful. Are the other scripts compiled?
-
Is the version of DayZ that you have a public release? If so, it would be useful if you could provide us with the function that controls player death and respawn. Look in the server-side scripts and search for this function; spawnPlayer Alternatively any of the death events; onClientPlayerWasted (Client-side) onPlayerWasted (Server-side)
-
Did you even try reading the errors? It clearly says; "the resource slothbot isn't running". I assume if you make sure that resource is running, the zombies should be working.
-
A good rule of thumb is to never write gameplay mechanics inside of a renderer event unless absolutely necessary for a smooth transition. Keep in mind this is triggered with every frame, so you'll have it triggered as quickly as somewhere around every 16ms. Using a timer would be far more efficient, or using tick like JR10 demonstrated.
-
Sometimes you'll just have to... You can't always expect there to be an easy way out
-
Well I'll either make it a simple "modern" design using just rectangular. Or something more advanced with images, not sure yet. Suggestions are welcome
-
Read about these 2 functions; triggerServerEvent triggerClientEvent
-
You didn't even click the link did you? Try again and read it thoroughly. It's all you need.
-
Not sure if you can, have you tried using guiSetProperty? Maybe something in there works.