I was wondering if anyone has a code so when donators spawn in ttt they spawn with a gun(Like a deagle or something)?
Here, Use this.
[lua]-- This is some old code someone made before, I refined it and changed only a few things.
-- Therefore, I'm not claiming credit for the code (majority)
-- but I'm just going to say I authored this right here (Zero the fallen)
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",20,"an M16",
"weapon_zm_mac10","smg1",30,"a MAC10",
"weapon_zm_sledge","AirboatGun",0,"an M249 SAW",
"weapon_zm_shotgun","Buckshot",16,"a Shotgun",
"weapon_zm_rifle","357",10,"a Rifle",
"weapon_ttt_mp5","smg1",30,"a mp5"}
local secondaryWep =
{"weapon_zm_pistol","Pistol",20,"a Pistol",
"weapon_zm_revolver","AlyxGun",16,"a Desert Eagle",
"weapon_ttt_glock","Pistol",20,"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("Respected") or ply:IsSuperAdmin()) then -- You Can change "Respect" to anything you wish, or add more "IsUserGroup" shit
-- Primary Weapon Start - Chooses Primary weapon
pDisplay = math.random(1,6)*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({white,"[",blue,"wD Donator Weapons",white,"]",black,": ",dgrey,"You received ".. pDisplay .. " with " .. sDisplay .. " and " .. gDisplay .. "!"})
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("Empty Table. - Debug")
end
end)
end
-- Client receives the chat.addtext table, and it prints to them, and also has a debug if it fucks up.
/*
this is compatible with hatschat chatbox fyi
*/[/lua]
Read the comments I left so you figure out how to work it.
Garrysmod/lua/autorun
preferably, learn some lua.
[QUOTE=zerothefallen;41232628]Here, Use this.
[lua]-- This is some old code someone made before, I refined it and changed only a few things.
-- Therefore, I'm not claiming credit for the code (majority)
-- but I'm just going to say I authored this right here (Zero the fallen)
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",20,"an M16",
"weapon_zm_mac10","smg1",30,"a MAC10",
"weapon_zm_sledge","AirboatGun",0,"an M249 SAW",
"weapon_zm_shotgun","Buckshot",16,"a Shotgun",
"weapon_zm_rifle","357",10,"a Rifle",
"weapon_ttt_mp5","smg1",30,"a mp5"}
local secondaryWep =
{"weapon_zm_pistol","Pistol",20,"a Pistol",
"weapon_zm_revolver","AlyxGun",16,"a Desert Eagle",
"weapon_ttt_glock","Pistol",20,"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("Respected") or ply:IsSuperAdmin()) then -- You Can change "Respect" to anything you wish, or add more "IsUserGroup" shit
-- Primary Weapon Start - Chooses Primary weapon
pDisplay = math.random(1,6)*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({white,"[",blue,"wD Donator Weapons",white,"]",black,": ",dgrey,"You received ".. pDisplay .. " with " .. sDisplay .. " and " .. gDisplay .. "!"})
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("Empty Table. - Debug")
end
end)
end
-- Client receives the chat.addtext table, and it prints to them, and also has a debug if it fucks up.
/*
this is compatible with hatschat chatbox fyi
*/[/lua]
Read the comments I left so you figure out how to work it.
Garrysmod/lua/autorun
preferably, learn some lua.[/QUOTE]
is there anyway you could over-write the crowbar with this code?
[QUOTE=lime150;45660997]is there anyway you could over-write the crowbar with this code?[/QUOTE]
............
I would make a "congratulations, you bumped a 1 year old thread" comment. But instead I would just help for once :P
Yes you can, use [URL="http://wiki.garrysmod.com/page/Player/StripWeapon"]ply:StripWeapon[/URL]
to remove the crowbar, then [URL="http://wiki.garrysmod.com/page/Player/Give"]ply:Give("Weapon")[/URL]
Sorry, you need to Log In to post a reply to this thread.