mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add rcon: totele i
This commit is contained in:
parent
c7fef524e6
commit
43ecc1c7a3
|
@ -1,6 +1,5 @@
|
|||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||
#include <iostream>
|
||||
#include <base/system.h>
|
||||
#include <base/math.h>
|
||||
#include <base/vmath.h>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#endif
|
||||
|
||||
CONSOLE_COMMAND("kill_pl", "v", CFGFLAG_SERVER, ConKillPlayer, this, "Kills player v and announces the kill")
|
||||
CONSOLE_COMMAND("totele", "i", CFGFLAG_SERVER|CMDFLAG_TEST, ConToTeleporter, this, "Teleports you to teleporter v")
|
||||
CONSOLE_COMMAND("tele", "v", CFGFLAG_SERVER|CMDFLAG_TEST, ConTeleport, this, "Teleports you to player v")
|
||||
CONSOLE_COMMAND("addweapon", "i", CFGFLAG_SERVER|CMDFLAG_TEST, ConAddWeapon, this, "Gives weapon with id i to you (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, rifle = 4, ninja = 5)")
|
||||
CONSOLE_COMMAND("removeweapon", "i", CFGFLAG_SERVER|CMDFLAG_TEST, ConRemoveWeapon, this, "removes weapon with id i from you (all = -1, hammer = 0, gun = 1, shotgun = 2, grenade = 3, rifle = 4)")
|
||||
|
|
|
@ -248,6 +248,24 @@ void CGameContext::ModifyWeapons(IConsole::IResult *pResult, void *pUserData,
|
|||
pChr->m_DDRaceState = DDRACE_CHEAT;
|
||||
}
|
||||
|
||||
void CGameContext::ConToTeleporter(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *) pUserData;
|
||||
unsigned int TeleTo = pResult->GetInteger(0);
|
||||
|
||||
if (((CGameControllerDDRace*)pSelf->m_pController)->m_TeleOuts[TeleTo-1].size())
|
||||
{
|
||||
int Num = ((CGameControllerDDRace*)pSelf->m_pController)->m_TeleOuts[TeleTo-1].size();
|
||||
vec2 TelePos = ((CGameControllerDDRace*)pSelf->m_pController)->m_TeleOuts[TeleTo-1][(!Num)?Num:rand() % Num];
|
||||
CCharacter* pChr = pSelf->GetPlayerChar(pResult->m_ClientID);
|
||||
if (pChr)
|
||||
{
|
||||
pChr->Core()->m_Pos = TelePos;
|
||||
pChr->m_DDRaceState = DDRACE_CHEAT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGameContext::ConTeleport(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *) pUserData;
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#include <game/server/gamemodes/DDRace.h>
|
||||
#include "projectile.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <engine/shared/config.h>
|
||||
#include <game/server/teams.h>
|
||||
|
||||
|
|
|
@ -215,6 +215,7 @@ private:
|
|||
static void ConMove(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConMoveRaw(IConsole::IResult *pResult, void *pUserData);
|
||||
|
||||
static void ConToTeleporter(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConTeleport(IConsole::IResult *pResult, void *pUserData);
|
||||
|
||||
static void ConCredits(IConsole::IResult *pResult, void *pUserData);
|
||||
|
|
Loading…
Reference in a new issue