General > Developers Corner

Lua Help

<< < (2/4) > >>

jay209015:
Line 32:

--- Code: ---hood.Add( "PlayerInitialSpawn", "FirstSpawn", FirstSpawn)
--- End code ---
I think you know what that should be :P

Major_Pain:

--- Quote from: jay209015 on August 31, 2009, 03:47:21 PM ---Line 32:

--- Code: ---hood.Add( "PlayerInitialSpawn", "FirstSpawn", FirstSpawn)
--- End code ---
I think you know what that should be :P

--- End quote ---

Lol, fixed that and now the chat thing works but still doesn't strip my weapons and give me the new ones.

Updated Code:

--- Code: ---local function StartingGuns( ply )
ply:StripWeapons()
ply:Give( "weapon_physcannon" )
ply:Give( "weapon_physgun" )
ply:Give( "gmod_tool" )
ply:Give( "gmod_camera" )
if ply:IsUserGroup("admin") then
ply:Give( "weapon_punisher" )
ply:Give( "ulx_gun" )
end
if ply:IsUserGroup("superadmin") then
ply:Give( "weapon_punisher" )
ply:Give( "ulx_gun" )
ply:Give( "weapon_ar2" )
end
if ply:IsUserGroup("owner") then
ply:Give( "weapon_punisher" )
ply:Give( "ulx_gun" )
ply:Give( "weapon_haxgun" )
ply:Give( "weapon_ar2")
end
end

hook.Add( "PlayerLoadout", "StartingGuns", StartingGuns)

local function FirstSpawn( ply )
if ply:IsAdmin() then
ply:PrintMessage( HUD_PRINTTALK, "Major Pain: Oh hai thar admin! Lolz" )
end
end

hook.Add( "PlayerInitialSpawn", "FirstSpawn", FirstSpawn)

local function Spawn ( ply )
if ply:IsUserGroup("owner") then
ply:SetGravity( 0, 90 )
ply:SetWalkSpeed( 325 )
ply:SetRunSpeed( 1000 )
end
end

hook.Add( "PlayerSpawn", "PlayerSpawn", Spawn)
--- End code ---

EDIT: Tried to change PlayerLoadout to PlayerSpawn on the "StartingGuns" function and that didn't work either.

Major_Pain:
Ok! So after a lot of fail on my part the wiki prevailed.

Now I have a new problem.
Thanks Jay!

JamminR:
Using a dedicated server?
Those are server functions, so if you're only editing locally then joining your server, those functions won't run.

What errors are you getting, if they aren't working?

Major_Pain:

--- Quote from: JamminR on August 31, 2009, 06:13:40 PM ---Using a dedicated server?
Those are server functions, so if you're only editing locally then joining your server, those functions won't run.

What errors are you getting, if they aren't working?

--- End quote ---

I was testing on my local machine by creating a lan server. I am using it for a legit server now thanks to jay's help off of the forums.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version