GM:InitialPlayerSpawn not working

-snip- original problem fixed.

Do have a few questions though:

how do I disable damage between people of the same team? this should work right?


function GM:PlayerShouldTakeDamage( ply, victim )
    if ply.IsPlayer() then
        if ply:Team() == victim:Team() and ply:Team() != 1 then
            return false
        end
    end
    return true
end

I’ve been trying to do this one all night - I want to make it so that each player spawns with their individual variable yyyyy set was true, and when they take out any weapon from a list (have it in their hands) it turns false. How would I go about doing this? Individual variables are super confusing to me, and I have no idea how to trigger it when specific weapons go in hand.

edit: now ive got a HUGE bug… whenever I try to make an if statement it breaks everything


function TestProtected( ply )
    local dfera = true
    if dfera = true then
        ply:PrintMessage(3, "You are protected.")
    else
        ply:PrintMessage(3, "You aren't safe.")
    end
end
concommand.Add("amprotect", TestProtected)

even that broke the init.lua. however the if statements in my anti-teamkill script work fine. this is super frustrating what am i doing worng?

Thank you guys so much for being so helpful and patient all the time. Awesome communtiy :slight_smile:

This is how fretta does it:


if ( attacker.Team && ply:Team() == attacker:Team() && ply != attacker ) then return false end

Put it in a hook. Unless your making a gamemode, you shouldn’t be overriding default functions.

I am making a gamemode. The second thing is more important right now though, because I think my script works.

What is the error you’re getting?



local function TestProtected( ply )
    local dfera = true
    if (dfera == true) then
        ply:PrintMessage(3, "You are protected.")
    else
        ply:PrintMessage(3, "You aren't safe.")
    end
end
concommand.Add("amprotect", TestProtected)


You need == to check is something is equal.

Alternatively, you can just do:



local function TestProtected( ply )
    local dfera = true
    if (dfera) then
        ply:PrintMessage(3, "You are protected.")
    else
        ply:PrintMessage(3, "You aren't safe.")
    end
end
concommand.Add("amprotect", TestProtected)