-
Posts
636 -
Joined
-
Days Won
8
Everything posted by ds1-e
-
Hey once again. I want merge some script files, about 16~ lua files. Into 2-4 files (1 shared, others client/server side), to make rework easier. It's just about data system and GUI inventory at all (data for vehicles work well ). I probably misunderstood this: A limit of the amount of local variables per function. It's limit for local variables inside function(s)? Or in whole lua file.
-
Hey, as topic says, how can i make something like drag'n'drop in GUI?
-
https://wiki.multitheftauto.com/wiki/Server_mtaserver.conf https://wiki.multitheftauto.com/wiki/Anti-cheat_guide Quote from wiki:
- 1 reply
-
- 1
-
If colshape/player hit each other, save it to client-side table, and then let's say use a function to switch them, if there's more than 1, and if player is in range of it? Plus delete data from this table onClientElementDestroy? That's what you mean?
-
Hey once again. I have encountered a issue with colshapes. https://wiki.multitheftauto.com/wiki/OnClientColShapeHit https://wiki.multitheftauto.com/wiki/OnClientColShapeLeave So what's the problem with them? - OnClientColShapeHit doesn't trigger after leaving from other colshape. Let's say i have player with colshape, inside of car which have colshape too. Firstly i hit car colsphere, then i hit player colsphere, after that i leave from player colsphere, but sadly, onClientColShapeHit doesn't trigger for car colsphere, even if i am still inside of colshape. So i am asking you guys, how can i do something like "dynamic" colshapes. Or atleast fix issue above.
-
bump. Still looking for fix, it's annoying when player got double damage from just only one explosion...
-
Gonna try it soon
- 21 replies
-
- 1
-
- onclienthudrender
- onclientprerender
-
(and 1 more)
Tagged with:
-
So if i don't need use function(s) globally i can make all of them local, and it will be better a bit?
-
Okey, looks like i have finished this system for vehicles Thanks for help, i will test it soon with players and i will let you know how it works. One more question, so i wouldn't need to create another topic for it. What exactly does declaring function as local I know what it does if you declare variable as local, but it's the same for function, like will be faster?
-
Nah it's not rapid , looks like it but it isn't. I have created basics for this system about 1~ month ago. And hardest (for me) things i am doing now (after a lot of other stuff creating. You helped me a lot of with certain things, big thanks to you ), at nearly end of this which I am doing. So this way should work, I am right? Still i don't know how can i get awaiting damage from this table. -- table structure -- local damageToSync = { [vehicle] = { [attacker] = loss, [attacker] = loss } [vehicle] = { [attacker] = loss, [attacker] = loss } } ]]
-
Maybe i didn't understand everything correctly. I made this in some other way. - Once you create a vehicle, it inserts vehicle in table with data, and send it to players. (vehicle interface) - delay: 60 seconds for player - When you repair a vehicle, it update data for certain vehicle in table, and send it to players. (vehicle interface) - delay: 60 seconds for player * This is only for the players connected to server. Some players can join later, they would need to have same data as players which have been before latejoiners. So: - Once a player login, a triggerLatentClientEvent from server it's sended directly to him, to copy whole data from server-side table, which should be up-to-date all the time, and it replaces (most-likely empty at this moment) client-side table with vehicles data. About data in tables - i delete cache for certain vehicles from both tables, onVehicleExplode on server-side and onClientElementDestroy (after about 30 seconds) on client-side. And about question. Shouldn't it work? Vehicle got damage > client send triggerLatentServerEvent with damage value > server checks it, updates a server-side table, and send updated data to clients with triggerLatentClientEvent. (Tested it alone, data was correct for every vehicle, after reconnect too.)
-
Hey, @IIYAMA i am glad about to say that your code works perfectly. I did some changes to it - changed source to colshape data, etc., and i encountered a problem on my way to finish this. \vehicles.lua:15: attempt to perform arithmetic on local 'damage' (a table value) This is code, added also colshape data (parent) to identify vehicle later: triggerLatentServerEvent("sendDataToServer", resourceRoot, parent, damageToSync) So basically it sends a table, not value of damage for certain car, how can i fix it? This is server-side event which is triggered. function sendDataToServer(index, damage) vehiclesCacheData.armorPoints[index] = vehiclesCacheData.armorPoints[index] - damage -- shows error here triggerLatentClientEvent("receiveVehicleData", resourceRoot, index, damage) end addEvent("sendDataToServer", true) addEventHandler("sendDataToServer", resourceRoot, sendDataToServer)
-
That's cool, i'll try it out soon, also with your other solutions for sounds, explosion damage etc., ty I have used your way to synchronize data from server-side table -> client. For me works well, but until i'll finish my scripts, i am testing stuff alone. I am impatient to test how it will works with players on server I wanna exclude using elementData in my scripts (atleast in 99%), by creating temporary data system, within tables + trigger/triggerLatent. By the way as we are in topic about player damage. Using server-side variation of this event should improve hitboxes? Or it's about configuring it here - https://wiki.multitheftauto.com/wiki/Sync_interval_settings Bullet sync, latency reduction, threadnet, bandwidth_reduction, and also this?
-
Oh well, so i should with onClientPlayerDamage?
-
Hey. Why script don't trigger server-side event onPlayerDamage? I decided to try server-side variation of this event. function onClientPlayerDamage(attacker, weapon, bodypart, loss) cancelEvent() end addEventHandler("onClientPlayerDamage", getLocalPlayer(), onClientPlayerDamage) function onPlayerDamage(attacker, weapon, bodypart, loss) outputDebugString("y") end addEventHandler("onPlayerDamage", getRootElement(), onPlayerDamage)
-
Same results, without creating effect. Anyway it's solved, so i'll leave as it is. local x, y, z = reParseNumber(posX), reParseNumber(posY), reParseNumber(posZ) createEffect(effect, x, y, z, 0, 0, 0)
-
@IIYAMA yup. Did it multiple times. No matter if it's Vector or not. It doesn't work for data sent by trigger.
-
It's weird situation, i don't really understand why it's happening. I already solved it by using client-side event. But maybe there's other solution. -- server function weaponEffects(weapon, endX, endY, endZ, hitElement, startX, startY, startZ) -- triggering custom event using onPlayerWeaponFire... addEventHandler("onPlayerWeaponFire", getRootElement(), weaponEffects) -- client function onPlayerClientWeaponFire(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) -- creating effect with hitX, hitY, hitZ, and it magically works. addEventHandler("onClientPlayerWeaponFire", getRootElement(), onPlayerClientWeaponFire)
-
Hey, i can't make this function works. It's all about position in Vector3, no idea why this don't wanna work. Working code: createEffect(effect, Vector3(getElementPosition(getLocalPlayer())), 0, 0, 0) Not working code: createEffect(effect, Vector3(posX, posY, posZ), 0, 0, 0) Any idea why this don't wanna work? Without errors/warnings in debugscript 3, i got a output so it means that trigger works, but effect don't creates.
-
It's already canceled.
-
Hey. I need to disable hit animation whenever player get shooted by sniper. How can i do it?
-
Hey. Need some help from you guys. I have function which basically, should hide attached to bone model whenever player aims. But it's not perfect. Here are my questions: - It's possible to make it more efficient/optimized? - There's any way to improve it? One and only problem is that this function sometimes don't set element alpha to 0, so the weapon it's visible even if player aiming. It's rarely, but i would like to fix it. function toggleWeaponsVisibility(key, keyState) if getPedWeaponSlot(getLocalPlayer()) == 6 then local alpha = 255 if keyState == "down" then alpha = 0 elseif keyState == "up" then alpha = 255 end local objects = getElementsByType("object", getRootElement(), true) for i = 1, #objects do if isElementAttachedToBone(objects[i]) and getElementModel(objects[i]) == 2763 or getElementModel(objects[i]) == 1820 or getElementModel(objects[i]) == 2708 or getElementModel(objects[i]) == 15036 then setElementAlpha(objects[i], alpha) end end end end bindKey("aim_weapon", "both", toggleWeaponsVisibility)
-
Found a workaround, solved. https://bugs.multitheftauto.com/view.php?id=7127
-
bump. Still looking for workaround, after crouch animation character still stands up. if isPedDucked(source) then setPedAnimation(source, "rifle", "RIFLE_crouchload", 1100, false, true, true, false) else setPedAnimation(source, "rifle", "RIFLE_load", 1100, false, true, true, false) end