Forum

> > CS2D > Scripts > server.lua ingame light
Forums overviewCS2D overview Scripts overviewLog in to reply

English server.lua ingame light

3 replies
To the start Previous 1 Next To the start

old server.lua ingame light

king923
User Off Offline

Quote
my server got very dark and i allmost can't see my player
i will be glad if someone can tell me what can i change here

function p.RemoveVision()
          if p.VisionImage then
               freeimage(p.VisionImage)
               p.VisionImage = nul
          end
     end

     function p.UpdateVision()
          p.RemoveVision()

          if player(id,"exists") then
               p.VisionImage = image("gfx/sprites/block.bmp",0,1,2,id)
               imagepos(p.VisionImage,320,240,0)
               imagescale(p.VisionImage,20,15)

               imagecolor(p.VisionImage,p.VisionColor())
               imagealpha(p.VisionImage,p.VisionAlpha())
          end
     end

old Re: server.lua ingame light

Blunt
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function p.RemoveVision()
          if p.VisionImage then
               freeimage(p.VisionImage)
               p.VisionImage = nul
          end
     end

     function p.UpdateVision()
          p.RemoveVision()

          if player(id,"exists") then
               p.VisionImage = image("gfx/sprites/block.bmp",0,1,2,id)
               imagepos(p.VisionImage,320,240,0)
               imagescale(p.VisionImage,20,15)

               imagecolor(p.VisionImage,p.VisionColor())
               imagealpha(p.VisionImage,p.VisionAlpha())
          end
     end

use the code

old Re: server.lua ingame light

king923
User Off Offline

Quote
thnx for wasting time with my problem but still not working the screen is dark and i can barely see my player and im sure the problem is because of the vision function can you have a look again?

     function p.VisionColor()
          if player(id,"team") == 1 or p.NightVision then
               return 0, 100, 0
          elseif player(id,"team") == 2 or player(id,"team") == 0 then
               return 0, 0, 0
          end
     end

     function p.VisionAlpha()
          if player(id,"team") == 1 or p.NightVision then
               return 0.5
          elseif player(id,"team") == 2 or player(id,"team") == 0 then
               return 0.85
          end
     end

     function p.RemoveVision()
          if p.VisionImage then
               freeimage(p.VisionImage)
               p.VisionImage = nil
          end
     end

     function p.UpdateVision()
          p.RemoveVision()

          if player(id,"exists") then
               p.VisionImage = image("gfx/sprites/block.bmp",0,1,2,id)
               imagepos(p.VisionImage,320,240,0)
               imagescale(p.VisionImage,20,15)

               imagecolor(p.VisionImage,p.VisionColor())
               imagealpha(p.VisionImage,p.VisionAlpha())
          end
     end
edited 1×, last 17.07.12 09:14:26 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview