local rankWeapons = {}
rankWeapons[ "owner" ] = { "weapon_ttt_m16", "weapon_zm_revolver" }
rankWeapons[ "moderator" ] = { "weapon_ttt_m16", "weapon_zm_revolver" }
rankWeapons[ "donator" ] = { "weapon_ttt_m16", "weapon_zm_revolver" }
hook.Add( "PlayerSpawn", "Give Ranks Random Weapons", function( ply )
if rankWeapons[ ply:GetUserGroup() ] then
ply:Give( table.Random( rankWeapons[ply:GetUserGroup()] ) )
end
end )
This code is supposed to spawn those ranks with weapons. For some reason I only spawn w/ deagle rather than deagle + M16, anybody know why or have a better code
edit: I just spawned with only a m 16 but not deagle and m16
That's not what the code does, that's why.
It seems like you copied a script someone else made, assumed what it did, then edited the table and expected it to work.
Copied script, guy said thats what the code does, edited table for weapons, nothing else
[editline]26th April 2013[/editline]
OK sometimes I spawn with both, but how do I make it so that I spawn with both all the time
This code gives you a random weapon from the table. Use for loop to give all of them.
[code]
local rankWeapons = {}
rankWeapons[ "owner" ] = { "weapon_ttt_m16", "weapon_zm_revolver" }
rankWeapons[ "moderator" ] = { "weapon_ttt_m16", "weapon_zm_revolver" }
rankWeapons[ "donator" ] = { "weapon_ttt_m16", "weapon_zm_revolver" }
hook.Add( "PlayerSpawn", "Give Ranks Random Weapons", function( ply )
if rankWeapons[ ply:GetUserGroup() ] then
for id, wep in pairs(rankWeapons[ ply:GetUserGroup() ] ) do
ply:Give( wep )
end
end
end )
[/code]
Thanks a lot man
I'm not sure but doesn't "table.Random" rings a bell that it takes a random value? You don't need any coding knowledge to figure out that random means random.
Sorry, you need to Log In to post a reply to this thread.