Leaderboard
Popular Content
Showing content with the highest reputation on 05/08/20 in all areas
-
That is the first step. Depending on the dimension size. Like milliseconds/seconds/minutes/hours/days, you can also save a lot of data at these 2 dimensions: milliseconds/seconds Are those dimensions included? If yes, then I can explain a little bit more. Server triggerClientEvent(receivers, "<eventName>", resourceRoot, date) Client -- <triggerClientEvent resource> addEvent("<eventName>", true) -- <resource 1> addEventHandler("<eventName>", root, function () end) -- <resource 2> addEventHandler("<eventName>", root, function () end) ---------------------- -- or more specified. ---------------------- -- <resource 1> addEventHandler("<eventName>", getResourceRootElement ( getResourceFromName ("<triggerClientEvent resource name>")), function () end, false) -- <resource 2> addEventHandler("<eventName>", getResourceRootElement ( getResourceFromName ("<triggerClientEvent resource name>")), function () end, false)2 points
-
Hello, i created a weapon "minigun" using Create Weapon and i'm trying to make it fire like a weapon the Player have by that i mean ( it fires when mouse is clicked and stops when is not), i know that ( fireWeapon is the function that i should use ) so i tried to do it but i failed. also i have another question ( i'm willing to make a crosshair for the weapon and i have no idea how to make the weapon fires to the crosshair point) so if there is any examples or functions to give that will be great what i have tried :- Client Side:- function CreateRealWeapon(object) local Weapon = createWeapon("minigun",0,0,0) attachElements(Weapon,localPlayer,0.042,0.09,0.5,0,26,94) outputChatBox("Real Weapon Created At X:" .. x .. "Y:" .. y .. "Z:" .. z) end addEvent( "createWeapon", true ) addEventHandler( "createWeapon", localPlayer, CreateRealWeapon ) function ClientfireWeapon() setWeaponState ( Weapon, "firing" ) end addEvent("FireWeapon", true) addEventHandler("FireWeapon",getRootElement(), ClientfireWeapon) bindKey ("mouse1", "down", ClientfireWeapon) function ClientReadyWeapon() setWeaponState(Weapon, "Ready") --- stops the weapon when the key is up end bindKey ("mouse1", "up", ClientReadyWeapon) ServerSide:- function TriggerFire() local x,y,z = getElementPosition(localPlayer) triggerClientEvent("FireWeapon",getRootElement()) end1 point
-
1 point
-
Before I give you recommendations. You will have to make a choice. -[x] left and right? - [ ] up and down? Complexity (synchronisation) +1 - [ ] crosshair based on camera? Complexity + 2 - [ ] crosshair based on turret? - [ ] crosshair left/right based on camera Complexity + 1 + crosshair up/down based on turret?1 point
-
I've found example of IIYAMA which should explain buffer (he taught me that! :D) For element data it might look different. At the moment i can think of disabling sync (4th argument). And with help of tables do the rest. Do not treat this code as a full solution, but more like a example. -- Client function onClientReceiveData(pData) local cachedData = false for i = 1, #pData do cachedData = pData[i] setElementData(cachedData[1], cachedData[2], cachedData[3], false) end end addEvent("onClientReceiveData", true) addEventHandler("onClientReceiveData", root, onClientReceiveData) function onClientDataSync(pData) -- end addEvent("onClientDataSync", true) addEventHandler("onClientDataSync", localPlayer, onClientDataSync) -- Server local buffersTable = {} function setElementDataWithBuffer(pElement, pKey, pValue, pTimeout) if not buffersTable[pElement] then buffersTable[pElement] = setTimer(function(pElement) if isElement(pElement) then triggerClientEvent(root, "onClientReceiveData", pElement, buffersTable[pElement]) end buffersTable[pElement] = nil end, pTimeout, 1, pElement) end return setElementData(pElement, pKey, pValue, false) end function onPlayerLogin() --triggerClientEvent(source, "onClientDataSync", source, buffersTable) end addEventHandler("onPlayerLogin", root, onPlayerLogin) In order to make it work, you would need to track all changes applied with custom element data implementation (since it do not sync). While on tables it would be way easier to do. Perhaps, there's other way but i don't think so. There's no reason to update data continuously, rather than on change. Maybe with help of events. You can use trigger to have a communication between two resources (not sure if event with same name on two different resources it's possible, but should be). local importedCache = exports.cache:getClientFiles() -- getting client files (they are loaded in different resource) -- Iterating over table, saving some data... triggerEvent("onClientCacheLoaded", localPlayer) -- I couldn't get any other solution. Since exports take some time, and due of different script order, i am triggering event which exist on same side (it could be different side though). To let know that files are ready to use. It would work even if event is registered later than script which catch loaded files.1 point
-
نصيحة. اذا كان سيرفرك مافيه زوار قفله احسن. واذا كان فيه زوار, مو شرط يكون فيه مسؤول. دام عندك حماية كويسه ومودات حلوه مابتحتاج لا اداره ولا غيره. وبالتوفيق1 point
-
update :- i guess i get the idea of the crosshair and how it works, but there is two problems first is the weapon is "killing the Player when aiming down" the second one is the weapon movement, what i'm missing here? function ClientfireWeapon() local x,y,z = getWorldFromScreenPosition ( w/2, h/2, 50 ) setElementData ( localPlayer, "attachedToWeapon_aim", {x,y,z} ) local aim = getElementData ( localPlayer, "attachedToWeapon_aim" ) setWeaponTarget(Weapon, aim[1],aim[2],aim[3]) setWeaponState ( Weapon, "firing" ) end addEvent("FireWeapon", true) addEventHandler("FireWeapon",getRootElement(), ClientfireWeapon) bindKey ("mouse1", "down", ClientfireWeapon)1 point
-
1 point
-
You know what the local keyword does right??? If not, watch this video. local Weapon = createWeapon("minigun",0,0,0) Weapon = createWeapon("minigun",0,0,0) Extra function ClientfireWeapon() if isElement(Weapon) then setWeaponState ( Weapon, "firing" ) end end1 point
-
addCommandHandler ("ativar", function (thePlayer, cmd) outputChatBox ("Timer 1 iniciado: 5 segundos restantes.", thePlayer) setTimer (function () -- (Código que deve executar no timer 1 aqui.) outputChatBox ("Timer 2 iniciado: 10 segundos restantes.", thePlayer) setTimer (function () -- (Código que deve executar no timer 2 aqui.) outputChatBox ("Timer 3 iniciado: 5 segundos restantes.", thePlayer) setTimer (function () -- (Código que deve executar no timer 3 aqui.) end, 5000, 1) -- Timer 3 vai executar seu código após 5 segundos, 1 vez. end, 10000, 1) -- Timer 2 vai executar seu código após 10 segundos, 1 vez. end, 5000, 1) -- Timer 1 vai executar seu código após 5000 milissegundos (5 segundos), somente 1 vez. end) Obs: Exemplo server-side.1 point
-
1 point
-
local tPlayers = {} -- tabela global, esta irá armazenar os jogadores com o tempo que usou o comando local tempo = 5000 -- 5 segundos em milissegundos function repararveiculo ( source ) local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup("user." .. accName, aclGetGroup("Staff")) then if isPedInVehicle ( source ) then return end -- verificar se existe o tempo vinculado ao jogador; verificar quanto tempo passou desde que usou da última vez if tPlayers[source] and (getTickCount(source) - tPlayers[source]) < tempo then -- parar a execução aqui return outputChatBox( "Aguarde um tempo para usar este comando novamente", source, 230,0,0 ) end tPlayers[source] = getTickCount(source) -- armazenar o tempo em que o jogador usou o comando local x, y, z = getElementPosition(source) local colcarros = createColSphere ( x, y, z, 2) local vehicle = getElementsWithinColShape ( colcarros, "vehicle" ) destroyElement(colcarros) setPedAnimation( source, "CAR", "Fixn_Car_Loop", 4500, true, false, false, false) for theKey, veh in ipairs(vehicle) do setTimer ( function() fixVehicle(veh) end, 4500, 1 ) end end end addCommandHandler ( "fix", repararveiculo ) -- otimização addEventHandler("onPlayerQuit", root, function() -- remover da tabela global ao sair do servidor if tPlayers[source] then tPlayers[source] = nil end end) Leia os comentários do código.1 point
-
1 point
-
Don't lie. You know that anti-cheat knows what you did. Temporarily bans can't be appealed. You wanted to cheat, this is your own fault. Normally we don't check temporary bans, but here I know you're lying, because you've been using EXEMOD even on the regular version. A lot, recently.. as well as on your other PC with serial A8F3ED36289139BF24202FB1176C68F3 (which is no surprise.. once a cheater, always a cheater, everywhere). Besides, you received multiple EXEMOD bans in the past, also on your current serial in the recent past - basically you've been looking to EXEMOD cheat during your entire run with MTA, as well as on the super old serial 25BCA10421E6C773B9B6FFE094474C02 you received your first EXEMOD ban in 2017. So considering all of your history and persistence in cheating, now I turned the ban into 1 month duration, unlike other bans from this ban wave. Because you never seem to learn.1 point
-
1 point
