Forum

> > CS2D > General > Equip with knife
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch Equip with knife

14 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Equip with knife

Holloweye
User Off Offline

Zitieren
Impossible to equip a player with a knife when he respawn directly again? because I cant just do it... i tried alot of things. The command i use look like this:
parse("equip "..p.." 50")

Anyone know why it dosent work?

alt Re: Equip with knife

Holloweye
User Off Offline

Zitieren
When a player dies in the game he respawn directly again. With nothing... not even a knife.

I use this command to respawn them:
parse("spawnplayer "..p.." 800 2300")
1× editiert, zuletzt 01.05.09 10:29:10

alt Re: Equip with knife

DC
Admin Off Offline

Zitieren
do you execute the equip cmd after the spawnplayer cmd? if not: try it.

alt Re: Equip with knife

Holloweye
User Off Offline

Zitieren
I have tried it dose not help.

addhook("collect","sample.fast.collect")
function sample.fast.collect(p,iid,type,ain,a,mode)
     if(type==50)then
     else
          parse("strip "..p.." "..type)
     end
end

I have this... but it should not remove the knife...

alt Re: Equip with knife

DC
Admin Off Offline

Zitieren
you talked about EQUIPPING not about STRIPPING!

the collect hook will only be executed when you collect it from the map. not when you get it at roundstart. so this cannot work.

moreover the game will automatically give you a knife when you don't have any other weapon. the game forces you to have at least one weapon. so make sure that the player has another weapon before you strip the knife. otherwise stripping the knife will not have any effect.

alt Re: Equip with knife

Holloweye
User Off Offline

Zitieren
I dont want to strip the knife... I want the players to start with a knife... because the players dont start with anything on the respawn.

The bots start with knife somehow but not the players.
1× editiert, zuletzt 01.05.09 11:58:08

alt Re: Equip with knife

DC
Admin Off Offline

Zitieren
It doesn't make any sense that you are posting Lua scripts which strip the knife then...?!

the game tries to assign knifes as soon as players don't have a weapon anymore - as I stated before.
Your Lua scripts must be seriously wrong if something like this happens or the problem is caused by strange settings or something. I don't know. However this is not normal.

alt Re: Equip with knife

Holloweye
User Off Offline

Zitieren
Short explain of everything:

Start of a round - Everything is normal players have knife and weapons.

When a player dies and respawn - The respawned player start with nothing (Bots start with knifes i dont know why the players dont)

When you collect a item from ground - The item is removed exept knifes.

What i want to fix is that the respawned players start with a knife... but right now the start with nothing... no knife.. no weapons... nothing.


Code looks like this:
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
-----------------------------------------------------
-- Zombe Mod Script by Holloweye                   --
-----------------------------------------------------

if sample==nil then sample={} end
sample.fast={}

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

state = 0
first = 1
tspawmx = 0
tspawny = 0

parse("mp_infammo 1")
parse("mp_autoteambalance 0")
parse("mp_freezetime 0")
--parse("bot_jointeam 1")

--------------------------------------
-- MAKE ZOMBIES                     --
--------------------------------------
addhook("spawn","sample.fast.spawn")
function sample.fast.spawn(p)
	--msg2(p,"Test: " .. player(p,"team"))
	if (player(p,"team")==1) then
		if(first == 1)then
			first = 0
			tspawnx = player(p,"x")
			tspawny = player(p,"y")
		end
		parse("setmaxhealth "..p.." "..250)
		parse("sethealth "..p.." "..250)
		parse("setmoney "..p.." "..0)
		sample.fast.hp[p]=250

		parse("strip "..p.." "..2)
		parse("strip "..p.." "..55)

     		parse("equip "..p.." 50")
	else
		parse("setmoney "..p.." "..15000)
	end
end

addhook("collect","sample.fast.collect")
function sample.fast.collect(p,iid,type,ain,a,mode)
	if (player(p,"team")==1) then
		if(type==50)then
		else
			parse("strip "..p.." "..type)
		end
	end
end

addhook("die","sample.fast.death")
function sample.fast.death(p,killer,weapon,x,y)

if(player(p,"team")==2)then
	local antal = 0
	local i
	for i = 1, 32 do
		if (player(i,"exists")==true and player(i,"team")==2) then
			  antal = antal + 1
     		 end
		
	end
	if(antal>1)then
		if(state==0)then
        	  local t = "@swap "..p.." t"
		  if t:sub(1, 6) == "@swap " then
        	  	local pl = t:sub(7, 8)
        	  	local team = t:sub(9)
        	  	for word in team:gmatch("[^%s]+") do
        	  	     team = word
        	  	     break
        	  	end
        	  	parse("make"..team.." "..pl)
     		  end
		  parse("spawnplayer "..p.." "..tspawnx.." "..tspawny)--17/70 - 26/79
		  --parse("equip "..p.." 50")
		end
	end
else
	if(state==0)then
	local t = "@swap "..p.." t"
	 if t:sub(1, 6) == "@swap " then
          	local pl = t:sub(7, 8)
          	local team = t:sub(9)
          	for word in team:gmatch("[^%s]+") do
          	     team = word
          	     break
          	end
          	parse("make"..team.." "..pl)
     	  end
	parse("spawnplayer "..p.." "..tspawnx.." "..tspawny)--17/70 - 26/79
	--parse("equip "..p.." 50")
	end
end

end


addhook("hit","sample.fast.hit")
function sample.fast.hit(p,source,weapon,hpdmg,apdmg)
	if (player(p,"team")==1) then
		if (sample.fast.hp[p] > 0) then
			if (sample.fast.hp[p] >= hpdmg) then
				sample.fast.hp[p]=sample.fast.hp[p]-hpdmg
				parse("sethealth "..p.." "..250)
			else
				parse("sethealth "..p.." "..player(p,"health")+sample.fast.hp[p])
				sample.fast.hp[p]=0
			end
		end
	end
end

addhook("endround","sample.fast.endround")
function sample.fast.endround(mode)
	state = 1
	local i
	for i = 1, 32 do
		if (player(i,"exists")==true and player(i,"bot")==false and player(i,"team")==1) then
			  --msg2(i,"YES")
			  local t = "@swap "..i.." ct"
			  if t:sub(1, 6) == "@swap " then
          			local pl = t:sub(7, 8)
         		 	local team = t:sub(9)
         		 	for word in team:gmatch("[^%s]+") do
         		 	     team = word
          			     break
          			end
          			parse("make"..team.." "..pl)
			  end
     		 end
		
	end
	parse("mp_autoteambalance 1")
	--parse("mp_autoteambalance 1")
end

addhook("startround","sample.fast.startround")
function sample.fast.startround(mode)
	state = 0
	parse("mp_autoteambalance 0")
end
1× editiert, zuletzt 01.05.09 13:23:16

alt Re: Equip with knife

Night Till Death
User Off Offline

Zitieren
i had a strage lagg when i tryed to strip off the knife someone kileld me and i spawned without a knife! i had only a hand! + i was invisible to other players for REAL! im not lieing!


p.s. srry for my english

alt Re: Equip with knife

MiroslavR
User Off Offline

Zitieren
NTD hat geschrieben
i had a strage lagg when i tryed to strip off the knife someone kileld me and i spawned without a knife! i had only a hand! + i was invisible to other players for REAL! im not lieing!


p.s. srry for my english

Yes, I have also noticed that, it's CS2D bug. It happens when you kill yourself and then set maxhealth...

alt Re: Equip with knife

DC
Admin Off Offline

Zitieren
MiroslavR hat geschrieben
Yes, I have also noticed that, it's CS2D bug. It happens when you kill yourself and then set maxhealth...


that's actually caused by erroneous scripts! never change the max health of dead people. it's pointless!
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht