Forum

> > CS2D > Scripts > Set image & Build attempt
Forums overviewCS2D overview Scripts overviewLog in to reply

English Set image & Build attempt

3 replies
To the start Previous 1 Next To the start

old Set image & Build attempt

Ridho
User Off Offline

Quote
hi all cookie

I have 2 question here
• can I set an image to a player, but other player can't see it? (like msg2 in texting) I've searched in file archive but didn't get anything

• what's wrong with my code?
if tbuild is true, I can build turret
but when tbuild is false, I also can build turret
no error in console but, dont know how to fix it
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("buildattempt","turretbuild")
function turretbuild(id,type,tx,ty)
        if tbuild[id]==true then
                if (type~=2) and (type<=14) then
                        if type==7 then
                                return 0
                        end
                end
        end
        if tbuild[id]==false then
                if (type~=2) and (type<=14) then
                        if type==7 then
                                msg2(id,""..color.."255000000You dont have Turret License yet!")
                                return 1
                        end
                end
        end
end

thanks

old Re: Set image & Build attempt

_oops
User Off Offline

Quote
1. Read this
for example
1
2
3
4
5
pl ={}
addhook("spawn","s")
function s(id)
pl[id] = image("gfx/sprites/block.bmp",0,1,id+200,id)
end


2. "type 7" is dispenser.
IMG:https://cs2d.com/img/ref_dynamicobjects.png

old Re: Set image & Build attempt

Ridho
User Off Offline

Quote
@user _oops: thanks, you helped me well

btw for the image, it can be seen only by player, right? and other player can't see it

Admin/mod comment

No need to quote the user above you /user useigor

old Re: Set image & Build attempt

Talented Doge
User Off Offline

Quote
1
2
3
4
5
pl ={}
addhook("spawn","s")
function s(id)
pl[id] = image("gfx/sprites/block.bmp",0,1,id+200,id)
end

I guess, it works like hat, for players, each image is individual. But they will be seen by all players.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview