-
Posts
1,141 -
Joined
-
Last visited
-
Days Won
42
Everything posted by Patrick
-
Hali! Egyszerűen a jármű elindításáért felelős funkcióban ellenőrizni kell a játékos melyik csapatban van és azt összehasonlítani az elvárttal. Ha nem ugyan az, akkor ne indítsa el a járművet. Ezekből mi van meg eddig? Jármű elindítás funkció, milyen frakció rendszer? Kész modot használsz?
-
Hi! You can get the rotation difference between cursor and center of the menu. And from this rotation you know which button is active. Use findRotation to get the rotation difference,
-
Hali! Gondolom az error üzenet végéről lemaradt, hogy value. Az a probléma, hogy a MySQL beállítások megváltoztak és a jelenlegi csak akkor enged új sort hozzáadni a táblához, ha minden oszlop kapni fog értéket. (az-az INSERT-nél te megadod minden oszlop értékét, vagy MySQL-ben van alapértelmezett érték megadva a kihagyott oszlopoknak)
-
Oh.. you can't cancel client sided commands. Then, here is one way, how to limit commands on client side: local EXEC = {} function canUse(cmd, limit_sec) if not EXEC[cmd] then EXEC[cmd] = 0 end local lastuse = EXEC[cmd] local tick = getTickCount() if lastuse + ((limit_sec or 2) * 1000) > tick then return false end EXEC[cmd] = tick return true end -- EXAMPLE function yourFunction(cmd) -- Need to add this part to your functions if not canUse(cmd, 2) then return outputChatBox("#FF0000[ANTISPAM]#FFFFFF You can use this command once, in every 2 sec!") end -- your code ... end addCommandHandler("asd", yourFunction)
-
First of all... stop spamming... And provide more informations about what are you doing, because it has to work.
-
Here is my solution, I hope its good for you. local LIMITED_COMMANDS = { -- ["COMMAND_NAME"] = TIME_LIMIT_IN_SEC ["something"] = 5, -- Can use this command only once in every 5 sec ["spam"] = 10, -- Can use this command only once in every 10 sec } local EXEC = {} addEventHandler("onPlayerCommand", root, function(cmd) local limit_sec = LIMITED_COMMANDS[cmd] if not limit_sec then return end local tick = getTickCount() if not EXEC[source] then EXEC[source] = {} end if not EXEC[source][cmd] then EXEC[source][cmd] = 0 end if EXEC[source][cmd] + (limit_sec * 1000) > tick then cancelEvent() return outputChatBox("#FF0000[ANTISPAM]#FFFFFF You can use this command once, in every "..limit_sec.." sec.", source, 255, 255, 255, true) end EXEC[source][cmd] = tick end) addEventHandler("onPlayerQuit", root, function() EXEC[source] = nil end)
-
This code from onPlayerCommand's wiki page, I just edited and put the command name check inside it. Hmm, looks like unnecessary.
-
local CMD_INTERVAL = 200 --// The interval that needs to pass before the player can execute another cmd local KICK_AFTER_INTERVAL = 50 --// Kick the player if they execute more than 20 cmds/sec local limitedCommands = { ["something"] = true, ["othercommand"] = true, -- list of limited commands } local executions = setmetatable({}, { --// Metatable for non-existing indexes __index = function(t, player) return getTickCount()-CMD_INTERVAL end }) addEventHandler("onPlayerCommand", root, function(command) if limitedCommands[command] then if (executions[source]-getTickCount()<=CMD_INTERVAL) then if (executions[source]-getTickCount()<=KICK_AFTER_INTERVAL) then outputChatBox("Don't flood", source) end cancelEvent() end executions[source] = getTickCount() end end )
-
Just replace kickPlayer function to your outputChatBox.
-
Check example on onPlayerCommand
-
Every time when player skin's change, you need to modify the walking style too.
-
onMarkerHit, getElementType, setElementPosition, setElementInterior and setElementDimension
-
Messages on vehicle enter/Сообщения при посадке в машину
Patrick replied to Military Guy's topic in Scripting
onVehicleEnter, getElementModel and outputChatBox -
I hope you think chat and not cheat Something like that. (its not the full code, you need to finish it!) -- SERVER function sendMessageToCustomChat(player, cmd, ...) -- TODO: check if `player` can use this command local text = table.concat({...}, " ") for i, target in ipairs(getElementsByType("player")) do -- TODO: check if `target` can see this message outputChatBox(text, target) end end addCommandHandler("chatcommand", sendMessageToCustomChat)
-
And you try to use it on client side, right? (and on client side you can't use 10th argument of createMarker, because player who can see the marker, can be only localPlayer, so just remove it)
-
Hi! You can find every information in previous post, where you wrote a comment. Please don't start new conversation about it..
-
Some tutorial: https://www.youtube.com/watch?v=0S0k9ny3d4M (Check the whole channel) https://forum.multitheftauto.com/topic/121619-Lua-for-absolute-beginners https://forum.multitheftauto.com/topic/95654-tut-debugging/ https://forum.multitheftauto.com/topic/114541-tut-events/
-
Hi! You need to use dbConnect to connect databases. (both MySQL / SQLite) For the GUI, you need: guiCreateWindow - background window guiCreateLabel - texts guiCreateEdit - inputs guiCreateButton - buttons guiGetText - get input's text onClientGUIClick - detect when client push to button (event) triggerServerEvent - send datas to server side You can use default login/register functions addAccount - add new account (register) getAccount - get the account from username and password logIn - login player the the account Or do your own account system, with database.
-
Mondjuk egy timer 2 másodpercenként lekérdezi a sebességet és lementi egy táblázatba. (egymás után, sorban az értékeket) És ezt felhasználva kirajzolja egy render funkcióban. Sok kis "oszlop", mind olyan színű ami a megfelelő értékhez tartozik. (de ez elég sok rectangle lesz, szóval erre figyelni kell)
- 5 replies
-
- scriptelés
- voice
-
(and 4 more)
Tagged with:
-
How The_GTA said, you need to use bone_attach. But here is a similar resource, check how it works: https://community.multitheftauto.com/index.php?p=resources&s=details&id=14125
-
Amit küldtem az-az alap voice resource, azzal lehet ilyen csatornákat csinálni. Ha azt akarod, hogy közeledben lévők és a telefonon is halljanak, akkor tudod ezen felül állítani, hogy ki hallja a játékost. (setPlayerVoiceBroadcastTo)
- 5 replies
-
- 1
-
- scriptelés
- voice
-
(and 4 more)
Tagged with:
-
A playereket külön csatornákra lehet tenni, azok hallják egymást akik azonos csatornán vannak. Mikor valakik telefonon beszélnek, akkor azonos csatornára kell őket tenni. https://wiki.multitheftauto.com/wiki/Resource:Voice
- 5 replies
-
- 1
-
- scriptelés
- voice
-
(and 4 more)
Tagged with:
-
I think you try to use this code on client side, but you need to use on server side, because of addCommandHandler. On server side, addCommandHandler pass the following arguments to attached function: PLAYERELEMENT, COMMANDNAME, ... But on client side, its not pass PLAYERELEMENT, because its can be only localPlayer. Looks: COMMANDNAME, ... Wiki: addCommandHandler How to use on client side: -- CLIENT SIDE function PlateText() local Vehicle = getPedOccupiedVehicle(localPlayer) if Vehicle then outputChatBox("Hi") else outputChatBox("bye") end end addCommandHandler("something", PlateText)
-
("#ff0000text"):gsub("#%x%x%x%x%x%x", "") -- text
- 1 reply
-
- 1