
StefanAlmighty
Members-
Posts
143 -
Joined
-
Last visited
Everything posted by StefanAlmighty
-
It's possible. Use onClientRender and getElementsByType. For example first create a script that automatically makes every GUI invisible and then loop through all gui elements using getElementsByType. From there you can mimic the GUI positions but with dx.
-
playerTable = {} playerTable[1] = {} Above is the same as: playerTable = { [1] = { } } To add to it: table.insert(playerTable[1], content)
-
The issue with your original code is here: addVehicleUpgrade ( theVehicle, spoilers+1 ) spoilers is defined as a table in your code and in this line you're trying to +1 to the table which isn't possible. To choose a random spoiler from the list: spoilers[math.random(1, #spoilers)] To cycle through each one, start by defining the current spoiler it's on as seen in the script provided above. Each time you trigger changespoiler you want to add 1 to the current spoiler variable but if it hits #spoilers+1 then reset it to 1. That way each time you trigger changespoiler it will cycle through the list of parts in your spoilers table.
-
Show all of the code and the errors appearing in debugscript - it's difficult to determine what's wrong with your script when we can only see 4 lines.
-
Your issue is with onClientPlayerJoin: https://wiki.multitheftauto.com/wiki/OnClientPlayerJoin As stated on the wiki all players except the source player will have the event triggered which is why everybody but you is seeing the text. Try using this: https://wiki.multitheftauto.com/wiki/On ... ourceStart onClientResourceStart is triggered when the player first loads the client file (so pretty much seconds after they join or when the resource is restarted). function outputScreenSize(res) if res == getThisResource() then local x,y = guiGetScreenSize(getLocalPlayer()) outputChatBox ( x.. "x" ..y, 255,255,255 ) end end addEventHandler("onClientResourceStart", getRootElement(), outputScreenSize)
-
In your meta.xml, which file loads first? The serverside or clientside? The code won't work if serverside loads first because it's calling a function immediately on start when the clientside file hasn't loaded yet.
-
Take a look here: https://wiki.multitheftauto.com/wiki/SetWeaponProperty According to this you cannot modify the shovel using this function so the method I posted above would be most appropriate in your case. Good luck.
-
In no way is this helping the OP. The OP directly asked for a list of functions and never asked for the full code because he is not learning from it. Anyone can copy and paste. To answer the topic, you can use createMarker, onMarkerHit, createVehicle and setElementModel. Bold means it's an event rather than function. It would also be a good idea to put the list of models you wish to use in a table using curly brackets. By doing this you can easily loop through each of the vehicles and even choose one from random. For example if the table was called 'vehicles', you can use vehicles[math.random(1, #vehicles)] which would fetch a random vehicle from the table.
-
So you want to completely replace the shovel and use it as a physical gun which shoots? There are several things you can do to achieve this but it may be quite difficult for you: Start by replacing the shovels DFF and TXD with your choice of gun (for example the deagle). You can use bindKey to bind left-click and using getPedTarget you can get a target player. When the player shoots you can deduct health from the target using setElementHealth and getElementHealth. Then to make the sound effects you can use playSound and setSoundVolume for all nearby players. For the blood effect (when they're shot) you can use fxAddBlood which will simulate when the player is shot with a real GTA gun. For the crosshair you can use getKeyState (to check if they're aiming) and then render some dx shapes.
-
[Help] How to create a list of highest to lowest
StefanAlmighty replied to WalkinG's topic in Scripting
Not sure what you mean but I assume you want to put every player in order of their kills. Start by storing all of the values into a table using a loop. You can then use table.sort to sort the table as you wish, in your case by order of their kills. Good luck. -
function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) if attacker and attacker ~= source then local veh = getPedOccupiedVehicle(attacker) if veh then fixVehicle(veh) else outputChatBox("The player you killed was not in a vehicle.", attacker, 255, 0, 0) end end end addEventHandler("onPlayerWasted",root, rewardOnWasted) This should help determine why it isn't working. Remember as Karim said this is triggered when the player dies.
-
What do you mean? If you're trying to attach the briefcase to the player for when they enter or exit an interior then use attachElements function.
-
Does it give any errors in debugscript and is the file included in the meta?
-
The function you gave is incomplete: function rewardOnWasted ( ammo, attacker, killerweapon, bodypart ) if ( attacker ) and ( attacker ~= source ) then local veh = getPedOccupiedVehicle(attacker) fixVehicle(veh) end end addEventHandler ( "onPlayerWasted" I wrapped the code you sent into LUA tags so it's easier for you to read. From first glance everything looks fine except from the event handler which is incomplete, try changing it to: addEventHandler("onPlayerWasted", getRootElement(), rewardOnWasted) Take a look here and look at the required arguments: https://wiki.multitheftauto.com/wiki/AddEventHandler
-
Also I advise taking a look here: https://wiki.multitheftauto.com/wiki/Element_tree It will give you more of an understanding about using elements in the element tree.
-
When you trigger the event, by triggering it to 'root' you trigger it to every element in the game. This is why everybody is seeing it and it may also cause lag. Also when you add the event handler you also put 'root'. Basically what I am saying is by using 'root' that triggers it for everyone. Instead of 'root', try using 'source' in serverside and getLocalPlayer() clientside. This should prevent everybody seeing your GUI and only the person who types /seegui will see it. You're welcome.
-
NeverGiveup gave, I presume a working chunk of code but didn't explain what was wrong: szoveg is the element returned from guiCreateMemo and you tried concatenating that element into a string, which cannot be done. You need to use guiGetText which will get all of the text from the GUI element which is in your case the memo. Also you define szoveg as a table to begin with, you didn't need to do that, you could've just done this: local szoveg = guiCreateMemo(13, 23, 294, 223, "", false, GUIEditor.window[1])
-
Look in your scripts for onResourceStart and onClientResourceStart and look for anything money related.
-
Finally after around 4 hours of experimenting I managed to make it work. Scrolls perfectly. Thanks VirusGaming.
-
Does that make it so it only scrolls down based on how many rows there are? I don't want it so you can scroll down as much as you'd like, only based on how many rows there are. So far I've made it cut off when the rows reach the bottom of the gridlist: What I intend on doing is dividing the extra rows by 100 (gives me how much the scrollbar should go down each time). The scrollbar has an invisible GUI which is how it works, so would making it work with onClientGUIScroll be effective?
-
How do I set the size of the scroll bar (not the actual width/height) but how far you can scroll down using it. I made a scroll bar using guiCreateScrollBar and I want to config how much you can scroll.
-
Okay I've made the scrollbar but how do I make the overflowing rows only appear when you scroll?
-
The values loaded into the grid is loaded from a table called 'rows'. Each value for each column is stored in the table eg there is 4 columns as shown in the image. Row one would be {"1", "Apple", "United States", "Yes"}. A drawing would help since it's pretty complex.
-
I'm working on the scrollbar but I'm having issues. As the player holds down their mouse, I'm trying to make the scrollbar follow the cursors Y coordinate. I use this to get the absolute position of the cursor's Y: local cX, cY, wX, wY, wZ = getCursorPosition() local w, h = guiGetScreenSize() local absoluteY = cX * h I then set the scrollbars Y to absoluteY but it bugs out, no errors or anything. It goes slightly below the dxWindow and remains there, even when I try to click/drag it. Fixed that ^, for future reference absoluteY was supposed to be cY * h not cX.
-
I've scripted it so if there are too many rows to fit, it draws the scrollbar: The scroll bar does not move yet, working on that now. If anybody knows how I'll make the rows render based on the scrollbars position then I'll be grateful.