Forum

> > CS2D > Scripts > My lua not working why?
Forums overviewCS2D overview Scripts overviewLog in to reply

English My lua not working why?

5 replies
To the start Previous 1 Next To the start

old My lua not working why?

deadlox995
User Off Offline

Quote
addhook("spawn","freeimg")
function freeimg(id)
	for id=1,32 do
	if player(id,"team") == 1 then 
		id=image("gfx/Java Gfx/defensiveaura.png",0,0,200+i)	
		imagecolor(id,0,255,255)						
		imageblend(id,1)								
		imagealpha(id,0.5)
	else
	if player(id,"team") == 2 then	
		id=image("gfx/Java Gfx/defensiveaura.png",0,0,200+i)	
		imagecolor(id,255,255,0)						
		imageblend(id,1)								
		imagealpha(id,0.5)
	end
end

old Re: My lua not working why?

Pagyra
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("spawn","freeimg")
function freeimg(id)
     for id=1,32 do
          if player(id,"team") == 1 then 
               id=image("gfx/Java Gfx/defensiveaura.png",0,0,200+i)     
               imagecolor(id,0,255,255)                              
               imageblend(id,1)                                        
               imagealpha(id,0.5)
          elseif player(id,"team") == 2 then     
               id=image("gfx/Java Gfx/defensiveaura.png",0,0,200+i)     
               imagecolor(id,255,255,0)                              
               imageblend(id,1)                                        
               imagealpha(id,0.5)
          end
     end
end

old Re: My lua not working why?

Mora
User Off Offline

Quote
@user deadlox995: because you forgot to add eof (end of function)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("spawn","freeimg")
function freeimg(id)
     for id=1,32 do
     if player(id,"team") == 1 then 
          id=image("gfx/Java Gfx/defensiveaura.png",0,0,200+i)     
          imagecolor(id,0,255,255)                              
          imageblend(id,1)                                        
          imagealpha(id,0.5)
     else
     if player(id,"team") == 2 then     
          id=image("gfx/Java Gfx/defensiveaura.png",0,0,200+i)     
          imagecolor(id,255,255,0)                              
          imageblend(id,1)                                        
          imagealpha(id,0.5)
     end
     end <-----
end

old Re: My lua not working why?

Dousea
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook ("spawn", "freeimg")
function freeimg (id)
	local img = image ("gfx/Java Gfx/defensiveaura.png", 0, 0, (200 + id))
	
	if (player (id, "team") == 1) then
		imagecolor (img, 0, 255, 255)
	elseif (player (id, "team") == 2) then
		imagecolor (img, 255, 255, 0)
	end
	
	imageblend (img, 1)
	imagealpha (img, 0.5)
end

old Re: My lua not working why?

RedizGaming
GAME BANNED Off Offline

Quote
addhook("spawn","freeimg")
function freeimg(id)
     for id=1,32 do
     if player(id,"team") == 1 then
          id=image("gfx/Java Gfx/defensiveaura.png",0,0,200+i)     
          imagecolor(id,0,255,255)                              
          imageblend(id,1)                                        
          imagealpha(id,0.5)
     end
     if player(id,"team") == 2 then     
          id=image("gfx/Java Gfx/defensiveaura.png",0,0,200+i)     
          imagecolor(id,255,255,0)                              
          imageblend(id,1)                                        
          imagealpha(id,0.5)
     end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview