Forum

> > CS2D > Scripts > Hunger,Thirst/Inventory Script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Hunger,Thirst/Inventory Script

12 replies
To the start Previous 1 Next To the start

old Hunger,Thirst/Inventory Script

S T A L K E R
User Off Offline

Quote
Can someone make a Hunger,Thirst/Inventory Script without additional scripts, only this one.

> Much appreciated if someone makes it

∗ It needs to look like window that is inventory,and food needs to be in it.

old Re: Hunger,Thirst/Inventory Script

Mora
User Off Offline

Quote
@user THEMUD: it's @user Xirot: rights, yours comments is s**t useless, does any understand his words, he just want for Hunger, Thirst/Inventory script... WIth the hud you can easy do it[and other array functions, functions of show it]
Look at it, if my words didn't proves that:

old Heres the destiny!

Ajmin
User Off Offline

Quote
Here You Go:
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
function iArray(m,v)
     local array = {}
     for i = 1, m do
          array[i]=v
     end
     return array
end



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

Array = {	
burger = 0,
sandwich =0,
hotdogs = 0,
beef =0,
}

hung = iArray(32,Array)
_hunger_count=initArray(32)
_player_hunger=initArray(32)
_money = initArray(32)



function hudtxt3(id, txtid, text, colour, x, y, align)
	parse("hudtxt2 " .. id .. " " .. txtid .. " \"©" .. tostring(colour) .. text .. "\" " .. x .. " " .. y .. " " .. align)
end



addhook('join','joiner')
function joiner(id)
_money[id]=10000
hung.burger=0
hung.sandwich=0
hung.hotdogs=0
hung.beef=0
end
addhook('ms100','mss')
function mss()
for id=1,32 do
 hudtxt3(id,23,"Hunger & Thirst : ".._player_hunger[id].."", '255100000', 553,363,2)
           hudtxt3(id,24, "%", '255100000', 554,363,0)
if _player_hunger[id]<0 then
_player_hunger[id]=0
end
end
end


addhook("second","_hunger")
function _hunger()
	for _, id in pairs(player(0,"table")) do
		if player(id,"health") ~= 0 then
			_hunger_count[id] = _hunger_count[id]+1
			if _hunger_count[id] >= 23 then
				_hunger_count[id] = _hunger_count[id]-23
				_player_hunger[id] = _player_hunger[id]+2
			end
			
			if _player_hunger[id] >= 100 then
				parse("sv_sound2 "..id.." \"player/hit"..math.random(1,3)..".wav\"")
				parse("sethealth ".. id .." "..(player(id,"health") - 10))
			end
		end
	end
end

addhook("die","_hospital")
function _hospital(id)
	if _player_hunger[id] >= 75 then
		_player_hunger[id] = 75
	elseif _player_hunger[id] >= 50 then
		_player_hunger[id] = 50
	end
	return 1
end


addhook('menu','menus')
function menus(id,t,b)
if t == "Buy Food" then
if b==1 then
if _money[id]>100 then
if hung[id].beef==0 then
hung[id].beef=1
_money[id]=_money[id]-100
else
msg2(id,"You already have this food!")
end
else
msg2(id,"Not Enough Money!")
end

elseif b==2 then
if _money[id]>200 then
if hung[id].burger==0 then
hung[id].burger=1
_money[id]=_money[id]-200
else
msg2(id,"You already have this food!")
end
else
msg2(id,"Not Enough Money!")
end
elseif b==3 then
if _money[id]>300 then
if hung[id].sandwich==0 then
hung[id].sandwich=1
_money[id]=_money[id]-300
else
msg2(id,"You already have this food!")
end
else
msg2(id,"Not Enough Money!")
end
elseif b==4 then
if _money[id]>400 then
if hung[id].hotdogs==0 then
hung[id].hotdogs=1
_money[id]=_money[id]-400
else
msg2(id,"You already have this food!")
end
else
msg2(id,"Not Enough Money!")
end
end
elseif t == "Inventory" then
if b == 1 then
if hung[id].beef==1 then
msg(""..player(id,"name").." eats beef!")
_player_hunger[id] = _player_hunger[id]-10
hung[id].beef=0
else
msg("You dont have Beef!")
end
elseif b == 2 then
if hung[id].burger==1 then
msg(""..player(id,"name").." eats burger!")
_player_hunger[id] = _player_hunger[id]-30
hung[id].burger=0
else
msg("You dont have Burger!")
end
elseif b == 3 then
if hung[id].sandwich==1 then
msg(""..player(id,"name").." eats sandwich!")
_player_hunger[id] = _player_hunger[id]-40
hung[id].sandwich=0
else
msg("You dont have Sandwich!")
end
elseif b ==4 then
if hung[id].hotdogs==1 then
msg(""..player(id,"name").." eats hotdog!")
_player_hunger[id] = _player_hunger[id]-40
hung[id].hotdogs=0
else
msg("You dont have Hotdog!")
end
end
end
end

 addhook('serveraction','servers')
function servers(id,a)
if a==1 then
menu(id,"Buy Food,Beef,Burger,Sandwich,Hotdog")
elseif a==2 then
if hung[id].beef==1 or hung[id].burger==1 or hung[id].sandwich==1 or hung[id].hotdogs==1 then
menu(id,"Inventory,Beef|"..hung[id].beef..",Burger|"..hung[id].burger..",Sandwich|"..hung[id].sandwich..",Hotdog|"..hung[id].hotdogs.."")
else
menu(id,"Error@b,Food Storage is Empty!")
end
end
end

old Re: Hunger,Thirst/Inventory Script

Xirot
User Off Offline

Quote
Quote
I dont know how to script,but i know how to make maps

If you're interrested in this game, learn scripting so you'll need no one to help you and you can do your works by yourself.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview