Forum

> > CS2D > Scripts > triggerentity triggering multiple times
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch triggerentity triggering multiple times

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt triggerentity triggering multiple times

Blighted Song
User Off Offline

Zitieren
Im haveing a problem with my trigger entity hook, whenever it goes off it happens 10 times and I'm really not sure why.

Heres the repeated code
1
2
3
4
5
6
7
8
9
10
11
12
addhook("triggerentity","actions")
function actions(x,y)
	i=0
	var1=entity(x,y,"name")
	var2=string.sub(var1, -3,-1)
	var2=0
	while i<#var1 do
		print(i)
		i=i+1
	end

end
I'm just testing some shit and it started repeating, also the trigger is a trigger_move entity and is only triggering once as far as I can tell. This is also the only point of referance for the actions function.

This is probably just an oversight on my part but i can't work out what it is.

alt Re: triggerentity triggering multiple times

DannyDeth
User Off Offline

Zitieren
'var1' isn't a table, it's a string. lol. It isn't triggering multiple times, the code's just printing the number to 10 because the name is probably 10 chars long. Also, 'i' isn't initalized so it should also be giving an 'attempt to perform arithmetic on nil value' error as well. Also, I'd like to know why you are giving negative values to string.sub?

EDIT: Sorry, my mistake, 'i' is initialized.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht