Forum

> > CS2D > Scripts > Update hud info atk def
Forums overviewCS2D overview Scripts overviewLog in to reply

English Update hud info atk def

26 replies
Page
To the start Previous 1 2 Next To the start

old Re: Update hud info atk def

oxytamine
User Off Offline

Quote
What do you want to do with "attack" and "defense" parameters? Place them on HUD? But what exactly? Please, tell us more.

old Re: Update hud info atk def

Jynxxx
User Off Offline

Quote
And everyone this isn't that hard if you wanted for him to stop posting bullcrap threads then help him!!
1
2
3
4
5
6
function updateYOURCRAP(id)
	hudtxt2(id,21, PLAYERS[id].def, '255255000', 610,452,1)
	hudtxt2(id,23, PLAYERS[id].atk, '255255000', 610,467,1)
	hudtxt2(id,22, "Defence", '255255255', 528,452,1)
	hudtxt2(id,24, "Attack", '255255255', 528,467,1)
end

old Re: Update hud info atk def

EngiN33R
Moderator Off Offline

Quote
user Jynxxx has written
And everyone this isn't that hard if you wanted for him to stop posting bullcrap threads then help him!!


I would gladly do that if I understood what he wants.

old Re: Update hud info atk def

Dimas541
User Off Offline

Quote
1
2
3
4
5
6
7
8
function updateYOURCRAP(id)
     hudtxt2(id,21, PLAYERS[id].def, '255255000', 610,452,1)
     hudtxt2(id,23, PLAYERS[id].atk, '255255000', 610,467,1)
     hudtxt2(id,22, "Defence", '255255255', 528,452,1)
     hudtxt2(id,24, "Attack", '255255255', 528,467,1)
end

Not Working

old Re: Update hud info atk def

Jynxxx
User Off Offline

Quote
@user Dimas541: Sorry I posted that awhile back and didn't know what I was doing
1
2
3
4
5
6
function updateYOURCRAP(id)
     hudtxt2(id,21, PLAYERS[id].tmp.def, '255255000', 610,452,1)
     hudtxt2(id,23, PLAYERS[id].tmp.atk, '255255000', 610,467,1)
     hudtxt2(id,22, "Defence", '255255255', 528,452,1)
     hudtxt2(id,24, "Attack", '255255255', 528,467,1)
end

old Re: Update hud info atk def

Jynxxx
User Off Offline

Quote
Just find this in your functions.lua and replace it with this.
1
2
3
4
5
6
7
8
9
10
function updateHUD(id)
	for i, v in ipairs(CONFIG.STATS) do
		hudtxt2(id, #CONFIG.STATS+i, v, '255255255', 510, 407+(i-1)*CONFIG.PIXELS, 0)
		hudtxt2(id, i, PLAYERS[id][v], '255255000', 620, 407+(i-1)*CONFIG.PIXELS, 2)
		hudtxt2(id,21, PLAYERS[id].tmp.def, '255255000', 610,452,1)
		hudtxt2(id,23, PLAYERS[id].tmp.atk, '255255000', 610,467,1)
		hudtxt2(id,22, "Defence", '255255255', 528,452,1)
		hudtxt2(id,24, "Attack", '255255255', 528,467,1)
	end
end

old Re: Update hud info atk def

Runnin
User Off Offline

Quote
user Jynxxx has written
Just find this in your functions.lua and replace it with this.
1
2
3
4
5
6
7
8
9
10
function updateHUD(id)
	for i, v in ipairs(CONFIG.STATS) do
		hudtxt2(id, #CONFIG.STATS+i, v, '255255255', 510, 407+(i-1)*CONFIG.PIXELS, 0)
		hudtxt2(id, i, PLAYERS[id][v], '255255000', 620, 407+(i-1)*CONFIG.PIXELS, 2)
		hudtxt2(id,21, PLAYERS[id].tmp.def, '255255000', 610,452,1)
		hudtxt2(id,23, PLAYERS[id].tmp.atk, '255255000', 610,467,1)
		hudtxt2(id,22, "Defence", '255255255', 528,452,1)
		hudtxt2(id,24, "Attack", '255255255', 528,467,1)
	end
end


When i use ur code, the atk and def only updates when picking up money or dropping it. And when gaining exp too i think. Fix it please

old Re: Update hud info atk def

EndDead
User Off Offline

Quote
user Runnin has written
When i use ur code, the atk and def only updates when picking up money or dropping it. And when gaining exp too i think. Fix it please

Add 'UpdateHUD(id)' after the equip function, Everything will be fine (Before the 'end' block for sure)

old Re: Update hud info atk def

4Vendetta
User Off Offline

Quote
user Runnin has written
user Jynxxx has written
Just find this in your functions.lua and replace it with this.
1
2
3
4
5
6
7
8
9
10
function updateHUD(id)
	for i, v in ipairs(CONFIG.STATS) do
		hudtxt2(id, #CONFIG.STATS+i, v, '255255255', 510, 407+(i-1)*CONFIG.PIXELS, 0)
		hudtxt2(id, i, PLAYERS[id][v], '255255000', 620, 407+(i-1)*CONFIG.PIXELS, 2)
		hudtxt2(id,21, PLAYERS[id].tmp.def, '255255000', 610,452,1)
		hudtxt2(id,23, PLAYERS[id].tmp.atk, '255255000', 610,467,1)
		hudtxt2(id,22, "Defence", '255255255', 528,452,1)
		hudtxt2(id,24, "Attack", '255255255', 528,467,1)
	end
end


When i use ur code, the atk and def only updates when picking up money or dropping it. And when gaining exp too i think. Fix it please


I tested and this works o.o

old Re: Update hud info atk def

Me Gusta
User Off Offline

Quote
send screen shots for me see
thanks all users when help me

those who swore at me calling
me trash talking to banish me
vain if not fuck idiots need your
help _l_

old Re: Update hud info atk def

Dimas541
User Off Offline

Quote
Where I am right this Paste
1
2
3
4
5
6
7
8
9
10
function updateHUD(id)
     for i, v in ipairs(CONFIG.STATS) do
          hudtxt2(id, #CONFIG.STATS+i, v, '255255255', 510, 407+(i-1)*CONFIG.PIXELS, 0)
          hudtxt2(id, i, PLAYERS[id][v], '255255000', 620, 407+(i-1)*CONFIG.PIXELS, 2)
          hudtxt2(id,21, PLAYERS[id].tmp.def, '255255000', 610,452,1)
          hudtxt2(id,23, PLAYERS[id].tmp.atk, '255255000', 610,467,1)
          hudtxt2(id,22, "Defence", '255255255', 528,452,1)
          hudtxt2(id,24, "Attack", '255255255', 528,467,1)
     end
end
Spoiler >

old Re: Update hud info atk def

4Vendetta
User Off Offline

Quote
Nice, but with this, whem you leave the server your stats (atk, def and spd) will not save, because is separated by CONFIG.STATS, Only Exp, Level, money and equips will save, atk, def, and spd not!

old Re: Update hud info atk def

Yates
Reviewer Off Offline

Quote
@user 4Vendetta: This would not matter anyway, as your attack, defence and speed are calculated when you die, pickup/equip a weapon, drop an item etc.
edited 1×, last 25.10.12 02:55:14 pm

old Re: Update hud info atk def

Jynxxx
User Off Offline

Quote
You could always just do this...
1
2
3
4
5
6
addhook("ms100","_ms100")
function _ms100()
	for _, id in ipairs(player(0, "tableliving")) do
		updateHUD(id)
	end
end
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview