Why doesnt this trigger work? (etrigger)

I was using etrigger and made these three triggers with it:

[lua]
eTrigger.Register(“TriggerName”, {
posMin = Vector(-1433.3182373047, 69.03125, -49.215545654297),
posMax = Vector(-1394.1174316406, 132.41421508789, -195.96875),
playerOnly = true,
onEndTouch = function( ent )
if ply:isArrested() then
RunConsoleCommand( "Darkrp Unarrest ", ply )
end
end
})

eTrigger.Register(“TriggerName2”, {
posMin = Vector(-1159.8604736328, 897.23614501953, -94.152847290039),
posMax = Vector(-1294.0794677734, 967.34149169922, -195.96875),
playerOnly = true,
onStartTouch = function( ent )
if (ply:Team() == TEAM_CC) then
ply:GodEnable
end
end
})

eTrigger.Register(“TriggerName3”, {
posMin = Vector(-1295.96875, 959.08038330078, -93.033988952637),
posMax = Vector(-1168.3526611328, 1018.9000854492, -227.96875),
playerOnly = true,
onEndTouch = function( ent )
if (ply:Team() == TEAM_CC) then
ply:GodDisable
end
end
})

[/lua]

When you cross the first coordinates, you should be unarrested, if u were arrested. The second should god you when you cross it and the third should ungod you when you cross it. None of these do anything and i am curious as to why.



eTrigger.Register("TriggerName", {
	posMin = Vector(-1433.3182373047, 69.03125, -49.215545654297),
	posMax = Vector(-1394.1174316406, 132.41421508789, -195.96875),
	playerOnly = true,
	onEndTouch = function( ply )
		if ply:isArrested() then
			RunConsoleCommand( "darkrp",  "unarrest", ply:Nick() )
                       end
		end
})

eTrigger.Register("TriggerName2", {
	posMin = Vector(-1159.8604736328, 897.23614501953, -94.152847290039),
	posMax = Vector(-1294.0794677734, 967.34149169922, -195.96875),
	playerOnly = true,
	onStartTouch = function( ply )
		if (ply:Team() == TEAM_CC) then
			ply:GodEnable()
				end
		end
})

eTrigger.Register("TriggerName3", {
	posMin = Vector(-1295.96875, 959.08038330078, -93.033988952637),
	posMax = Vector(-1168.3526611328, 1018.9000854492, -227.96875),
	playerOnly = true,
	onEndTouch = function( ply )
		if (ply:Team() == TEAM_CC) then
			ply:GodDisable()
			end
	end
})


Basically you were giving the function ent instead of passing it the player

I thought that if u used ent (entity) it would effect the player aswell

[editline]26th March 2016[/editline]

still doesnt work… :stuck_out_tongue:

bump

Should probably read up on what functions and function parameters are…

If you’re using the code iJohnny provided, are you getting any errors?

You had some syntax errors in your code, so I can see why that would error, but iJohnny’s code follows syntax rules, so if that doesn’t work either, and no errors. Then check your positions as you may have logic errors.

1.i know what functions and parameters are, telling you what they are would prove nothing, as i could have easily googled it.

  1. i am getting no errors
  2. no errors. Also, where do u see syntax? I fixed it up a bit and it looks like this:

[lua]
eTrigger.Register(“TriggerName”, {
posMin = Vector(-1430.6812744141, 68.413238525391, -195.96875),
posMax = Vector(-1434.3951416016, 130.41278076172, -48.03125),
playerOnly = true,
touch = function( ply )
if SERVER then
if ply:isArrested() then
ply:unArrest()
end
end
end
})

eTrigger.Register(“TriggerName2”, {
posMin = Vector(-1159.8604736328, 897.23614501953, -94.152847290039),
posMax = Vector(-1294.0794677734, 967.34149169922, -195.96875),
playerOnly = true,
touch = function( ply )
if SERVER then
if (ply:Team() == TEAM_CAVE) then
ply:GodEnable()
PrintMessage( HUD_PRINTTALK, “You can no longer be killed.” )
end
end
end
})

eTrigger.Register(“TriggerName3”, {
posMin = Vector(-1295.96875, 959.08038330078, -93.033988952637),
posMax = Vector(-1168.3526611328, 1018.9000854492, -227.96875),
playerOnly = true,
touch = function( ply )
if SERVER then
if (ply:Team() == TEAM_CAVE) then
ply:GodDisable()
PrintMessage( HUD_PRINTTALK, “You can now be killed.” )
end
end
end
})
[/lua]

[editline]28th March 2016[/editline]

i do not see any syntax errors there

I suggested checking for logic errors since there are no syntax errors. Check your mins and maxs / try debugging some dummy eTriggers / etc