Forum

> > CS2D > Scripts > Problem with lua flash light
Forums overviewCS2D overview Scripts overviewLog in to reply

English Problem with lua flash light

3 replies
To the start Previous 1 Next To the start

old Problem with lua flash light

Lotteria
User Off Offline

Quote
-- Flashlight by wUps
--
-- bind key "say light"
--

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","lightz")
function lightz(p,t)

     if (t == "!light") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/light.bmp",1,1,200+p)
               imageblend(light[p],1)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],0.7)
               parse("sv_sound \"fun/lighton.wav\"")
          end
          return 1
     end
end


function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","laser")
function laser(p,t)

     if (t == "!laser") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/lasersight.bmp",1,1,200+p)
               imageblend(light[p],1)
               imagecolor(light[p],200,200,100)
               imagealpha(light[p],0.7)
               parse("sv_sound \"fun/laseron.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","flash")
function flash(p,t)

     if (t == "!glow") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/glight.bmp",1,1,100+p)
               imageblend(light[p],1)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],0.7)
               parse("sv_sound \"doors/clickon.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","gun")
function gun(p,t)

     if (t == "!minigun ") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/minigun.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","phihung940")
function phihung940(p,t)

     if (t == "!P ") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/phihung940.bmp",0,1,200+p)
               imageblend(light[p],1)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"doors/clickon.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","bag")
function bag(p,t)

     if (t == "!bag") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/Bag.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","wing")
function wing(p,t)

     if (t == "!wing") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/wing.bmp",1,1,100+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

addhook("say","wing2")
function wing2(p,t)

     if (t == "!wing2") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/wing2.bmp",1,1,100+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","bag1")
function bag1(p,t)

     if (t == "!sniperbag") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/Bag1.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","bag2")
function bag2(p,t)

     if (t == "!tankbag") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/Bag2.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","bag3")
function bag3(p,t)

     if (t == "!packbag") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/Bag3.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","bag4")
function bag4(p,t)

     if (t == "!smgbag") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/Bag4.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","bag5")
function bag5(p,t)

     if (t == "!radiobag") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/Bag5.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","bag6")
function bag6(p,t)

     if (t == "!warbag") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/Bag6.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","bag7")
function bag7(p,t)

     if (t == "!medicbag") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/Bag7.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","bag8")
function bag8(p,t)

     if (t == "!greenbag") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/Bag8.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","bag9")
function bag9(p,t)

     if (t == "!flamebag") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/Bag9.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","bag10")
function bag10(p,t)

     if (t == "!ktnbag") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/Bag10.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","hat")
function hat(p,t)

     if (t == "!non") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/helmet.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","hat1")
function hat1(p,t)

     if (t == "!non1") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/phoenix.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","hat2")
function hat2(p,t)

     if (t == "!non2") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/pot.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","jakets")
function jakets(p,t)

     if (t == "!spike") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/spikes.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","hat3")
function hat3(p,t)

     if (t == "!non3") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/tyrans.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end

function initArray(m)
     local array = {}
     for i = 1, m
     do array[i]=0
     end
          return array
end


light=initArray(32)
light01=initArray(32)

addhook("say","hat4")
function hat4(p,t)

     if (t == "!non4") then
          if (light01[p] == 1) then
               light01[p]=0
               freeimage(light[p])
          else
               light01[p]=1
               light[p]=image("gfx/sprites/wing5.bmp",1,1,200+p)
               imageblend(light[p],0)
               imagecolor(light[p],255,255,255)
               imagealpha(light[p],1.0)
               parse("sv_sound \"items/kevlar.wav\"")
          end
          return 1
     end
end




I say bind k "say light" but its doesnt work

old Re: Problem with lua flash light

EngiN33R
Moderator Off Offline

Quote
Lotteria has written
if (t == "!light") then
if (light01[p] == 1) then
light01[p]=0
freeimage(light[p])
else
light01[p]=1
light[p]=image("gfx/sprites/light.bmp",1,1,200+p)
imageblend(light[p],1)
imagecolor(light[p],255,255,255)
imagealpha(light[p],0.7)
parse("sv_sound \"fun/lighton.wav\"")
end
return 1
end
end

Lotteria has written
if (t == "!light") then

You need to bind "say !light", not "say light".

And put that god damn script in a spoiler for God's sake.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview