I am working on my own game mode for the most part it works accept my AI cops I am using the metro police for. Literally nothing happens when the player is wanted
My Un-Working Code:
[CODE]
local spawnlocation = ply:GetLocation()
local adds = math.random( 10, 50 )
local spl = Vector(spawnlocation)+Vector(adds,0,adds)
local cop = ents.Create( "npc_metropolice" )
local ply = Player
function spawncopsrep()
cop:SetPos( Vector( spl ) )
cop:Spawn()
cop:SetTarget (ply)
cop:SetEnemy (ply)
print("Spawn Routine Ran")
end
end)
hook.Add( "playerWanted", "wanted", function(ply, target, reason)
timer.Create( "cs", 5, 0, spawncopsrep)
print("Timer Created")
local ply = ply
end
end)
hook.Add( "playerUnWanted", "wanted", function(excrimianl, arrestor)
timer.stop( "cs")
print("Timer Stoped")
local ply = excriminal
end
end)
[/CODE]
Is added as a shared file in the autorun folder
Player is undefined.
How would I define the player as the player who has the wanted status?
Run it in a hook that's called when the player gets wanted.
Sorry, you need to Log In to post a reply to this thread.