Jump to content

StefanAlmighty

Members
  • Posts

    143
  • Joined

  • Last visited

Details

  • Gang
    Ballas

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

StefanAlmighty's Achievements

Poot-butt

Poot-butt (14/54)

2

Reputation

  1. 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.
  2. playerTable = {} playerTable[1] = {} Above is the same as: playerTable = { [1] = { } } To add to it: table.insert(playerTable[1], content)
  3. 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.
  4. 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.
  5. 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)
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. Does it give any errors in debugscript and is the file included in the meta?
  14. 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
  15. 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.
×
×
  • Create New...