Forum

> > CS2D > Scripts > Changing random weapons/equipment on round start.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Changing random weapons/equipment on round start.

5 replies
To the start Previous 1 Next To the start

old Changing random weapons/equipment on round start.

VX
User Off Offline

Quote
So like, I need help with a script where on each round you get different varieties of weapons on each round, similar to the [LaG] Fun one, sometimes you could get a Mac 10 w/ HE's, Tactical Shield w/ Laser Mines, etc. So could anyone help me with this?

Thanks
-VX

old Re: Changing random weapons/equipment on round start.

Patasuss
User Off Offline

Quote
Just made the script for you:
1
2
3
4
5
6
7
8
9
10
11
--Arrays holding weapon ids
pistols={1,2,3,4,5,6}
mainweapons={10,11,20,21,22,23,24,30,31,32,33,34,35,36,37,38,39,40,41,45,46,47,48,49,88}
grens={51,52,53,54,72,73,75,76,77,86,87}
armor={57,58,79,80,81,82,83,84}
handweapons={69,74,78,85}

addhook("spawn","PSpawn")
function PSpawn(id)
return pistols[math.random(#pistols)]..","..mainweapons[math.random(#mainweapons)]..","..grens[math.random(#grens)]..","..armor[math.random(#armor)]..","..handweapons[math.random(#handweapons)]
end

edit: yay a bug in the forum-software

old Re: Changing random weapons/equipment on round start.

EngiN33R
Moderator Off Offline

Quote
I'll edit Patasuss's script.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--Arrays holding weapon ids
pistols={1,2,3,4,5,6}
mainweapons={10,11,20,21,22,23,24,30,31,32,33,34,35,36,37,38,39,40,41,45,46,47,48,49,88}
grens={51,52,53,54,72,73,75,76,77,86,87}
armor={57,58,79,80,81,82,83,84}
handweapons={69,74,78,85}

addhook("startround","WeaponsRand")
function WeaponsRand()
pist=math.random(#pistols)
mw=math.random(#mainweapons)
grn=math.random(#grens)
armr=math.random(#armor)
hw=math.random(#handweapons)
end

addhook("spawn","PSpawn")
function PSpawn(id)
return pistols[pist]..","..mainweapons[mw]..","..grens[grn]..","..armor[armr]..","..handweapons[hw]
end
edited 1×, last 09.01.11 07:31:11 pm

old Re: Changing random weapons/equipment on round start.

VX
User Off Offline

Quote
That's better, but people still spawn with the same equipment from the last round, is there some way to clear all the weapons from the last round, and respawn with random weapons on the roundstart?

old Re: Changing random weapons/equipment on round start.

oxytamine
User Off Offline

Quote
Patasuss has written
Just made the script for you:
1
2
3
4
5
6
7
8
9
10
11
--Arrays holding weapon ids
pistols={1,2,3,4,5,6}
mainweapons={10,11,20,21,22,23,24,30,31,32,33,34,35,36,37,38,39,40,41,45,46,47,48,49,88}
grens={51,52,53,54,72,73,75,76,77,86,87}
armor={57,58,79,80,81,82,83,84}
handweapons={69,74,78,85}

addhook("spawn","PSpawn")
function PSpawn(id)
return pistols[math.random(#pistols)]..","..mainweapons[math.random(#mainweapons)]..","..grens[math.random(#grens)]..","..armor[math.random(#armor)]..","..handweapons[math.random(#handweapons)]
end

edit: yay a bug in the forum-software

Excuse me, sir, can you help me, and edit your script a little, so the weapons will be cleared every round? I wanna start a server with such script.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview