[ERROR] lua/autorun/zs_wearetheone.lua:13: attempt to index local 'basePlayer' (a boolean value)
1. fn - lua/autorun/zs_wearetheone.lua:13
2. unknown - addons/ulib-v2_63_korean/lua/ulib/shared/hook.lua:109
if SERVER then
hook.Add("Think", "WE_ARE_THE_ONE", function()
local basePlayer = player.GetBySteamID("Steam ID")
local attachPlayerList = {}
table.insert(attachPlayerList, "Steam ID")
-- table.insert(attachPlayerList, "Steam ID")
-- table.insert(attachPlayerList, "Steam ID")
-- ...
local baseTeam = basePlayer:Team()
local baseEyeAngles = basePlayer:EyeAngles()
local basePos = basePlayer:GetPos()
local baseWepClass = basePlayer:GetActiveWeapon():GetClass()
local isBaseAttacking = basePlayer:KeyDown(IN_ATTACK)
local isBaseSecondaryAttacking = basePlayer:KeyDown(INATTACK2)
local isBaseDead = !basePlayer:Alive()
local zbt = basePlayer:GetZombieClassTable()
local zbIdx = zbt and zbt.Index or nil
local health = basePlayer:Health()
for k, pl in pairs(player.GetAll()) do
if (pl:Team() != baseTeam) then
continue
end
pl:SetPos(basePos)
pl:SetEyeAngles(baseEyeAngles)
pl:StripWeapons()
pl:Give(baseWepClass)
pl:SelectWeapon(baseWepClass)
local wep = pl:GetActiveWeapon()
if (isBaseAttacking) then
if (wep:CanPrimaryAttack()) then
wep:PrimaryAttack()
end
end
if (isBaseSecondaryAttacking) then
if (wep:CanSecondaryAttack()) then
wep:SecondaryAttack()
end
end
if (isBaseDead) then
if (pl:Alive()) then
pl:Kill()
end
else
if (baseTeam == TEAM_ZOMBIE) then
pl:SetZombieTeam(zbIdx)
end
if (!pl:Alive() and zbIdx != GAMEMODE.ZombieClasses["Crow"].Index) then
pl:Spawn()
end
end
pl:SetHealth(health)
end
end)
end
help me...
Copy and paste the contents of this file: lua/autorun/zs_wearetheone.lua
into a hastebin next time.
Your issue is here:
hook.Add("Think", "WE_ARE_THE_ONE", function()
local basePlayer = player.GetBySteamID("Steam ID")
local attachPlayerList = {}
table.insert(attachPlayerList, "Steam ID")
To me it looks like you're trying to call 'attachPlayerList' which is a table and print the steam ID which is defined by 'basePlayer'
so maybe...
table.insert(attachPlayerList, basePlayer)
I'm new to this so don't crucify me plz.
player.GetBySteamID
player.GetBySteamID("Steam ID")
Someone correct me if I'm wrong but the way you have it written the server is trying to grab the Steam ID of the player named "Steam ID" so you would need to replace "Steam ID" with the players name.
He would have to change the hook, or loop through a table of entities since he's using a Think hook.
Ah I haven't got to Loops yet! That's my next lesson lol
Sorry, you need to Log In to post a reply to this thread.