"setfollowplayer CN" command

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6263 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
flowtron
2011-04-17 14:45:52 +00:00
parent 1ddb4f33cd
commit 28ffb06db6
2 changed files with 22 additions and 0 deletions
+6
View File
@@ -1707,6 +1707,12 @@ echo (pstat_weap 0)
</arguments>
</command>
<command name="setfollowplayer">
<arguments>
<argument token="C" description="clientnum" valueNotes="which player to follow"/>
</arguments>
</command>
<command name="alive">
<description>Returns 1 if the local player is alive.</description>
<examples>
+16
View File
@@ -1460,6 +1460,21 @@ playerent *updatefollowplayer(int shiftdirection)
return players[player1->followplayercn];
}
void setfollowplayer(int cn)
{
// silently ignores invalid player-cn value passed
loopv(players) if(players[i])
{
if(player1->team != TEAM_SPECT && !watchingdemo && m_teammode && team_base(players[i]->team) != team_base(player1->team)) continue;
if(players[i]->clientnum == cn)
{
if(player1->followplayercn != players[i]->clientnum) addmsg(SV_SPECTCN, "ri", cn);
player1->followplayercn = cn;
}
}
}
// set new spect mode
void spectate(int mode)
{
@@ -1526,6 +1541,7 @@ void changefollowplayer(int shift)
COMMANDN(spectatemode, spectate, ARG_1INT);
COMMAND(togglespect, ARG_NONE);
COMMAND(changefollowplayer, ARG_1INT);
COMMAND(setfollowplayer, ARG_1INT);
int isalive() { return player1->state==CS_ALIVE ? 1 : 0; }
COMMANDN(alive, isalive, ARG_IVAL);