<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Wiremod.com Forums - Wiremod Lua Coding</title>
		<link>http://www.wiremod.com/forum/</link>
		<description>Lua Coding</description>
		<language>en</language>
		<lastBuildDate>Thu, 09 Sep 2010 12:31:22 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.wiremod.com/forum/images/vblue/misc/rss.png</url>
			<title>Wiremod.com Forums - Wiremod Lua Coding</title>
			<link>http://www.wiremod.com/forum/</link>
		</image>
		<item>
			<title><![CDATA[[E2 Function] keyReload()]]></title>
			<link>http://www.wiremod.com/forum/wiremod-lua-coding/22444-e2-function-keyreload.html</link>
			<pubDate>Tue, 07 Sep 2010 23:13:13 GMT</pubDate>
			<description>I was attempting to learn some lua and noticed that there was an absence of keyReload(), its an extremely simple but useful code that i think should...</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->I was attempting to learn some lua and noticed that there was an absence of keyReload(), its an extremely simple but useful code that i think should be added to either wiremod svn or UWSVN. I don't feel like going through the processes necessary to have this committed to either svns  heres the code and if any dev sees this add it if you want. (I and many others think this should have been there in the first place)<br />
<br />
keyReload()<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">e2function number entity:keyReload()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not validEntity(this) then return 0 end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if this:IsPlayer() and this:KeyDown(8192) then return 1 end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0<br />
end</code><hr />
</div> To install this just simple place in garrysmod/addons/wire/lua/entities/gmod_wire_expression2/base/custom as a .lua file.<br />
Enjoy <i>-PINGAS</i><!-- google_ad_section_end --></div>

 ]]></content:encoded>
			<category domain="http://www.wiremod.com/forum/wiremod-lua-coding/">Wiremod Lua Coding</category>
			<dc:creator>PINGAS</dc:creator>
			<guid isPermaLink="true">http://www.wiremod.com/forum/wiremod-lua-coding/22444-e2-function-keyreload.html</guid>
		</item>
		<item>
			<title><![CDATA[[PropCore] Global spawn limit]]></title>
			<link>http://www.wiremod.com/forum/wiremod-lua-coding/22430-propcore-global-spawn-limit.html</link>
			<pubDate>Tue, 07 Sep 2010 03:45:20 GMT</pubDate>
			<description>As many people may have noticed, the limit for how many props can be spawned per second using propCore is shared by every person in the server. This...</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->As many people may have noticed, the limit for how many props can be spawned per second using propCore is shared by every person in the server. This means that you can't have more than one person consistently using propCore. I honestly don't know if it was intended to be like this, or if the author failed to think of a workaround, but I went ahead and did it.. To my knowledge, it works, but i've only tried in SP. In theory it should make it so every one has their own spawn limit per second, but i'd need someone to test it server side for me first.. Anyway, here's the code for whoever wants to try it out (It still works EXACTLY like the old prop core, the only difference would be the shared spawn limit being made into a personal spawn limit)<br />
<br />
Installation:<br />
    Just replace your prop.lua with the one below<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><br />
/******************************************************************************\<br />
Prop Core by ZeikJT and MrFaul. Limiter by Jacoby6000<br />
\******************************************************************************/<br />
<br />
E2Lib.RegisterExtension(&quot;propcore&quot;, true)<br />
<br />
hook.Add(&quot;PlayerInitialSpawn&quot;, &quot;wire_expression2_propcore&quot;, function(ply)<br />
&nbsp; &nbsp; &nbsp; &nbsp; ply:SendLua('language.Add(&quot;Undone_e2_spawned_prop&quot;, &quot;E2 Spawned Prop&quot;)')<br />
end)<br />
<br />
local sbox_E2_maxProps = CreateConVar( &quot;sbox_E2_maxProps&quot;, &quot;-1&quot;, FCVAR_ARCHIVE )<br />
local sbox_E2_maxPropsPerSecond = CreateConVar( &quot;sbox_E2_maxPropsPerSecond&quot;, &quot;4&quot;, FCVAR_ARCHIVE )<br />
local sbox_E2_PropCore = CreateConVar( &quot;sbox_E2_PropCore&quot;, &quot;2&quot;, FCVAR_ARCHIVE )<br />
<br />
local E2Helper = { Descriptions = {} }<br />
local E2totalspawnedprops = 0<br />
local E2tempSpawnedProps = {}<br />
<br />
<br />
local function ValidSpawn(ent)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if E2tempSpawnedProps[ent] &gt;= sbox_E2_maxPropsPerSecond:GetInt() then return false end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if sbox_E2_maxProps:GetInt() &lt;= -1 then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true<br />
&nbsp; &nbsp; &nbsp; &nbsp; elseif E2totalspawnedprops&gt;=sbox_E2_maxProps:GetInt() then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false<br />
&nbsp; &nbsp; &nbsp; &nbsp; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return true<br />
end<br />
<br />
local function ValidAction(ply)<br />
&nbsp; &nbsp; &nbsp; &nbsp; return sbox_E2_PropCore:GetInt()==2 or (sbox_E2_PropCore:GetInt()==1 and ply:IsAdmin())<br />
end<br />
<br />
local function MakePropNoEffect(...)<br />
&nbsp; &nbsp; &nbsp; &nbsp; local backup = DoPropSpawnedEffect<br />
&nbsp; &nbsp; &nbsp; &nbsp; DoPropSpawnedEffect = function() end<br />
&nbsp; &nbsp; &nbsp; &nbsp; local ret = MakeProp(...)<br />
&nbsp; &nbsp; &nbsp; &nbsp; DoPropSpawnedEffect = backup<br />
&nbsp; &nbsp; &nbsp; &nbsp; return ret<br />
end<br />
<br />
local function createpropsfromE2(self,model,pos,angles,freeze,owner)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if E2tempSpawnedProps[owner] == nil then E2tempSpawnedProps[owner] = 0 end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if E2tempSpawnedProps[owner] &lt;= sbox_E2_maxPropsPerSecond:GetInt() then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(!util.IsValidModel(model) || !util.IsValidProp(model) || not ValidSpawn(owner) )then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return nil<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local prop<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if self.data.propSpawnEffect then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prop = MakeProp( self.player, pos, angles, model, {}, {} )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prop = MakePropNoEffect( self.player, pos, angles, model, {}, {} )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not prop then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prop:Activate()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.player:AddCleanup( &quot;props&quot;, prop )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undo.Create(&quot;e2_spawned_prop&quot;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undo.AddEntity( prop )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undo.SetPlayer( self.player )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; undo.Finish()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local phys = prop:GetPhysicsObject()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (phys:IsValid()) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; phys:Wake()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(freeze&gt;0)then phys:EnableMotion( false ) end<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prop.OnDieFunctions.GetCountUpdate.Function2 = prop.OnDieFunctions.GetCountUpdate.Function<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prop.OnDieFunctions.GetCountUpdate.Function =&nbsp; function(self,player,class)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if CLIENT then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; E2totalspawnedprops=E2totalspawnedprops-1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.OnDieFunctions.GetCountUpdate.Function2(self,player,class)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; E2totalspawnedprops = E2totalspawnedprops+1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; E2tempSpawnedProps[owner] = E2tempSpawnedProps[owner]+1<br />
&nbsp; &nbsp; &nbsp; &nbsp; local timerName = &quot;propCore&quot; ..owner<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(timer.IsTimer(timerName) == false) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.Create(timerName, 1, 0, function()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer.Destroy(timerName)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; E2tempSpawnedProps[owner] = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end)<br />
&nbsp; &nbsp; &nbsp; &nbsp; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return prop<br />
&nbsp; &nbsp; &nbsp; &nbsp; else return nil end<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
e2function entity propSpawn(string model, number frozen)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return createpropsfromE2(self,model,self.entity:GetPos()+self.entity:GetUp()*25,self.entity:GetAngles(),frozen,self.player:EntIndex())<br />
end<br />
<br />
e2function entity propSpawn(entity template, number frozen)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not validEntity(template) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return createpropsfromE2(self,template:GetModel(),self.entity:GetPos()+self.entity:GetUp()*25,self.entity:GetAngles(),frozen,self.player:EntIndex())<br />
end<br />
<br />
e2function entity propSpawn(string model, vector pos, number frozen)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return createpropsfromE2(self,model,Vector(pos[1],pos[2],pos[3]),self.entity:GetAngles(),frozen,self.player:EntIndex())<br />
end<br />
<br />
e2function entity propSpawn(entity template, vector pos, number frozen)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not validEntity(template) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return createpropsfromE2(self,template:GetModel(),Vector(pos[1],pos[2],pos[3]),self.entity:GetAngles(),frozen,self.player:EntIndex())<br />
end<br />
<br />
e2function entity propSpawn(string model, angle rot, number frozen)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return createpropsfromE2(self,model,self.entity:GetPos()+self.entity:GetUp()*25,Angle(rot[1],rot[2],rot[3]),frozen,self.player:EntIndex())<br />
end<br />
<br />
e2function entity propSpawn(entity template, angle rot, number frozen)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not validEntity(template) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return createpropsfromE2(self,template:GetModel(),self.entity:GetPos()+self.entity:GetUp()*25,Angle(rot[1],rot[2],rot[3]),frozen,self.player:EntIndex())<br />
end<br />
<br />
e2function entity propSpawn(string model, vector pos, angle rot, number frozen)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return createpropsfromE2(self,model,Vector(pos[1],pos[2],pos[3]),Angle(rot[1],rot[2],rot[3]),frozen,self.player:EntIndex())<br />
end<br />
<br />
e2function entity propSpawn(entity template, vector pos, angle rot, number frozen)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not validEntity(template) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return createpropsfromE2(self,template:GetModel(),Vector(pos[1],pos[2],pos[3]),Angle(rot[1],rot[2],rot[3]),frozen,self.player)<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
e2function void entity:propDelete()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not validEntity(this) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!isOwner(self, this)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if this:IsPlayer() then return end&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; this:Remove()<br />
end<br />
<br />
e2function number table:propDelete()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return 0 end<br />
&nbsp; &nbsp; &nbsp; &nbsp; local count = 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; for _,ent in pairs(this) do<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if validEntity(ent) and isOwner(self, ent) and not ent:IsPlayer() then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count = count+1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ent:Remove()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return count<br />
end<br />
<br />
e2function number array:propDelete() = e2function number table:propDelete()<br />
<br />
--------------------------------------------------------------------------------<br />
e2function void entity:propFreeze(number freeze)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!validPhysics(this)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!isOwner(self, this)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!this:IsWorld()) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local phys = this:GetPhysicsObject()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; phys:EnableMotion(freeze == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; end<br />
end<br />
<br />
e2function void entity:propNotSolid(number notsolid)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not validEntity(this) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!isOwner(self, this)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!this:IsWorld()) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this:SetNotSolid(notsolid ~= 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; end<br />
end<br />
<br />
e2function void entity:propGravity(number gravity)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!validPhysics(this)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!isOwner(self, this)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!this:IsWorld()) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local phys = this:GetPhysicsObject()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; phys:EnableGravity(gravity~=0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; end<br />
end<br />
<br />
--------------------------------------------------------------------------------<br />
<br />
e2function void entity:setPos(vector pos)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!validPhysics(this)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!isOwner(self, this)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; local phys = this:GetPhysicsObject()<br />
&nbsp; &nbsp; &nbsp; &nbsp; phys:SetPos(Vector(pos[1],pos[2],pos[3]))<br />
&nbsp; &nbsp; &nbsp; &nbsp; phys:Wake()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!phys:IsMoveable())then<br />
&nbsp; &nbsp; &nbsp; &nbsp; phys:EnableMotion(true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; phys:EnableMotion(false)<br />
&nbsp; &nbsp; &nbsp; &nbsp; end<br />
end<br />
<br />
e2function void entity:reposition(vector pos) = e2function void entity:setPos(vector pos)<br />
<br />
e2function void entity:setAng(angle rot)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!validPhysics(this)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!isOwner(self, this)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; local phys = this:GetPhysicsObject()<br />
&nbsp; &nbsp; &nbsp; &nbsp; phys:SetAngle(Angle(rot[1],rot[2],rot[3]))<br />
&nbsp; &nbsp; &nbsp; &nbsp; phys:Wake()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!phys:IsMoveable())then<br />
&nbsp; &nbsp; &nbsp; &nbsp; phys:EnableMotion(true)<br />
&nbsp; &nbsp; &nbsp; &nbsp; phys:EnableMotion(false)<br />
&nbsp; &nbsp; &nbsp; &nbsp; end<br />
end<br />
<br />
e2function void entity:rerotate(angle rot) = e2function void entity:setAng(angle rot)<br />
<br />
--------------------------------------------------------------------------------<br />
e2function void entity:parentTo(entity target)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not validEntity(this) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not validEntity(target) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!isOwner(self, this) || !isOwner(self, target)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; this:SetParent(target)<br />
end<br />
<br />
e2function void entity:deparent()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not ValidAction(self.player) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if not validEntity(this) then return nil end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!isOwner(self, this)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; this:SetParent( nil )<br />
end<br />
<br />
e2function void propSpawnEffect(number on)<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.data.propSpawnEffect = on ~= 0<br />
end<br />
<br />
registerCallback(&quot;construct&quot;, function(self)<br />
&nbsp; &nbsp; &nbsp; &nbsp; self.data.propSpawnEffect = true<br />
end)</code><hr />
</div> <!-- google_ad_section_end --></div>

 ]]></content:encoded>
			<category domain="http://www.wiremod.com/forum/wiremod-lua-coding/">Wiremod Lua Coding</category>
			<dc:creator>jacoby6000</dc:creator>
			<guid isPermaLink="true">http://www.wiremod.com/forum/wiremod-lua-coding/22430-propcore-global-spawn-limit.html</guid>
		</item>
		<item>
			<title>where do we put these stuff?</title>
			<link>http://www.wiremod.com/forum/wiremod-lua-coding/22274-where-do-we-put-these-stuff.html</link>
			<pubDate>Sat, 28 Aug 2010 09:45:23 GMT</pubDate>
			<description>Do i place the stuff in wiremod lua coding in my addon folder or lua?</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Do i place the stuff in wiremod lua coding in my addon folder or lua?<!-- google_ad_section_end --></div>

 ]]></content:encoded>
			<category domain="http://www.wiremod.com/forum/wiremod-lua-coding/">Wiremod Lua Coding</category>
			<dc:creator>sadpwner</dc:creator>
			<guid isPermaLink="true">http://www.wiremod.com/forum/wiremod-lua-coding/22274-where-do-we-put-these-stuff.html</guid>
		</item>
		<item>
			<title>Small Increment fix/help</title>
			<link>http://www.wiremod.com/forum/wiremod-lua-coding/22226-small-increment-fix-help.html</link>
			<pubDate>Wed, 25 Aug 2010 07:10:12 GMT</pubDate>
			<description><![CDATA[I'm trying to make an increment button that will have a clk and increment an inputted variable by another user defined variable. 
 
If anyone can...]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->I'm trying to make an increment button that will have a clk and increment an inputted variable by another user defined variable.<br />
<br />
If anyone can help me with my crappy gate code (I've never used LUA before and i know this is VERY incorrect) or can help me make a gate system to do this, I'd appreciate that very much.<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">GateActions[&quot;increment&quot;] = {<br />
&nbsp; &nbsp; &nbsp; &nbsp; group = &quot;Arithmetic&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; name = &quot;Increment&quot;,<br />
&nbsp; &nbsp; &nbsp; &nbsp; inputs = { &quot;A&quot;, &quot;B&quot;, &quot;Clk&quot;},<br />
&nbsp; &nbsp; &nbsp; &nbsp; output = function(gate, A)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; local clk = ( Clk &gt; 0 )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( clk ) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A = B + A<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return A<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; end,<br />
&nbsp; &nbsp; &nbsp; &nbsp; label = function(Out, A)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return &quot;A += &quot; .. B .. &quot; = &quot; .. Out<br />
&nbsp; &nbsp; &nbsp; &nbsp; end<br />
}</code><hr />
</div> <br />
<br />
Sorry if this is in the wrong thread, I'm new to the site<br />
PS: this is not E2<!-- google_ad_section_end --></div>

 ]]></content:encoded>
			<category domain="http://www.wiremod.com/forum/wiremod-lua-coding/">Wiremod Lua Coding</category>
			<dc:creator>Karroon</dc:creator>
			<guid isPermaLink="true">http://www.wiremod.com/forum/wiremod-lua-coding/22226-small-increment-fix-help.html</guid>
		</item>
		<item>
			<title><![CDATA[[E2 Extinsion] cl_info]]></title>
			<link>http://www.wiremod.com/forum/wiremod-lua-coding/22022-e2-extinsion-cl_info.html</link>
			<pubDate>Sun, 15 Aug 2010 14:25:59 GMT</pubDate>
			<description><![CDATA[Here's a few functions to find stuff like the players xfire, email, website ect... if you have those's variables set, players can read them now....]]></description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Here's a few functions to find stuff like the players xfire, email, website ect... if you have those's variables set, players can read them now.<br />
getXfire() returns players xfire name<br />
getEmail() returns players email account<br />
getAIM() instant messenger<br />
getMSN() microsoft nets<br />
getGtalk() Gtalk<br />
ect...<br />
You can set these variables with cl_xfire, cl_email, cl_aim, ect...<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">/******************************************************************************/<br />
e2function string entity:getXfire()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!validEntity(this)) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!this:IsPlayer()) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return this:GetXFire()<br />
end<br />
<br />
e2function string entity:getEmail()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!validEntity(this)) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!this:IsPlayer()) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return this:GetEmail()<br />
end<br />
<br />
e2function string entity:getAIM()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!validEntity(this)) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!this:IsPlayer()) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return this:GetAIM()<br />
end<br />
<br />
e2function string entity:getMSN()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!validEntity(this)) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!this:IsPlayer()) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return this:GetMSN()<br />
end<br />
<br />
e2function string entity:getGtalk()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!validEntity(this)) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!this:IsPlayer()) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return this:GetGTalk()<br />
end<br />
<br />
e2function string entity:getWebsite()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!validEntity(this)) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!this:IsPlayer()) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return this:GetWebsite()<br />
end<br />
<br />
e2function string entity:getLocation()<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!validEntity(this)) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!this:IsPlayer()) then return &quot;&quot; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; return this:GetLocation()<br />
end<br />
/******************************************************************************/</code><hr />
</div> Posting to see if these would be useful to anyone besides myself, or just so you can add them to your custom e2 extensions.<!-- google_ad_section_end --></div>

 ]]></content:encoded>
			<category domain="http://www.wiremod.com/forum/wiremod-lua-coding/">Wiremod Lua Coding</category>
			<dc:creator>freeman</dc:creator>
			<guid isPermaLink="true">http://www.wiremod.com/forum/wiremod-lua-coding/22022-e2-extinsion-cl_info.html</guid>
		</item>
		<item>
			<title>E:setpos(V) and E:chatPrint(N) restrict, need help.</title>
			<link>http://www.wiremod.com/forum/wiremod-lua-coding/21973-e-setpos-v-e-chatprint-n-restrict-need-help.html</link>
			<pubDate>Fri, 13 Aug 2010 02:32:45 GMT</pubDate>
			<description>Hello Could you help me please. 
I have tried to make the functions for admin and specific players by SteamId or by ULX groups but every time the...</description>
			<content:encoded><![CDATA[<div><!-- google_ad_section_start -->Hello Could you help me please.<br />
I have tried to make the functions for admin and specific players by SteamId or by ULX groups but every time the player I tried to add got this error<br />
<br />
sv: Expression 2 (Test Teleport): ...gmod_wire_expression2\core\custom\divranse2stuf  f.lua:293: attempt to index global 'ply' (a nil value)<br />
<br />
Here Are The Codes:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">//PRINT TO CHAT VERSION 1<br />
registerFunction(&quot;chatPrint&quot;, &quot;ns&quot;, &quot;&quot;, function(self,args)<br />
&nbsp; &nbsp; local op1, op2 = args[2], args[3]<br />
&nbsp; &nbsp; local rv1, rv2 = op1[1](self,op1), op2[1](self,op2)<br />
&nbsp; &nbsp; if (!self.player:IsAdmin() and self.player != ULib.getUser(&nbsp; &nbsp; daranable,<br />
&nbsp; &nbsp; enable_keywords,<br />
&nbsp; &nbsp; ply&nbsp; &nbsp; )) then return end<br />
&nbsp; &nbsp; local Msg = rv2<br />
&nbsp; &nbsp; local Number = rv1<br />
&nbsp; &nbsp; if (Number == 0) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; Msg = Msg<br />
&nbsp; &nbsp; elseif (Number == 1) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; Msg = &quot;[E2] &quot;..Msg<br />
&nbsp; &nbsp; elseif (Number == 2) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; Msg = &quot;[&quot;.. self.player:GetName() ..&quot;'s E2] &quot;.. Msg<br />
&nbsp; &nbsp; else <br />
&nbsp; &nbsp; self.player:PrintMessage( HUD_PRINTTALK, &quot;You can only use 0, 1 or 2. This message tells you that you entered the wrong number. This cannot be seen by others.&quot; )<br />
&nbsp; &nbsp; return<br />
&nbsp; &nbsp; end<br />
&nbsp; &nbsp; for k,v in pairs ( player.GetAll() ) do<br />
&nbsp; &nbsp; &nbsp; &nbsp; v:PrintMessage( HUD_PRINTTALK, Msg );<br />
&nbsp; &nbsp; end<br />
<br />
end)<br />
//PRINT TO CHAT VERSION 1 END<br />
//PRINT TO CHAT VERSION 2<br />
registerFunction(&quot;chatPrint&quot;, &quot;s&quot;, &quot;&quot;, function(self,args)<br />
&nbsp; &nbsp; local op1 = args[2]<br />
&nbsp; &nbsp; local rv1 = op1[1](self,op1)<br />
&nbsp; &nbsp; if (!self.player:IsAdmin() and ply.steamID()!=&quot;STEAM_0:1:148*****&quot;) then return end<br />
&nbsp; &nbsp; local Msg = rv1<br />
&nbsp; &nbsp; for k,v in pairs ( player.GetAll() ) do<br />
&nbsp; &nbsp; &nbsp; &nbsp; v:PrintMessage( HUD_PRINTTALK, Msg );<br />
&nbsp; &nbsp; end<br />
<br />
end)<br />
//PRINT TO CHAT VERSION 2 END<br />
//PRINT TO CHAT VERSION 3<br />
registerFunction(&quot;chatPrint&quot;, &quot;e:s&quot;, &quot;&quot;, function(self,args)<br />
&nbsp; &nbsp; local op1, op2 = args[2], args[3]<br />
&nbsp; &nbsp; local rv1, rv2 = op1[1](self,op1), op2[1](self,op2)<br />
&nbsp; &nbsp; if (!self.player:IsAdmin() and ply.steamID()!=&quot;STEAM_0:1:148*****&quot;) then return end<br />
&nbsp; &nbsp; if (!validEntity(rv1)) then return end<br />
&nbsp; &nbsp; &nbsp; &nbsp; rv1:PrintMessage( HUD_PRINTTALK, rv2 );<br />
end)<br />
//PRINT TO CHAT VERSION 3 END<br />
//PRINT TO CHAT VERSION 4<br />
registerFunction(&quot;chatPrint&quot;, &quot;e:ns&quot;, &quot;&quot;, function(self,args)<br />
&nbsp; &nbsp; local op1, op2, op3 = args[2], args[3], args[4]<br />
&nbsp; &nbsp; local rv1, rv2, rv3 = op1[1](self,op1), op2[1](self,op2), op3[1](self,op3)<br />
&nbsp; &nbsp; if (!self.player:IsAdmin() and ply.steamID()!=&quot;STEAM_0:1:148*****&quot;) then return end<br />
&nbsp; &nbsp; if (!validEntity(rv1)) then return end<br />
&nbsp; &nbsp; local Number = rv2<br />
&nbsp; &nbsp; local Msg = rv3<br />
&nbsp; &nbsp; if (Number == 0) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; Msg = Msg<br />
&nbsp; &nbsp; elseif (Number == 1) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; Msg = &quot;[E2] &quot;..Msg<br />
&nbsp; &nbsp; elseif (Number == 2) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; Msg = &quot;[&quot;.. self.player:GetName() ..&quot;'s E2] &quot;.. Msg<br />
&nbsp; &nbsp; else <br />
&nbsp; &nbsp; self.player:PrintMessage( HUD_PRINTTALK, &quot;You can only use 0, 1 or 2. This message tells you that you entered the wrong number. This message cannot be seen by others.&quot; )<br />
&nbsp; &nbsp; return<br />
&nbsp; &nbsp; end<br />
&nbsp; &nbsp; &nbsp; &nbsp; rv1:PrintMessage( HUD_PRINTTALK, Msg );<br />
end)<br />
//PRINT TO CHAT VERSION 4 END</code><hr />
</div> <div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">//Teleport<br />
registerFunction(&quot;setPos&quot;, &quot;e:v&quot;, &quot;&quot;, function(self,args)<br />
&nbsp; &nbsp; local op1, op2 = args[2], args[3]<br />
&nbsp; &nbsp; local rv1, rv2 = op1[1](self, op1), op2[1](self, op2)<br />
&nbsp; &nbsp; local Pos = Vector( rv2[1], rv2[2], rv2[3] )<br />
&nbsp; &nbsp; if (!validEntity(rv1)) then return end<br />
&nbsp; &nbsp; if (!self.player:IsAdmin()) then<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (rv1:IsPlayer() and ply.steamID()!=&quot;STEAM_0:1:148*****&quot; or !isOwner(self,rv1)) then return end<br />
&nbsp; &nbsp; end<br />
&nbsp; &nbsp; if (!util.IsInWorld(Pos)) then return end<br />
&nbsp; &nbsp; rv1:SetPos( Pos )<br />
end)<br />
//Teleport</code><hr />
</div> <!-- google_ad_section_end --></div>

 ]]></content:encoded>
			<category domain="http://www.wiremod.com/forum/wiremod-lua-coding/">Wiremod Lua Coding</category>
			<dc:creator>sadow200</dc:creator>
			<guid isPermaLink="true">http://www.wiremod.com/forum/wiremod-lua-coding/21973-e-setpos-v-e-chatprint-n-restrict-need-help.html</guid>
		</item>
	</channel>
</rss>
