I have a table:
local myTable = {
[204] = { 50, 10 },
[820] = { 22, 32 },
[103] = { 42, 66 },
}
How can I sort this table by the first index, so it'd be in order, like: 50, 42, 22 descending.
It seems that using all 4 corners doesn't accomplish what I need, @Jayceon, because there are some occurrences when the two rectangles are touching but none of the corners are conflicting.
For example: https://gyazo.com/981ce6b1691e68c833ba4934a3216979
As you can see in the diagram, the two rectangles are touching but none of the corners are within each other. Appreciate any further help.
Does anybody know how I can check if a rectangle (x, y, width, height) is touching another rectangle (x, y, width, height) on the screen? I have two DX rendered rectangles and want to check if they're touching, so I can change the colour of them if they are.
Pretty self explanatory. I think an event for when elements are created would be very useful. The source of the event should be the element and maybe a parameter for whichever resource the element was created in.
Calm down and keep your salt levels at minimum.
I'm stating what I've witnessed and I find it extremely ironic how you hate on communities and claim they're :~, constantly crying, undermining them and then you come asking for help from the same people.
75% of my post was helping you, the other 25% was pointing out how pathetic your actions were and what they've led to.
Grow up kid and accept the truth.
I thought you were a pro scripter, rays? Giving hate to all the roleplay communities that launch? Claiming people cannot script or are :~ at scripting? Ironic isn't it?
guiCreateButton on your example is completely wrong. A button does not have a Z coordinate because it's a 2 dimensional element.
Proper: guiCreateButton(x, y, width, height, "Delete", relative, parent)
When the player clicks the button, it triggers onClientGUIClick. Once clicked, figure out which row is selected on your grid list using guiGridListGetSelected. To delete it from the grid list you can use guiGridListRemoveRow and to delete it from the DB you need to run a delete statement, e.g. "DELETE FROM stats ... etc"
Remember don't use the MySQL module as it's now deprecated, use the native MySQL functions such as dbQuery and dbConnect.
Okay I have a couple questions regarding table sorting:
How can I sort this table, from A to Z by it's first value, so myTable[1]?
local myTable = {
{ "David", 21, "Male", "Chicago" },
{ "Jessica", 42, "Female", "New York" },
{ "Kevin", 14, "Male", "New York" },
{ "Louise", 21, "Female", "Washington" },
}
Similar with numbers, how do I sort that table from lowest to highest by it's second value, myTable[2]?
Thank you.
I'm firing a round with 5 rounds total. It goes from 4, 3, 2, 1, 0 and stops firing. It allows you to continue firing after you lower your gun and raise it again, and also fires 0, then performs the automated GTA SA reload.
It's not anywhere else. Mind sharing your code?
function checkClip(weapon, ammo, clipammo)
if clipammo == 1 then
bindKey("R", "down", clientReloadClip)
toggleControl("fire", false)
toggleControl("next_weapone", false)
toggleControl("previous_weapon", false)
end
end
addEventHandler("onClientPlayerWeaponFire", getRootElement(), checkClip)
For some reason, when shooting a gun, you get to the last bullet and it stops shooting. But if you release the fire button and press it again, it allows you to continue shooting even though I've used toggleControl and disabled the ability to shoot.
Is this a bug with toggleControl or did I do something wrong?
next_weapon is spelt wrong, I fixed that, but it didn't affect anything.