I have been trying to give my player a weapon and the tutorial I followed does not work. Here is my code
[LUA]AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include('shared.lua')
local TEAM_RED, TEAM_BLUE = 1, 2
function GM:PlayerInitialSpawn(ply)
if team.NumPlayers(TEAM_RED) > team.NumPlayers(TEAM_BLUE) then
ply:SetTeam(TEAM_BLUE)
ply:SetModel( "models/player/combine_super_soldier.mdl" )
ply:SetPlayerColor( Vector( 0, 174, 255 ) )
elseif team.NumPlayers(TEAM_BLUE) > team.NumPlayers(TEAM_RED) then
ply:SetTeam(TEAM_RED)
ply:SetModel( "models/player/combine_super_soldier.mdl" )
ply:SetPlayerColor( Vector( 247, 54, 54 ) )
else
local r = math.Rand(1,2)
if r == 1 then
ply:SetTeam(TEAM_RED)
ply:SetModel( "models/player/combine_super_soldier.mdl" )
ply:SetPlayerColor( Vector( 247, 54, 54 ) )
else
ply:SetModel( "models/player/combine_super_soldier.mdl" )
ply:SetTeam(TEAM_BLUE)
ply:SetPlayerColor( Vector( 0, 174, 255 ) )
end
end
ply:SetGravity(1)
ply:SetWalkSpeed(250)
ply:SetRunSpeed(320)
ply:SetCrouchedWalkSpeed(0.3)
ply:SetNoCollideWithTeammates(false)
end
function GM:PlayLoadout(ply)
ply:Give("weapon_357")
ply:GiveAmmo(24, "357",true)
end
function GM:PlayerShouldTakeDamage(ply, att)
if att:IsPlayer() then
if ply:Team() == att:Team() then
return false
end
end
return true
end
function GM:CanPlaySuicide()
return true
end[/LUA]
This is the last thing I need to do before my gamemode is complete!
Isnt it PlayerLoadout not PlayLoadout?
Sorry, you need to Log In to post a reply to this thread.