• Trouble in Terrorist Town Evolve Rank Specific Gun Spawning
    4 replies, posted
I've only been using Lua for about seven months, and am fairly novice at making Lua codes. Basically what I'm trying to do is if a player is in game, and are the rank respected (played on the server for 24 hours), they spawn with one of three guns. What I want is to figure out what is wrong. I don't need someone to re-write the code. (You can if you would like) [CODE]hook.Add( "TTTBeginRound", "ply", function()) if ply:Team() == 1 then if( evolve.ranks[ ply:EV_GetRank() ].Title == "Respected" ) then arr = {} arr[0] = "weapon_sis2_mp5" arr[1] = "weapon_sis2_sg550" arr[2] = "weapon_sis2_sg552" ply:Give((arr[math.random(0, 2)])) else print("TTT Round Start!") else print("You are in Spectator Mode") end [/CODE]
I'm assuming that's how you get the Evolve rank. Ask if you don't understand something: [lua] local arr = { "weapon_sis2_mp5", "weapon_sis2_sg550", "weapon_sis2_sg552" } hook.Add("TTTBeginRound", "ply", function() if ply:IsSpec() then return end if(evolve.ranks[ply:EV_GetRank()].Title == "Respected") then ply:Give(table.Random(arr)) end end) [/lua]
Well, it didn't work. There were a few mismatched parentheses. I do have one question though. On the hook, does the first parenthesis' match come after the "function()" "random(arr)" or the last "end"
[QUOTE=ChemicalCat;39136626]Well, it didn't work. There were a few mismatched parentheses. I do have one question though. On the hook, does the first parenthesis' match come after the "function()" "random(arr)" or the last "end"[/QUOTE] Once again the syntax is correct, it's your evolve rank retrieving code that i'm not sure about. You'll have to look into that yourself.
Oh I see, yeah, it's probably the evolve rank, I'll have to look into it. Thanks again!
Sorry, you need to Log In to post a reply to this thread.