Forum

> > CS2D > Scripts > Change teams without deaths
Forums overviewCS2D overview Scripts overviewLog in to reply

English Change teams without deaths

4 replies
To the start Previous 1 Next To the start

old Change teams without deaths

cortz
Super User Off Offline

Quote
I'm working on a script that would randomize the teams of players if one side becomes over stacked.

I initially thought that switching players between teams on the startround_prespawn hook would prevent a death for players but that doesn't seem to be the case.

In a last desperate resort, I'm here to ask if there is any possible way to change a player's team without having them die?

old Re: Change teams without deaths

Pagyra
User Off Offline

Quote
You can simply change the death score for upon team changes.
by setdeaths
Quote
Categories
server

Parameters
player (1-32): id of a player
deaths (0-X): deaths

Info
Set the number of deaths of a player (as server only).


Something like this:
1
2
3
4
5
6
7
8
9
10
11
12
parse("mp_autoteambalance 0")

addhook("join","pj")
function pj(id)
	if player(id,"team")~=0 then
          if player(id,"health")>0 then
               pos={player(id,"x"),player(id,"y")}
               parse("setdeaths "..id.." "..player(id,"deaths")-1)
               parse("spawnplayer "..id.." "..pos[1].." "..pos[2])
          end
     end
end
edited 2×, last 23.05.14 06:46:05 am

old Re: Change teams without deaths

Yates
Reviewer Off Offline

Quote
user VaiN has written
taking away the death from the score won't fix their rank stats though, that will still be affected right?

Correct. Stat file update doesn't happen on leave, it happens on kill & die (Includes team change etc). This means if you want to make your own team changing system you'll have to make your own ranking system as well. Counting all the times someone has been forced to change team and saving that to use it to calculate the actual deaths of someone with the stats file.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview