Simple Edit : Toggle command for this mod : SIIIMPLEEEEE
5 replies, posted
Well, I found this mod that uses autorun ini, it makes npc shoot props somehow, anyways i need it to toggle with npcs_hate_props 1 or 0.... is that doable?? thanks!!
[lua]
//Conman
function PropSpawned(ply, model, prop)
local bull = ents.Create("npc_bullseye")
local X = math.random(-30,30)
local Y = math.random(-30,30)
local Pos = prop:LocalToWorld( prop:OBBCenter( ) )
bullpos = Vector(Pos.x + X,Pos.y + Y, Pos.z) -- I had to do this so at least some of the bullseyes could be seen by the enemy
bull:SetParent(prop)
bull:SetPos(bullpos)
bull:SetKeyValue("health","9999")
bull:SetKeyValue("minangle","360")
bull:SetKeyValue("spawnflags","516")
bull:SetNotSolid( true )
bull:Spawn()
bull:Activate()
end
hook.Add("PlayerSpawnedProp","PropHateSpawn", PropSpawned)
function NPCSpawn( ply, npc )
npc:Fire( "setrelationship", "npc_bullseye D_HT 1" )
end
hook.Add("PlayerSpawnedNPC", "PropHateNPC", NPCSpawn)
[/lua]
Uh, I suck at convars, but I think you can use them for this.
[url]http://wiki.garrysmod.com/?title=ConVars[/url]
Hopefully someone else can tell you exactly HOW you can do it, using them.
[QUOTE=Persious;33124132]Uh, I suck at convars, but I think you can use them for this.
[url]http://wiki.garrysmod.com/?title=ConVars[/url]
Hopefully someone else can tell you exactly HOW you can do it, using them.[/QUOTE]
thanks but that did not really help me.. tried it and the command does not do anything lol....
CreateConVar("npc_hate_props", "0", {FCVAR_SERVER_CAN_EXECUTE}) -- only serverside can toggle this command, and by default npc's do not hate props.
if GetConVarNumber("npc_hate_props") >= 1 then
-- npc's hate props
end
[QUOTE=Derek_SM;33127234]CreateConVar("npc_hate_props", "0", {FCVAR_SERVER_CAN_EXECUTE}) -- only serverside can toggle this command, and by default npc's do not hate props.
if GetConVarNumber("npc_hate_props") >= 1 then
-- npc's hate props
end[/QUOTE]
thanks!! so i just add that to the top??
liiiike this....
[lua]
{FCVAR_SERVER_CAN_EXECUTE})
if GetConVarNumber("npc_hate_props")
[/lua]
or do i need the >=1 then line??
You need the >= because, if the ConVar number is higher or the same as 1 then npc's hate props.
Sorry, you need to Log In to post a reply to this thread.