majqq

Members
  • Content Count

    100
  • Joined

  • Last visited

Community Reputation

18 Decent

1 Follower

About majqq

  • Rank
    Punk-@ss B*tch

Recent Profile Visitors

306 profile views
  1. majqq

    Drag'n'Drop

    I have found this event: onClientGUIMouseDown - This event is fired when the user clicks certain mouse button on a GUI element. And example for it: -- This example show how to add very basic click'n'drag feature for GUI elements (only for those which parent element is gui-root) addEventHandler( "onClientGUIMouseDown", getRootElement( ), function ( btn, x, y ) if btn == "left" then clickedElement = source; -- store the clicked element in a global variable local elementPos = { guiGetPosition( source, false ) }; offsetPos = { x - elementPos[ 1 ], y - elementPos[ 2 ] }; -- get the offset position end end ); addEventHandler( "onClientGUIMouseUp", getRootElement( ), function ( btn, x, y ) if btn == "left" then clickedElement = nil; end end ); addEventHandler( "onClientCursorMove", getRootElement( ), function ( _, _, x, y ) if clickedElement then guiSetPosition( clickedElement, x - offsetPos[ 1 ], y - offsetPos[ 2 ], false ); end end ); Those three events should work for row(s)? After some changes. UPD: @Ab-47 i will try it.
  2. majqq

    Using server-side table on client-side.

    But when variables are saved in local table, it's really big difference in it comparing to define variable as local?
  3. majqq

    Using server-side table on client-side.

    What about packing variables in local table? Shouldn't result be similar to define variable as local? And still it should be faster than global variable, atleast i think so. (For let you know i have small count of global variables.)
  4. majqq

    Using server-side table on client-side.

    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.
  5. majqq

    Drag'n'Drop

    Hey, as topic says, how can i make something like drag'n'drop in GUI?
  6. majqq

    <enablesd></enablesd>

    https://wiki.multitheftauto.com/wiki/Server_mtaserver.conf https://wiki.multitheftauto.com/wiki/Anti-cheat_guide Quote from wiki:
  7. majqq

    Dynamic colshapes

    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?
  8. majqq

    Dynamic colshapes

    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.
  9. majqq

    onClientPlayerDamage - executes 1-4 times

    bump. Still looking for fix, it's annoying when player got double damage from just only one explosion...
  10. majqq

    Using server-side table on client-side.

    So if i don't need use function(s) globally i can make all of them local, and it will be better a bit?
  11. majqq

    Using server-side table on client-side.

    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?
  12. majqq

    Using server-side table on client-side.

    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 } } ]]
  13. majqq

    Using server-side table on client-side.

    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.)
  14. majqq

    Using server-side table on client-side.

    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)