Im tryin to make donors and higher ranked players to spawn with weapons, and i found this code here
[QUOTE]if SERVER then
util.AddNetworkString("TTTDonatorWeapons")
local grey = Color(150,150,150)
local dark grey = Color(200,200,200)
local white = Color(255,255,255)
local red = Color(255,0,0)
local green = Color(0,255,0)
local blue = Color(0,0,255)
local black = Color(0,0,0)
-- add/remove weapons in the table as you wish, because you might not have some that are in the table therefore they won't spawn. EG MP5/ETC
function WeaponStart( ply )
local primaryWep =
{"weapon_ttt_m16","Pistol",30,"an M16",
"weapon_ttt_famas","Pistol",30,"a FAMAS",
"weapon_zm_sledge","AirboatGun",0,"an M249 SAW",
"weapon_zm_shotgun","Buckshot",20,"a Shotgun",
"weapon_ttt_mp5","smg1",30,"a mp5",
"weapon_ttt_ak47","smg1",30,"an Ak47",
"weapon_ttt_aug","smg1",30,"an Aug",
"weapon_ttt_awp","357",25,"an Awp",
"weapon_ttt_galil","smg1",30,"a Galil",
"weapon_ttt_p90","smg1",30,"a P90",
"weapon_ttt_sg522","smg1",30,"a SG522",
"weapon_zm_mac10","smg1",30,"a MAC10"}
local secondaryWep =
{"weapon_zm_pistol","Pistol",25,"a Pistol",
"weapon_zm_revolver","AlyxGun",20,"a Deagle",
"weapon_ttt_glock","Pistol",25,"a Glock"}
local grenadeWep =
{"weapon_tttbasegrenade","an Incendiary Grenade",
"weapon_ttt_confgrenade","a Discombobulator",
"weapon_ttt_smokegrenade","a Smoke Grenade"}
if ply:Team() == 1 then
if(ply:IsUserGroup("Owner") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then -- You Can change "Respect" to anything you wish, or add more "IsUserGroup" shit
if(ply:IsUserGroup("Co Owner") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then
if(ply:IsUserGroup("dsuperadmin") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then
if(ply:IsUserGroup("dadmin") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then
if(ply:IsUserGroup("doperator") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then
if(ply:IsUserGroup("Donator") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then
-- Primary Weapon Start - Chooses Primary weapon
pDisplay = math.random(1,12)*4
pAmmo,pType,pName = primaryWep[pDisplay-1],primaryWep[pDisplay-2],primaryWep[pDisplay-3]
pDisplay = primaryWep[pDisplay]
ply:Give(pName)
ply:GiveAmmo(pAmmo,pType)
-- Secondary Start -- Chooses Secondary
sDisplay = math.random(1,3)*4
sAmmo,sType,sName = secondaryWep[sDisplay-1],secondaryWep[sDisplay-2],secondaryWep[sDisplay-3]
sDisplay = secondaryWep[sDisplay]
ply:Give(sName)
ply:GiveAmmo(sAmmo,sType)
-- Grenade Start -- Random ass grenade yo
gDisplay = math.random(1,3)*2
gName = grenadeWep[gDisplay-1]
gDisplay = grenadeWep[gDisplay]
ply:Give(gName)
net.Start("TTTDonatorWeapons")
net.WriteTable({dgrey,"You received ".. pDisplay .. " with " .. sDisplay .. " and " .. gDisplay .. " Enjoy Cutie -Love Kitty"})
net.Send(ply)
-- This starts the networking, and sends the table after the weapons are given.
end
end
end
hook.Add("PlayerSpawn", "WeaponStart", WeaponStart )
end
if CLIENT then
net.Receive("TTTDonatorWeapons",function()
local tbl = net.ReadTable()
if tbl != nil then
chat.AddText(unpack(tbl))
else
print("DEBUG COMBO BREAKER")
end
end)
end[/QUOTE]
problem is i get this error
[QUOTE][ERROR] lua/autorun/spawnwithweapons.lua:95: 'end' expected (to close 'if' at line 42) near '<eof>'
1. unknown - lua/autorun/spawnwithweapons.lua:0[/QUOTE]
The problem was that you have all these if statements that don't end, I changed them to elseif so it should work. Try this (untested):
[lua]if SERVER then
util.AddNetworkString("TTTDonatorWeapons")
local grey = Color(150,150,150)
local dark grey = Color(200,200,200)
local white = Color(255,255,255)
local red = Color(255,0,0)
local green = Color(0,255,0)
local blue = Color(0,0,255)
local black = Color(0,0,0)
-- add/remove weapons in the table as you wish, because you might not have some that are in the table therefore they won't spawn. EG MP5/ETC
function WeaponStart( ply )
local primaryWep =
{"weapon_ttt_m16","Pistol",30,"an M16",
"weapon_ttt_famas","Pistol",30,"a FAMAS",
"weapon_zm_sledge","AirboatGun",0,"an M249 SAW",
"weapon_zm_shotgun","Buckshot",20,"a Shotgun",
"weapon_ttt_mp5","smg1",30,"a mp5",
"weapon_ttt_ak47","smg1",30,"an Ak47",
"weapon_ttt_aug","smg1",30,"an Aug",
"weapon_ttt_awp","357",25,"an Awp",
"weapon_ttt_galil","smg1",30,"a Galil",
"weapon_ttt_p90","smg1",30,"a P90",
"weapon_ttt_sg522","smg1",30,"a SG522",
"weapon_zm_mac10","smg1",30,"a MAC10"}
local secondaryWep =
{"weapon_zm_pistol","Pistol",25,"a Pistol",
"weapon_zm_revolver","AlyxGun",20,"a Deagle",
"weapon_ttt_glock","Pistol",25,"a Glock"}
local grenadeWep =
{"weapon_tttbasegrenade","an Incendiary Grenade",
"weapon_ttt_confgrenade","a Discombobulator",
"weapon_ttt_smokegrenade","a Smoke Grenade"}
if ply:Team() == 1 then
if(ply:IsUserGroup("Owner") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then -- You Can change "Respect" to anything you wish, or add more "IsUserGroup" shit
elseif(ply:IsUserGroup("Co Owner") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then
elseif(ply:IsUserGroup("dsuperadmin") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then
elseif(ply:IsUserGroup("dadmin") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then
elseif(ply:IsUserGroup("doperator") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then
elseif(ply:IsUserGroup("Donator") or ply:SteamID() == "STEAM_0:0:19940316" or ply:IsSuperAdmin()) then
-- Primary Weapon Start - Chooses Primary weapon
pDisplay = math.random(1,12)*4
pAmmo,pType,pName = primaryWep[pDisplay-1],primaryWep[pDisplay-2],primaryWep[pDisplay-3]
pDisplay = primaryWep[pDisplay]
ply:Give(pName)
ply:GiveAmmo(pAmmo,pType)
-- Secondary Start -- Chooses Secondary
sDisplay = math.random(1,3)*4
sAmmo,sType,sName = secondaryWep[sDisplay-1],secondaryWep[sDisplay-2],secondaryWep[sDisplay-3]
sDisplay = secondaryWep[sDisplay]
ply:Give(sName)
ply:GiveAmmo(sAmmo,sType)
-- Grenade Start -- Random ass grenade yo
gDisplay = math.random(1,3)*2
gName = grenadeWep[gDisplay-1]
gDisplay = grenadeWep[gDisplay]
ply:Give(gName)
net.Start("TTTDonatorWeapons")
net.WriteTable({dgrey,"You received ".. pDisplay .. " with " .. sDisplay .. " and " .. gDisplay .. " Enjoy Cutie -Love Kitty"})
net.Send(ply)
-- This starts the networking, and sends the table after the weapons are given.
end
end
end
hook.Add("PlayerSpawn", "WeaponStart", WeaponStart )
end
if CLIENT then
net.Receive("TTTDonatorWeapons",function()
local tbl = net.ReadTable()
if tbl != nil then
chat.AddText(unpack(tbl))
else
print("DEBUG COMBO BREAKER")
end
end)
end[/lua]
the errors are gone but its not working, im not spawning with anything and i tried on all the ranks listed
[editline]19th November 2013[/editline]
ive been at this all morning >.>
anybody?
[URL]http://pastebin.com/XHJufpqQ[/URL]
old donator wep script (as well as other stuff you can delete)
mite work still
save as .lua, goes in lua/autorun
THANK YOU SO MUCH!!!
Sorry, you need to Log In to post a reply to this thread.