コード例 #1
0
void CGameContext::ConRight(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;
	int Move = pResult->GetVictim();


	if (pSelf->m_apPlayers[Move])
	{
		CCharacter* pChr = pSelf->GetPlayerChar(Move);
		if (pChr && pSelf->GetPlayerChar(Move))
		{
			pChr->m_Core.m_Pos.x += 32;
		}
	}
}
コード例 #2
0
void CGameContext::ConJail(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	int Time = pResult->GetInteger(0);
	int JailID = pResult->GetVictim();
	char aBuf[200];

	if(Time < 20 || Time > 2419200)
	{
		pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Jail", "Set a time between 20 and 2419200 (4 weeks)");
		return;
	}

	CCharacter* pChr = pSelf->GetPlayerChar(JailID);
	if(pChr)
	{
		if(pChr->IsAlive())
		{
			pChr->GetPlayer()->m_AccData.m_Arrested = Time;
	
			if(Time)
			{
				str_format(aBuf, sizeof aBuf, "'%s' is arrested for %i secounds.", pSelf->Server()->ClientName(JailID), Time);
				pSelf->SendChat(-1, CHAT_ALL, aBuf);
				pChr->Die(pChr->GetPlayer()->GetCID(), WEAPON_GAME);
			
			}
		}
	}
}
コード例 #3
0
void CGameContext::ConUnFreeze(IConsole::IResult *pResult, void *pUserData)
{
	if(!CheckRights(pResult->m_ClientID, pResult->GetVictim(), (CGameContext *)pUserData)) return;
	CGameContext *pSelf = (CGameContext *)pUserData;
	int Victim = pResult->GetVictim();
	static bool Warning = false;
	char aBuf[128];
	CCharacter* pChr = pSelf->GetPlayerChar(Victim);
	if(!pChr)
		return;
	if(pChr->m_DeepFreeze && !Warning)
	{
		pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "warning", "This client is deeply frozen, repeat the command to defrost him.");
		Warning = true;
		return;
	}
	if(pChr->m_DeepFreeze && Warning)
	{
		pChr->m_DeepFreeze = false;
		Warning = false;
	}
	pChr->m_FreezeTime = 2;
	pChr->GetPlayer()->m_RconFreeze = false;
	CServer* pServ = (CServer*)pSelf->Server();
	str_format(aBuf, sizeof(aBuf), "'%s' ClientID=%d has been defrosted.", pServ->ClientName(Victim), Victim);
	pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", aBuf);
}
コード例 #4
0
ファイル: ddracecommands.cpp プロジェクト: hamidkag/TBlock
void CGameContext::ConCLEANEXTRAS(IConsole::IResult *pResult, void *pUserData)		
{		
	CGameContext *pSelf = (CGameContext *) pUserData;		
	int Victim = pResult->GetVictim();		
		
	CCharacter* pChr = pSelf->GetPlayerChar(Victim);		
		
	if (!pChr)		
		return;		
		
	char aBuf[128];		
	str_format(aBuf, sizeof aBuf, "Removed all extras From '%s'",		
	pSelf->Server()->ClientName(Victim));		
	pSelf->SendChat(-1, CHAT_ALL, aBuf);		
	//pChr->m_pPlayer->m_Rainbow = false;		
	//pChr->m_pPlayer->m_Invisible = false;		
	pChr->m_FreezeHammer = false;		
	//pChr->m_pPlayer->m_Rainbow = false;		
	//pChr->m_Rainbow = false;		
	pChr->m_Rainbow = RAINBOW_NONE;		
	pSelf->m_apPlayers[Victim]->m_Rainbow = RAINBOW_NONE;		
	pChr->m_FastReload = false;		
	pChr->m_ReloadMultiplier = 1000;		
	pChr->m_Super = false;		
	pChr->m_HammerType = 0;		
	pChr->m_Bloody = false;		
	pChr->m_Invisible = false;		
	//Msg.m_ColorBody = g_Config.m_PlayerColorBody;		
	//Msg.m_ColorFeet = g_Config.m_PlayerColorFeet;		
}
コード例 #5
0
void CGameContext::ConTeleport(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	int TeleTo = pResult->GetInteger(0);
	int Tele = pResult->GetVictim();


	if (pSelf->m_apPlayers[TeleTo])
	{
		CCharacter* pChr = pSelf->GetPlayerChar(Tele);
		if (pChr && pSelf->GetPlayerChar(TeleTo))
		{
			pChr->m_Core.m_Pos = pSelf->m_apPlayers[TeleTo]->m_ViewPos;
		}
	}
}
コード例 #6
0
//Restored
void CGameContext::ConHammer(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *)pUserData;
	int Victim = pResult->GetVictim();
	if(!CheckRights(pResult->m_ClientID, Victim, (CGameContext *)pUserData)) return;

	char aBuf[128];
	int Type = pResult->GetInteger(0);

	CPlayer *pPlayer = pSelf->m_apPlayers[Victim];
	if(!pPlayer)
		return;

	CCharacter* pChr = pSelf->GetPlayerChar(Victim);
	if(!pChr)
		return;

	CServer* pServ = (CServer*)pSelf->Server();
	if(Type > 10 || Type < 0)
	{
		pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Select hammer between 0 and 10");
	}
	else
	{
		pChr->m_HammerType = Type;
		pChr->m_DDRaceState = DDRACE_CHEAT;
		str_format(aBuf, sizeof(aBuf), "Hammer of '%s' ClientID=%d setted to %d", pServ->ClientName(Victim), Victim, Type);
		pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", aBuf);
	}
}
コード例 #7
0
void CGameContext::ConFreeze(IConsole::IResult *pResult, void *pUserData)
{
	if(!CheckRights(pResult->m_ClientID, pResult->GetVictim(), (CGameContext *)pUserData)) return;
	CGameContext *pSelf = (CGameContext *)pUserData;
	int Seconds = -1;
	int Victim = pResult->GetVictim();

	char aBuf[128];

	if(pResult->NumArguments() == 1)
		Seconds = clamp(pResult->GetInteger(0), -2, 9999);

	CCharacter* pChr = pSelf->GetPlayerChar(Victim);
	if(!pChr)
		return;

	if(pSelf->m_apPlayers[Victim])
	{
		pChr->Freeze(Seconds);
		pChr->GetPlayer()->m_RconFreeze = Seconds != -2;
		CServer* pServ = (CServer*)pSelf->Server();
		if(Seconds >= 0)
			str_format(aBuf, sizeof(aBuf), "'%s' ClientID=%d has been Frozen for %d.", pServ->ClientName(Victim), Victim, Seconds);
		else if(Seconds == -2)
		{
			pChr->m_DeepFreeze = true;
			str_format(aBuf, sizeof(aBuf), "'%s' ClientID=%d has been Deep Frozen.", pServ->ClientName(Victim), Victim);
		}
		else
			str_format(aBuf, sizeof(aBuf), "'%s' ClientID=%d is Frozen until you unfreeze him.", pServ->ClientName(Victim), Victim);
		pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info", aBuf);
	}

}
コード例 #8
0
void CGameContext::ConGiveMoney(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	int Time = pResult->GetInteger(0);
	int JailID = pResult->GetVictim();
	char aBuf[200];

	if(Time > 5000000 || Time < 1)
	{
		pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Debug", "Set a value between 1 and 5Mio");
		return;
	}

	CCharacter* pChr = pSelf->GetPlayerChar(JailID);
	if(pChr)
	{
		if(pChr->IsAlive())
		{
			pChr->GetPlayer()->m_AccData.m_Money += Time;
	
			if(Time)
			{
				str_format(aBuf, sizeof aBuf, "'%s' got %d TC", pSelf->Server()->ClientName(JailID), Time);
				pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "Money", aBuf);
			
			}
		}
	}
}
コード例 #9
0
ファイル: ddracecommands.cpp プロジェクト: hamidkag/TBlock
void CGameContext::ConUnDeep(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	if (!CheckClientID(pResult->m_ClientID))
		return;
	CCharacter* pChr = pSelf->GetPlayerChar(pResult->m_ClientID);
	if (pChr)
		pChr->m_DeepFreeze = false;
}
コード例 #10
0
void CGameContext::ConTeleport(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	int TeleTo = pResult->GetInteger(0);
	int Tele = pResult->GetVictim();

	if (!CheckRights(pResult->m_ClientID, Tele, (CGameContext *)pUserData))
		return;

	if (pSelf->m_apPlayers[TeleTo])
	{
		CCharacter* pChr = pSelf->GetPlayerChar(Tele);
		if (pChr && pSelf->GetPlayerChar(TeleTo))
		{
			pChr->Core()->m_Pos = pSelf->m_apPlayers[TeleTo]->m_ViewPos;
			pChr->m_DDRaceState = DDRACE_CHEAT;
		}
	}
}
コード例 #11
0
ファイル: ddracechat.cpp プロジェクト: ftk/XXLDDRace
void CGameContext::ConLText(IConsole::IResult *pResult, void *pUserData)
{
        CGameContext *pSelf = (CGameContext *) pUserData;
        const int ClientID = pResult->m_ClientID;

	CCharacter * pChar = pSelf->GetPlayerChar(ClientID);

	// /text posx posy msg
	if(pChar)
		pSelf->CreateLolText(pChar, true, vec2(pResult->GetFloat(0), pResult->GetFloat(1)), vec2(0, 0), 150, pResult->GetString(2));
}
コード例 #12
0
void CGameContext::ConUnjail(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	int UnJailID = pResult->GetVictim();
	char aBuf[200];


	CCharacter* pChr = pSelf->GetPlayerChar(UnJailID);
	if(pChr)
	{
	pChr->GetPlayer()->m_AccData.m_Arrested = 1;
	}
}
コード例 #13
0
ファイル: ddracecommands.cpp プロジェクト: andi103/rDDRace
void CGameContext::ConUnSuper(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	if (!CheckClientID(pResult->m_ClientID))
		return;
	CCharacter* pChr = pSelf->GetPlayerChar(pResult->m_ClientID);
	if (pChr && pChr->m_Super)
	{
		pChr->m_Super = false;
		pChr->Teams()->SetForceCharacterTeam(pResult->m_ClientID,
				pChr->m_TeamBeforeSuper);
	}
}
コード例 #14
0
ファイル: ddracecommands.cpp プロジェクト: andi103/rDDRace
void CGameContext::ConSuper(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	if (!CheckClientID(pResult->m_ClientID))
		return;
	CCharacter* pChr = pSelf->GetPlayerChar(pResult->m_ClientID);
	if (pChr && !pChr->m_Super)
	{
		pChr->m_Super = true;
		pChr->UnFreeze();
		pChr->m_TeamBeforeSuper = pChr->Team();
		pChr->Teams()->SetCharacterTeam(pResult->m_ClientID, TEAM_SUPER);
		pChr->m_DDRaceState = DDRACE_CHEAT;
	}
}
コード例 #15
0
ファイル: ddracecommands.cpp プロジェクト: hamidkag/TBlock
void CGameContext::ConUnFreezeHammer(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	int Victim = pResult->GetVictim();

	CCharacter* pChr = pSelf->GetPlayerChar(Victim);

	if (!pChr)
		return;

	char aBuf[128];
	str_format(aBuf, sizeof aBuf, "'%s' lost freeze hammer!",
			pSelf->Server()->ClientName(Victim));
	pSelf->SendChat(-1, CHAT_ALL, aBuf);

	pChr->m_FreezeHammer = false;
}
コード例 #16
0
ファイル: ddracechat.cpp プロジェクト: ftk/XXLDDRace
void CGameContext::ConDisconnectRescue(IConsole::IResult *pResult, void *pUserData)
{ 
	CGameContext *pSelf = (CGameContext *) pUserData;
	const int ClientID = pResult->m_ClientID;
	CCharacter * pChar = pSelf->GetPlayerChar(ClientID);
	if(!pChar)
		return;
	auto iterator = pSelf->m_SavedPlayers.find(pSelf->Server()->ClientName(ClientID));
	if(iterator == pSelf->m_SavedPlayers.end())
		return;
    
	CPlayerRescueState& state = iterator->second;
	if(state.Pos == vec2(0.f, 0.f))
		return;
	ApplyPlayerState(state, pChar);
	pSelf->m_SavedPlayers.erase(iterator);
}
コード例 #17
0
void CGameContext::ConDonor(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	int Switch = pResult->GetInteger(0);
	int DonorID = pResult->GetVictim();
	char aBuf[200];

	CCharacter* pChr = pSelf->GetPlayerChar(DonorID);
	if (pChr)
	{
		pChr->GetPlayer()->m_AccData.m_Donor = Switch;
		if(Switch)
				str_format(aBuf, sizeof aBuf, "'%s' is a Donor now.", pSelf->Server()->ClientName(DonorID));
		else
					str_format(aBuf, sizeof aBuf, "'%s' is no longer a Donor.", pSelf->Server()->ClientName(DonorID));
		pSelf->SendChat(-1, CHAT_ALL, aBuf);
	}
}
コード例 #18
0
void CGameContext::ConPolice(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	int Switch = pResult->GetInteger(0);
	int PoliceID = pResult->GetVictim();
	char aBuf[200];

	CCharacter* pChr = pSelf->GetPlayerChar(PoliceID);
	if (pChr)
	{
		pSelf->Server()->Police(PoliceID,Switch?1:0);
		if(Switch)
			str_format(aBuf, sizeof aBuf, "'%s' is a Police now.", pSelf->Server()->ClientName(PoliceID));
		else
			str_format(aBuf, sizeof aBuf, "'%s' is no longer a Police.", pSelf->Server()->ClientName(PoliceID));
		pSelf->SendChat(-1, CHAT_ALL, aBuf);
	}
}
コード例 #19
0
ファイル: ddracecommands.cpp プロジェクト: hamidkag/TBlock
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_Pos = TelePos;
			pChr->m_PrevPos = TelePos;
			pChr->m_DDRaceState = DDRACE_CHEAT;
		}
	}
}
コード例 #20
0
ファイル: ddracechat.cpp プロジェクト: ftk/XXLDDRace
void CGameContext::ConLDot(IConsole::IResult *pResult, void *pUserData)
{
        CGameContext *pSelf = (CGameContext *) pUserData;
        const int ClientID = pResult->m_ClientID;

        CCharacter * pChar = pSelf->GetPlayerChar(ClientID);

	unsigned Duration = pResult->GetInteger(4);

	unsigned Mode = pResult->GetInteger(5); // 0 - follow player, 1 - dont follow player, 2 - global coords

        // /dot posx posy velx vely duration mode
        if((pChar || Mode == 2) && Duration < 50 * 20)
		new CLolPlasma(&pSelf->m_World, (Mode == 0) ? pChar : NULL,
			       vec2(pResult->GetFloat(0), pResult->GetFloat(1)) + ((Mode == 1) ? pChar->m_Pos : vec2(0.f, 0.f)),
			       vec2(pResult->GetFloat(2), pResult->GetFloat(3)),
			       Duration);

}
コード例 #21
0
ファイル: ddracechat.cpp プロジェクト: ftk/XXLDDRace
void CGameContext::ConHelper(IConsole::IResult *pResult, void *pUserData)
{
	int helper = 0;
	char aBuf[128];
	int Seconds;
	int HelperTime = 60;

	CGameContext *pSelf = (CGameContext *)pUserData;
	CCharacter* pChr = pSelf->GetPlayerChar(pResult->m_ClientID);
	CServer* pServ = (CServer*)pSelf->Server();

	if (pResult->NumArguments() == 1 && pSelf->m_apPlayers[pResult->m_ClientID]->m_Authed >= pServ->AUTHED_MOD)
	{
		if(!CheckClientID(pResult->GetInteger(0))) return;
		CCharacter* pChr2 = pSelf->GetPlayerChar(pResult->GetInteger(0));
		if(pSelf->m_apPlayers[pResult->GetInteger(0)]
		   && pChr2 && pResult->m_ClientID != pResult->GetInteger(0)
		   && pSelf->m_apPlayers[pResult->GetInteger(0)]->m_Authed == pServ->AUTHED_NO)
			pServ->SetRconLevel(pResult->GetInteger(0), pServ->AUTHED_HELPER);

		return;
	}

	if(pChr && g_Config.m_SvHelper)
	{

		if (pSelf->m_apPlayers[pResult->m_ClientID]->m_Helped)
		{

			Seconds = pSelf->m_apPlayers[pResult->m_ClientID]->m_Helped / pSelf->Server()->TickSpeed();
			str_format(aBuf, sizeof(aBuf), "Please wait %d seconds to call a helper again.",  Seconds);
			pSelf->SendChatTarget(pResult->m_ClientID, aBuf);
			return;
		}
		for(int i = 0;i <=(int)MAX_CLIENTS-1 ; i++)
		{
			CCharacter* pChr3 = pSelf->GetPlayerChar(i);
			if(pChr3)
			{
				if (pSelf->m_apPlayers[i]->m_Authed >= pServ->AUTHED_HELPER)
				{
					str_format(aBuf, sizeof(aBuf), "%s needs help. ID:%i", pSelf->Server()->ClientName(pResult->m_ClientID), pResult->m_ClientID);
					pSelf->SendChatTarget(i, aBuf);
					pServ->SendRconLine(i, aBuf);
					helper++;

				}
			}
		}
		if (helper == 0 )
			str_format(aBuf, sizeof(aBuf), "Sorry, but there is no helper online.");
		else if (helper == 1)
		{
			str_format(aBuf, sizeof(aBuf), "You called one helper!");
			pSelf->m_apPlayers[pResult->m_ClientID]->m_Helped = HelperTime * pSelf->Server()->TickSpeed();
		}
		else
		{
			str_format(aBuf, sizeof(aBuf), "%i helpers called!", helper);
			pSelf->m_apPlayers[pResult->m_ClientID]->m_Helped = HelperTime * pSelf->Server()->TickSpeed();
		}
	}
	else
	{
		str_format(aBuf, sizeof(aBuf), "sv_helper not activated.");
	}
	pSelf->SendChatTarget(pResult->m_ClientID, aBuf);
}
コード例 #22
0
ファイル: ddracechat.cpp プロジェクト: ftk/XXLDDRace
void CGameContext::ConSwap(IConsole::IResult *pResult, void *pUserData)
{
	CGameContext *pSelf = (CGameContext *) pUserData;
	const int ClientID = pResult->m_ClientID;

	if(!g_Config.m_SvSwap)
	{
		pSelf->SendChatTarget(ClientID, "Swap is not activated");
		return;
	}
	
	int ToSwap = pResult->GetVictim();
	if(!CheckClientID(ToSwap) || ClientID == ToSwap)
		ToSwap = -1;

	if(!CheckClientID(ClientID))
		return;
	
	pSelf->m_aSwapRequest[ClientID] = ToSwap;
	if(ToSwap == -1)
		return;
	
	if(pSelf->ProcessSpamProtection(ClientID)) // dont flood
		return;
	
	// check if ToSwap agrees
	char aBuf[128];
	if(pSelf->m_aSwapRequest[ToSwap] != ClientID)
	{
		// send  notification to ToSwap
		str_format(aBuf, sizeof(aBuf), "%s wants to swap places with you. Type \'/swap %d\' to accept.",
			   pSelf->Server()->ClientName(ClientID), ClientID);
		pSelf->SendChatTarget(ToSwap, aBuf);
		
		str_format(aBuf, sizeof(aBuf), "Requst sent to %s.",
			   pSelf->Server()->ClientName(ToSwap));
		pSelf->SendChatTarget(ClientID, aBuf);
	}
	else
	{
		// ToSwap agreed
		CCharacter * pChar1 = pSelf->GetPlayerChar(ClientID);
		CCharacter * pChar2 = pSelf->GetPlayerChar(ToSwap);
		if(!pChar1 || !pChar2 || pChar1->Team() != pChar2->Team())
		{
			// one is not alive or not in the same team
			const char * pStr = "Can\'t swap!";
			pSelf->SendChatTarget(ToSwap, pStr);
			pSelf->SendChatTarget(ClientID, pStr);
			return;
		}

		CPlayerRescueState state1 = GetPlayerState(pChar1),
			state2 = GetPlayerState(pChar2);
		
		// swap
		ApplyPlayerState(state2, pChar1);
		ApplyPlayerState(state1, pChar2);
		
		str_format(aBuf, sizeof(aBuf), "%s swapped with %s.",
			   pSelf->Server()->ClientName(ToSwap),
			   pSelf->Server()->ClientName(ClientID));
		pSelf->SendChat(-1, CGameContext::CHAT_ALL, aBuf);
		// reset swap requests
		pSelf->m_aSwapRequest[ToSwap] = -1;
		pSelf->m_aSwapRequest[ClientID] = -1;
	}
}