-
Posts
1,031 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Bonsai
-
This is similar to what you tried but probably better than making the function yourself. https://wiki.multitheftauto.com/wiki/Split
-
Imagine MTA had so many players that nobody would play GTA Online. I think they would care alot. They maybe can't make money of it, but it can keep them from making more. Anyway, you are right, its more a theoretical thing, as MTA has about ~30.000 players, not millions.
-
What about "#self.playerWeapons[player] ~= 0" ?
-
The problem was just that you did not use the return value from gsub. local name = name:gsub("#%x%x%x%x%x%x", "") There is no function needed for that.
-
Hi, from time to time, random people join my server and spam ads in the chat. Usually this isn't so bad as they only do it once and never come back. But today some guy kept joining over and over again spamming stuff. The problem is, apparently he is able to get around the function that handles every output to the chat. function Chat.redirect(message, messageType) if not isElement(source) then return end cancelEvent() local arenaElement = getElementParent(source) if not arenaElement or getElementType(arenaElement) ~= "Arena" then return end local chat_color = getElementData(source, "setting:chat_color") or "#ffffff" local message = Chat.parseEmotis(message) if not getElementData(arenaElement, "showSpectatorChat") and getElementData(source, "Spectator") then Chat.outputSpectatorChat(arenaElement, getPlayerName(source).."#ffffff: "..chat_color..message) return end if messageType == 0 then if getElementData(arenaElement, "silence") and not exports["CCS"]:export_acl_check(source, "silence") then outputChatBox("Sorry, Silence mode is active!", source, 255, 0, 128) return end Chat.outputArenaChat(arenaElement, getPlayerName(source).."#ffffff: "..chat_color..message) elseif messageType == 1 then if getElementData(arenaElement, "silence") and not exports["CCS"]:export_acl_check(source, "silence") then outputChatBox("Sorry, Silence mode is active!", source, 255, 0, 128) return end Chat.outputArenaChat(arenaElement, "#ff00ff* "..getPlayerName(source):gsub("#%x%x%x%x%x%x", "").." "..message:gsub("#%x%x%x%x%x%x", "")) elseif messageType == 2 then local team = getPlayerTeam(source) if not team then return end for i, p in pairs(getPlayersInTeam(team)) do outputChatBox("#00f000[Team] #ffffff"..getPlayerName(source).."#ffffff: "..chat_color..message, p, 255, 255, 255, true) end triggerEvent("onServerChatMessage", root, "#00f000[Team] #ffffff"..getPlayerName(source).."#ffffff: "..chat_color..message) end end addEventHandler("onPlayerChat", root, Chat.redirect) Normally, he shouldn't be able to write anything in the chat without going through this function. But it seems when you join a server and very fast after that spam a message, it will be output to the chatbox without trigger the "onPlayerChat" event. [2017-03-07 10:55:47] KICK: MAFYA=BALTROS was kicked from the game by (Command Flood) [2017-03-07 10:55:47] CHAT: MAFYA=BALTROS: multi theft auto turkis de +70 araç +70 sikin adminilklerimiz indirimdedirrrrr!!! [2017-03-07 10:56:04] KICK: MAFYA=BALTROS was kicked from the game by (Command Flood) [2017-03-07 10:56:04] CHAT: MAFYA=BALTROS: multi theft auto turkis de +70 araç +70 sikin adminilklerimiz indirimdedirrrrr!!! [2017-03-07 10:56:12] KICK: MAFYA=BALTROS was kicked from the game by (Command Flood) [2017-03-07 10:56:12] CHAT: MAFYA=BALTROS: multi theft auto turkis de +70 araç +70 sikin adminilklerimiz indirimdedirrrrr!!! [2017-03-07 10:56:27] KICK: MAFYA=BALTROS was kicked from the game by (Command Flood) [2017-03-07 10:56:27] CHAT: MAFYA=BALTROS: multi theft auto turkis de +70 araç +70 sikin adminilklerimiz indirimdedirrrrr!!! [2017-03-07 10:56:33] CONNECT: MAFYA=BALTROS connected (IP: 78.174.8.126 Serial: 0D3C0C3E418D7DEDF4E60FE33CB64753 Version: 1.5.3-9.11204.0) [2017-03-07 10:56:33] JOIN: MAFYA=BALTROS joined the game (IP: 78.174.8.126) [2017-03-07 10:56:35] KICK: MAFYA=BALTROS was kicked from the game by (Command Flood) [2017-03-07 10:56:35] CHAT: MAFYA=BALTROS: multi theft auto turkis de +70 araç +70 sikin adminilklerimiz indirimdedirrrrr!!! I would also like to request a tempory ban or something like that for this guy. Maybe it will teach him and his friends a lesson. Bonsai
-
How can this be so hard. If you use cancelEvent() the message will not appear in chat. Then you have to use your own function which outputs it in chat instead. Just do some tests until you find out whats wrong. Remove your own function and check if the messages still appear in chat even with cancelEvent(). If so, then you maybe have another function outputting it to the chat.
-
If you remove the "local" inside the loop, they will be available outside of the loop, because you defined them outside of the loop too. But since this is a loop, the two variables will only have the value of the last row, everything before that is lost.
- 4 replies
-
- dbquery
- for statement
-
(and 2 more)
Tagged with:
-
Remove the "me" command handler and fix the parameters of the "onChat" function.
-
More like the internal webserver is very basic.
-
You could check the editor resource, it does this too. But depending on what you are trying to do, this matrix calculations might be too heavy, e.g. when doing it in a render function.
-
If you do something like this in your main resource: <include resource="other_resource" /> then it will start and stop along with the main resource. I wouldn't do it in one big resource.
- 5 replies
-
- environment
- lua
-
(and 2 more)
Tagged with:
-
What do you mean with "reload two scripts"? If you make it a seperate resource that only handles script loading there shouldn't be any problems, and I assume its safer too. Also, that script back then was pretty messy. And very important, don't use that for server side scripts.
- 5 replies
-
- environment
- lua
-
(and 2 more)
Tagged with:
-
Hmm, I'm not sure if I'm missing something, but I only get tons of errors when starting the resource.
-
Could something like this be used to change the physics of objects too? Like, making them moveable, changing their mass/gravity and such things?
-
Maybe you should just save it as JSON instead.
-
Its not working because you need to rename the "onResourceStart" event to the clientside version "onClientResourceStart" at least.
-
dxDrawText or dxDrawRectangle all screen resolutions problem
Bonsai replied to longsnake34's topic in Scripting
Try to use the search. You will find tons of posts about the same problem. And somewhere you will find some good answers. -
As far as I can see you are storing the player name, not the account (or account name as I don't know if accounts can be stored). That should not get the name but only store the account. So when you get the toptimes again later to display, you can use getAccount() or something, then get the account data, which will be the final player name.
-
The account stays the same if a player changes his name? Instead of storing the player name of the top time, you should rather store the account name. Then you can simply lookup that accounts data to find the name.
-
Is that code from you? Else you could ask the one who wrote it.
-
Resources should never restart automatically. The Developer knows best when to do that.
-
You should avoid vortexservers. They have way to many problems. Try evolution host instead. About the same prices but no problems at all.
-
You are talking about the Menu? I think it does for everyone. Why is that bad anyway, your version doesn't change because of that.