• How to fix this LUA problem for Weapon Spawning
    6 replies, posted
Hello, I'm making a script for gmod allowing you to spawn certain weapons for groups. I've already gotten this working but I want to do it with group tables and group weapons. The group table is working fine, just the weapon table. The code: https://pastebin.com/8Li4yv69 [ERROR] addons/weaponspawning/lua/autorun/userloadout.lua:5: ')' expected near ','   1. unknown - addons/weaponspawning/lua/autorun/userloadout.lua:0
You use {} for tables not ()
It fixed the issue but it will not spawn the desired weapon: weapon_stunstick
Two things: 1) Use the PlayerLoadout hook instead of playerspawn 2) Give() is to be used with a weapon, not a table of weapons, use a for loop here
I have never done a loop before in LUA. Can you explain to me how?
https://www.youtube.com/watch?v=iyDSrN01hJY A video on how to do it.
Take a look at: https://gmod.facepunch.com/f/gmoddev/bsqte/Donator-Weapons/1/#postcvdovd More specifically: Donator Weapons my response includes several of my tutorials which show gun-race options, giving weapons, removing, upgrading, etc.... These should help you set up a script for handing out weapons based on group.. Note: Since it is for group - if on spawn use the PlayerLoadout hook but do NOT return any value... When you use hook.Add, other hooks run too - if you return a value then no other hooks will be called, including the original GM function...
Sorry, you need to Log In to post a reply to this thread.