Forum

> > CS2D > Scripts > Hats Menu Bug
Forums overviewCS2D overview Scripts overviewLog in to reply

English Hats Menu Bug

16 replies
To the start Previous 1 Next To the start

old Hats Menu Bug

DarkZBrine
User Off Offline

Quote
Hi Guys i made an hats mod lua for cs2d and it's works
fine but when i choose one hat the gfx won't load i check everything in the file looks fine look

More >

old Re: Hats Menu Bug

RedizGaming
GAME BANNED Off Offline

Quote
@user DarkZBrine:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
addhook("serveraction","hat1")
function hat1(id,b)
     if player(id,"team")==2 then
          if b==3 then
               menu(id,"Hats,Crate,HeadCrab,Light,Steve,Herobrine,Nothing")
          end
     end
end

-- Menu
addhook("menu","hat2")
function hat2(id,t,b)
     if t=="Hats" then
           if b == 1 then
                image("gfx/Hats/crate.png",1,1,200+id)
           elseif b == 2 then
                image("gfx/Hats/headcrab.png",1,1,200+id)
           elseif b == 3 then
                freeimage(id)
                image("gfx/Hats/light.png",1,1,200+id)
           elseif b == 4 then
                image("gfx/Hats/steve.png",1,1,200+id)
           elseif b == 5 then
                image("gfx/Hats/herobrine.png",1,1,200+id)
           elseif b == 6 then
                freeimage(id)
           end
     end 
end

-- Info Msg
addhook("minute","hat3")
function hats3()
     msg("== Hats Mod ==")
     msg("Author: DarkZBrine")
     msg("Lua: DarkZBrine")
     msg("Press F4 To Choose Hats")
     msg("==============")
end

old Re: Hats Menu Bug

RedizGaming
GAME BANNED Off Offline

Quote
@user DarkZBrine:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
addhook("serveraction","hat1")
addhook("menu","hat2")
addhook("minute","hat3")

function hat1(id,act,team)
	if act == 3 then
		if player(id,'team') == 2 then
			menu(id,'Hats,Crate,HeadCrab,Light,Steve,Herobrine,Nothing')
		end
	end
end

function hat2(id,title,b)
	if title == "Hats" then
		if b == 1 then
			freeimage(id)
			id=image("gfx/Hats/crate.png",1,1,200+id)
		end
		if b == 2 then
			freeimage(id)
			id=image("gfx/Hats/headcrab.png",1,1,200+id)
		end
		if b == 3 then
			freeimage(id)
			id=image("gfx/Hats/light.png",1,1,200+id)
		end
		if b == 4 then
			freeimage(id)
			id=image("gfx/Hats/steve.png",1,1,200+id)
		end
		if b == 5 then
			freeimage(id)
			id=image("gfx/Hats/herobrine.png",1,1,200+id)
		end
		if b == 6 then
			freeimage(id)
		end
	end
end

function hat3()
	msg("©000097000== Hats Mod ==")
	msg("©000097000Author: DarkZBrine")
	msg("©000097000Lua: DarkZBrine")
	msg("©000097000Press F4 To Choose Hats")
	msg("©000097000==============")
end

old doesn't work too

DarkZBrine
User Off Offline

Quote
@user RedizGaming:

√ Crate
> But The Others When I select other slot it disapeard
i mean like i have deagle when i choose another gun or knife
the hat gone!
edited 1×, last 16.10.14 05:09:50 pm

old Re: Hats Menu Bug

DC
Admin Off Offline

Quote
Post your full script then, user DarkZBrine. There must be more otherwise it's not possible that this happens.

old Reply

DarkZBrine
User Off Offline

Quote
Heres My Full Script DC Can You FIx It?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
addhook("serveraction","hat1")
addhook("menu","hat2")
addhook("minute","hat3")

function hat1(id,act,team)
     if act == 3 then
          if player(id,'team') == 2 then
               menu(id,'Hats,Crate,HeadCrab,Light,Steve,Herobrine,Nothing')
          end
     end
end

function hat2(id,title,b)
     if title == "Hats" then
          if b == 1 then
               freeimage(id)
               id=image("gfx/Hats/crate.png",1,1,200+id)
          end
          if b == 2 then
               freeimage(id)
               id=image("gfx/Hats/headcrab.png",1,1,200+id)
          end
          if b == 3 then
               freeimage(id)
               id=image("gfx/Hats/light.png",1,1,200+id)
          end
          if b == 4 then
               freeimage(id)
               id=image("gfx/Hats/steve.png",1,1,200+id)
          end
          if b == 5 then
               freeimage(id)
               id=image("gfx/Hats/herobrine.png",1,1,200+id)
          end
          if b == 6 then
               freeimage(id)
          end
     end
end

function hat3()
     msg("©000097000== Hats Mod ==")
     msg("©000097000Author: DarkZBrine")
     msg("©000097000Lua: DarkZBrine")
     msg("©000097000Press F4 To Choose Hats")
     msg("©000097000==============")
end

old Re: Hats Menu Bug

TopNotch
User Off Offline

Quote
You can't run freeimage(id) when no image has been loaded yet.
There are many hat scripts in the File Archive, why don't you use one of them?
EDIT: Your code fixed:
Spoiler >

Didn't test, should work.
edited 1×, last 17.10.14 09:22:10 am

old Re: Hats Menu Bug

TopNotch
User Off Offline

Quote
Edited the code, I forget to add "checkHat(id) on every button. Should work properly now.

old Re: Hats Menu Bug

DarkZBrine
User Off Offline

Quote
topnotch thew checkhat function what is the addhook of that is addhook("menu","checkHat")?

old Re: Hats Menu Bug

DarkZBrine
User Off Offline

Quote
but still the disame the last hat still stays when i choose a new hat
edited 1×, last 17.10.14 09:53:13 am

old Re: Hats Menu Bug

TopNotch
User Off Offline

Quote
Tested it myself, and it worked. Are you sure you copied the last version of my script (edited today)?

old Re: Hats Menu Bug

DarkZBrine
User Off Offline

Quote
Tnx Top Notch But How Do I activate in Terrorist i find a way to the script and gives me errors so i go back to the old script only works for ct i was hope to fix it for terrorist too but i can't sorry
edited 2×, last 17.10.14 05:20:34 pm

old Re: Hats Menu Bug

TopNotch
User Off Offline

Quote
Just remove:
1
if player(id,'team') == 2 then
and it's "end" statement.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview