void CRPGPlayer::ChargeTouch( CBaseEntity *pOther )
{
	if (!m_bUsingCharge)
		RETURN_META(MRES_IGNORED);

	edict_t *pEdict = serverents->BaseEntityToEdict( pOther );
	if (!pEdict || pEdict->IsFree())
		RETURN_META(MRES_IGNORED);

	int e_index = engine->IndexOfEdict(pEdict);
	if ((e_index >= 0) && (e_index <= playerinfo->GetGlobalVars()->maxClients))
	{
		CRPGPlayer *pPlayer = FindPlayerByIndex(e_index);
		if (!pPlayer)
			RETURN_META(MRES_IGNORED);

		if (pPlayer->GetPlayerInfo()->GetTeamIndex() == TEAM_UNDEAD)
		{
			// let's throw this fool around
			Vector EyePosition = VFuncs::EyePosition(GetBaseEntity());
			QAngle EyeAngles = GetPlayerInfo()->GetAbsAngles();

			Vector forward;
			AngleVectors(EyeAngles, &forward);

			const Vector FinalVelocity = (BRUTE_SKILL_CHARGE_FORCE * forward);
			VFuncs::Teleport((CBaseAnimating*)pPlayer->GetBaseEntity(), NULL, NULL, &FinalVelocity);
		}
	}

	RETURN_META(MRES_IGNORED);
}
IPhysicsVehicleController *GetLuaVehicle(ILuaInterface *gLua)
{
	gLua->CheckType(1, GLua::TYPE_ENTITY);

	CBaseHandle *handle = (CBaseHandle*)gLua->GetUserData(1);
	CBaseEntity *entity = GetBaseEntity(handle->GetEntryIndex());

	if(!entity)
	{
		gLua->Error("[gm_pimpmyride] NO ENTITY!");
		return NULL;
	}

	IServerVehicle *vehicle = entity->GetServerVehicle();

	if(!vehicle)
	{
		gLua->Error("[gm_pimpmyride] NO VEHICLE!");
		return NULL;
	}

	IPhysicsVehicleController *controller = vehicle->GetVehicleController();

	if(!controller)
	{
		gLua->Error("[gm_pimpmyride] NO PHYSICS CONTROLLER!");
		return NULL;
	}

	return controller;
}
bool CRPGPlayer::IsOnGround()
{
	if (*(int *)((char*)GetBaseEntity() + GetOffset("CBasePlayer", "m_fFlags")) & FL_ONGROUND )
	{
		return true;
	}
	return false;
}
void CRPGPlayer::InitOffsets()
{
	datamap_t *datamap = gamehelpers->GetDataMap(GetBaseEntity());
	typedescription_t *typedesc= gamehelpers->FindInDataMap(datamap, "m_nButtons");

	m_iButtonsOffset = typedesc->fieldOffset[TD_OFFSET_NORMAL];

	sm_sendprop_info_t sendprop;
	gamehelpers->FindSendPropInfo("CBaseCombatWeapon","m_flNextPrimaryAttack", &sendprop);
	m_iNextPrimaryAttackOffset = sendprop.actual_offset;
}
// NOTE: This doesn't happen in OnRemoveEntity() specifically because 
// listeners may want to reference the object as it's being deleted
// OnRemoveEntity isn't called until the destructor and all data is invalid.
void CGlobalEntityList::NotifyRemoveEntity( CBaseHandle hEnt )
{
	CBaseEntity *pBaseEnt = GetBaseEntity( hEnt );
	if ( !pBaseEnt )
		return;

	//DevMsg(2,"Deleted %s\n", pBaseEnt->GetClassname() );
	for ( int i = m_entityListeners.Count()-1; i >= 0; i-- )
	{
		m_entityListeners[i]->OnEntityDeleted( pBaseEnt );
	}
}
void CRPGPlayer::SetHealth( int health )
{
	sm_sendprop_info_t health_sendprop;
	if(!gamehelpers->FindSendPropInfo("CBasePlayer", "m_iHealth", &health_sendprop))
	{
		smutils->LogError(myself, "Warning! Health offset not found");
		return;
	}

	CBaseEntity *pEntity = GetBaseEntity();
	*(int *)((char*)pEntity + health_sendprop.actual_offset) = health;
}
//-----------------------------------------------------------------------------
// Connects, disconnects edicts
//-----------------------------------------------------------------------------
void CServerNetworkProperty::AttachEdict( edict_t *pRequiredEdict )
{
	Assert ( !m_pPev );

	// see if there is an edict allocated for it, otherwise get one from the engine
	if ( !pRequiredEdict )
	{
		pRequiredEdict = engine->CreateEdict();
	}

	m_pPev = pRequiredEdict;
	m_pPev->SetEdict( GetBaseEntity(), true );
}
Beispiel #8
0
CCopyEntity *EntityManager::CreateEntity( CCopyEntityDesc& rCopyEntityDesc )
{
	if( !rCopyEntityDesc.pBaseEntityHandle )
		return NULL;

	BaseEntityHandle& rBaseEntityHandle = *(rCopyEntityDesc.pBaseEntityHandle);

//	LOG_PRINT( "creating a copy entity of " + string(rBaseEntityHandle.GetBaseEntityName()) );

	BaseEntity *pBaseEntity = GetBaseEntity( rBaseEntityHandle );
	if( !pBaseEntity )
		return NULL;

	BaseEntity& rBaseEntity = *(pBaseEntity);

//	LOG_PRINT( "checking the initial position of " + rBaseEntity.GetNameString() );

	// determine the entity group id
	// priority (higher to lower):
	// (id set to copy entity desc) -> (id set to base entity)
	int entity_group_id = ENTITY_GROUP_INVALID_ID;
	if( rCopyEntityDesc.sGroupID != ENTITY_GROUP_INVALID_ID )
	{
		entity_group_id = rCopyEntityDesc.sGroupID;
	}
	else
	{
		// try the group of base entity
		entity_group_id = rBaseEntity.GetEntityGroupID();
	}

	if( false )
//	if( !rBaseEntity.m_bNoClip )
//	 && rCopyEntityDesc.DontCreateIfOverlapIsDetected )
	{	// check for overlaps with other entities
		// to see if the new entity is in a valid position
//		if( rCopyEnt.bvType == BVTYPE_AABB || rCopyEnt.bvType == BVTYPE_DOT )
//		{
			STrace tr;
			tr.sTraceType = TRACETYPE_IGNORE_NOCLIP_ENTITIES;
			tr.vEnd       = rCopyEntityDesc.WorldPose.vPosition;
			tr.bvType     = rBaseEntity.m_BoundingVolumeType;
			tr.aabb       = rBaseEntity.m_aabb;
			tr.GroupIndex = entity_group_id;
			if( rBaseEntity.m_bNoClipAgainstMap )
				tr.sTraceType |= TRACETYPE_IGNORE_MAP;
			m_pStage->CheckPosition( tr );
			if(tr.in_solid)
			{
				LOG_PRINT( " - cannot create a copy entity due to overlaps: " + string(rBaseEntityHandle.GetBaseEntityName()) );
				return NULL;	// specified position is invalid - cannot create entity
			}
//		}
	}

//	LOG_PRINT( "the copy entity of " + rBaseEntity.GetNameString() + " is in a valid position" );

	// create an entity
	shared_ptr<CCopyEntity> pNewEntitySharedPtr = m_pEntityFactory->CreateEntity( rCopyEntityDesc.TypeID );
	if( !pNewEntitySharedPtr )
	{
		/// too many entities or no entity is defined for rCopyEntityDesc.TypeID
		LOG_PRINT_ERROR( " - cannot create a copy entity of '" + string(rBaseEntityHandle.GetBaseEntityName()) + "'" );
		return NULL;
	}

	CCopyEntity *pNewCopyEnt = pNewEntitySharedPtr.get();

	pNewCopyEnt->m_TypeID    = rCopyEntityDesc.TypeID;

	// copy parameter values from base entity (entity attributes set)
	SetBasicEntityAttributes( pNewCopyEnt, rBaseEntity );

	// copy parameter values from entity desc

	pNewCopyEnt->SetName( rCopyEntityDesc.strName );

	pNewCopyEnt->SetWorldPose( rCopyEntityDesc.WorldPose );

	pNewCopyEnt->Velocity()  = rCopyEntityDesc.vVelocity;
	pNewCopyEnt->fSpeed      = rCopyEntityDesc.fSpeed;

	pNewCopyEnt->m_MeshHandle = rCopyEntityDesc.MeshObjectHandle;

	pNewCopyEnt->f1 = rCopyEntityDesc.f1;
	pNewCopyEnt->f2 = rCopyEntityDesc.f2;
	pNewCopyEnt->f3 = rCopyEntityDesc.f3;
	pNewCopyEnt->f4 = rCopyEntityDesc.f4;
	pNewCopyEnt->f5 = 0.0f;
	pNewCopyEnt->s1 = rCopyEntityDesc.s1;
	pNewCopyEnt->v1 = rCopyEntityDesc.v1;
	pNewCopyEnt->v2 = rCopyEntityDesc.v2;
	pNewCopyEnt->iExtraDataIndex = rCopyEntityDesc.iExtraDataIndex;
	pNewCopyEnt->pUserData = rCopyEntityDesc.pUserData;

	pNewCopyEnt->sState   = 0;
	pNewCopyEnt->bInSolid = false;

	pNewCopyEnt->GroupIndex = entity_group_id;

//	pNewCopyEnt->GroupIndex = rCopyEntityDesc.sGroupID;

	pNewCopyEnt->touch_plane.dist   = 0;
	pNewCopyEnt->touch_plane.normal = Vector3(0,0,0);

	InitEntity( pNewEntitySharedPtr, rCopyEntityDesc.pParent, pBaseEntity, rCopyEntityDesc.pPhysActorDesc );

	pNewCopyEnt->Init( rCopyEntityDesc );

	LOG_PRINT_VERBOSE( " - created a copy entity of " + rBaseEntity.GetNameString() );

	return pNewCopyEnt;
}
Beispiel #9
0
void CCheatMenu::Render(void)
{
	gInts.Engine->GetScreenSize(ScreenW, ScreenH);

	int i = 0;

	i = AddItem(i, "Aimbot", &gCvars.aimbot_switch, 0, 1, 1, true);
	if (gCvars.aimbot_switch)
	{
		i = AddItem(i, " - Enabled", &gCvars.aimbot_active, 0, 1, 1, false);
		i = AddItem(i, " - Key", &gCvars.aimbot_key, 0, 8, 1, false);
		i = AddItem(i, " - Hitscan", &gCvars.aimbot_hitscan, 0, 1, 1, false);
		i = AddItem(i, " - Hitbox", &gCvars.aimbot_hitbox, 0, 18, 1, false);
		i = AddItem(i, " - Autoshoot", &gCvars.aimbot_autoshoot, 0, 1, 1, false);
	}

	i = AddItem(i, "Triggerbot", &gCvars.triggerbot_switch, 0, 1, 1, true);
	if (gCvars.triggerbot_switch)
	{
		i = AddItem(i, " - Enabled", &gCvars.triggerbot_active, 0, 1, 1, false);
		i = AddItem(i, " - Key", &gCvars.triggerbot_key, 0, 8, 1, false);
		i = AddItem(i, " - Head Only", &gCvars.triggerbot_headonly, 0, 1, 1, false);
	}

	i = AddItem(i, "Player List", &gCvars.playerlist_switch, 0, 1, 1, true);
	for (int p = 1; p <= gInts.Engine->GetMaxClients(); p++)
	{
		if (p == me)
			continue;

		CBaseEntity *pPlayer = GetBaseEntity(p);

		if (pPlayer == NULL)
			continue;

		player_info_t pInfo;
		gInts.Engine->GetPlayerInfo(p, &pInfo);

		char szString[256];
		sprintf(szString, " - %s", pInfo.name);

		if (gCvars.playerlist_switch)
			i = AddItem(i, szString, &gCvars.PlayerMode[pPlayer->GetIndex()], 0, 2, 1, false);
	}


	i = AddItem(i, "ESP", &gCvars.esp_switch, 0, 1, 1, true);
	if (gCvars.esp_switch)
	{
		i = AddItem(i, " - Enabled", &gCvars.esp_active, 0, 1, 1, false);
		i = AddItem(i, " - Enemies Only", &gCvars.esp_enemyonly, 0, 1, 1, false);
		i = AddItem(i, " - Box", &gCvars.esp_box, 0, 1, 1, false);
		i = AddItem(i, " - Name", &gCvars.esp_name, 0, 1, 1, false);
		i = AddItem(i, " - Class", &gCvars.esp_class, 0, 1, 1, false);
		i = AddItem(i, " - Health", &gCvars.esp_health, 0, 3, 1, false);
		i = AddItem(i, " - Bones", &gCvars.esp_bones, 0, 3, 1, false);
	}

	i = AddItem(i, "Settings", &gCvars.settings_switch, 0, 1, 1, true);
	if (gCvars.settings_switch)
	{
		i = AddItem(i, " - Menu Postion X", &gCvars.iMenu_Pos_X, 0, ScreenW, 25, false);
		i = AddItem(i, " - Menu Postion Y", &gCvars.iMenu_Pos_Y, 0, ScreenH, 25, false);
	}

	i = AddItem(i, "Misc", &gCvars.misc_switch, 0, 1, 1, true);
	if (gCvars.misc_switch)
	{
		i = AddItem(i, " - Bunnyhop", &gCvars.misc_bunnyhop, 0, 1, 1, false);
		i = AddItem(i, " - Autostrafe", &gCvars.misc_autostrafe, 0, 1, 1, false);
		i = AddItem(i, " - Noisemaker Spam", &gCvars.misc_noisemaker_spam, 0, 1, 1, false);
	}

	iMenuItems = i;
}
Beispiel #10
0
void CCheatMenu::DrawMenu(void)
{
	int x = gCvars.iMenu_Pos_X,
		xx = x + 150,
		y = gCvars.iMenu_Pos_Y,
		w = 200,
		h = 14;

	CBaseEntity *pLocal = GetBaseEntity(me);

	Color clrColor = gDrawManager.GetPlayerColor(pLocal);

	gDrawManager.DrawRect(x, y - (h + 4), w, iMenuItems * h + 21, Color(20, 20, 20, 128));
	gDrawManager.OutlineRect(x, y - (h + 4), w, (h + 4), clrColor);

	gDrawManager.DrawRect(x + 2, y - (h + 4), w - 4, (h + 4), clrColor);
	gDrawManager.OutlineRect(x - 1, y - (h + 4) - 1, w + 2, (h + 4), Color(0, 0, 0, 255)); // test
	gDrawManager.OutlineRect(x + 1, y - (h + 4) + 1, w - 2, (h + 4), Color(0, 0, 0, 255)); // test

	gDrawManager.OutlineRect(x, y - (h + 4), w, iMenuItems * h + 21, clrColor);

	gDrawManager.OutlineRect(x - 1, (y - (h + 4)) - 1, w + 2, (iMenuItems * h + 21) + 2, Color(0, 0, 0, 255));
	gDrawManager.OutlineRect(x + 1, (y - (h + 4)) + 1, w - 2, (iMenuItems * h + 21) - 2, Color(0, 0, 0, 255));

	gDrawManager.DrawString(x + 4, y - 16, clrColor, "potassium menu");

	for (int i = 0; i < iMenuItems; i++)
	{
		if (i != iMenuIndex)
		{
			if (pMenu[i].isClassSwitch)
			{
				if (!(pMenu[i].value[0]))
				{
					gDrawManager.DrawString(x + 2, y + (h * i), clrColor, "[+] %s", pMenu[i].szTitle);
				}
				else if (pMenu[i].value[0])
				{
					gDrawManager.DrawString(x + 2, y + (h * i), clrColor, "[-] %s", pMenu[i].szTitle);
				}
			}
			else
			{
				gDrawManager.DrawString(x + 4, y + (h * i), Color::White(), pMenu[i].szTitle);

				if (!strcmp(pMenu[i].szTitle, " - Health"))
				{
					gDrawManager.DrawString(xx, y + (h * i), pMenu[i].value[0] ? Color::White() : Color(105, 105, 105, 255), "%s", szHealthModes[(int)pMenu[i].value[0]]);
				}

				else if (!strcmp(pMenu[i].szTitle, " - Bones"))
				{
					gDrawManager.DrawString(xx, y + (h * i), pMenu[i].value[0] ? Color::White() : Color(105, 105, 105, 255), "%s", szBoneModes[(int)pMenu[i].value[0]]);
				}

				else if (pMenu[i].flMax == 18)
				{
					gDrawManager.DrawString(xx, y + (h * i), Color::White(), "%s", szHitboxes[(int)pMenu[i].value[0]]);
				}

				else if (pMenu[i].flMax == 8)
				{
					gDrawManager.DrawString(xx, y + (h * i), Color::White(), "%s", szKeyNames[(int)pMenu[i].value[0]]);
				}

				else if (pMenu[i].flMax == 2)
				{
					gDrawManager.DrawString(xx, y + (h * i), Color::White(), !pMenu[i].value[0] ? "Ignore" : pMenu[i].value[0] == 1 ? "Normal" : "Rage");
				}

				else if (pMenu[i].flMax == 1)
				{
					gDrawManager.DrawString(xx, y + (h * i), pMenu[i].value[0] ? Color::White() : Color(105, 105, 105, 255), pMenu[i].value[0] ? "ON" : "OFF");
				}

				else if (pMenu[i].value[0] >= 1 && pMenu[i].flMax > 1)
				{
					gDrawManager.DrawString(xx, y + (h * i), pMenu[i].value[0] >= 1 ? Color::White() : Color(105, 105, 105, 255), "%0.0f", pMenu[i].value[0]);
				}
			}
		}
		else
		{
			gDrawManager.DrawRect(x + 1, y + (h * i), w - 2, h, Color(255, 255, 255, 80));

			if (pMenu[i].isClassSwitch)
			{
				if (!(pMenu[i].value[0]))
				{
					gDrawManager.DrawString(x + 2, y + (h * i), clrColor, "[+] %s", pMenu[i].szTitle);
				}
				else if (pMenu[i].value[0])
				{
					gDrawManager.DrawString(x + 2, y + (h * i), clrColor, "[-] %s", pMenu[i].szTitle);
				}
			}
			else
			{
				gDrawManager.DrawString(x + 4, y + (h * i), clrColor, pMenu[i].szTitle);

				if (!strcmp(pMenu[i].szTitle, " - Health"))
				{
					gDrawManager.DrawString(xx, y + (h * i), clrColor, "%s", szHealthModes[(int)pMenu[i].value[0]]);
				}

				else if (!strcmp(pMenu[i].szTitle, " - Bones"))
				{
					gDrawManager.DrawString(xx, y + (h * i), clrColor, "%s", szBoneModes[(int)pMenu[i].value[0]]);
				}

				else if (pMenu[i].flMax == 18)
				{
					gDrawManager.DrawString(xx, y + (h * i), clrColor, "%s", szHitboxes[(int)pMenu[i].value[0]]);
				}

				else if (pMenu[i].flMax == 8)
				{
					gDrawManager.DrawString(xx, y + (h * i), clrColor, "%s", szKeyNames[(int)pMenu[i].value[0]]);
				}

				else if (pMenu[i].flMax == 2)
				{
					gDrawManager.DrawString(xx, y + (h * i), clrColor, !pMenu[i].value[0] ? "Ignore" : pMenu[i].value[0] == 1 ? "Normal" : "Rage");
				}

				else if (pMenu[i].flMax == 1)
				{
					gDrawManager.DrawString(xx, y + (h * i), clrColor, pMenu[i].value[0] ? "ON" : "OFF");
				}

				else
				{
					gDrawManager.DrawString(xx, y + (h * i), clrColor, "%0.0f", pMenu[i].value[0]);
				}
			}
		}
	}
}
void SMJS_Client::ReattachEntity(){
	auto tmp = edict->GetNetworkable();
	if(tmp != NULL){
		SetEntity(tmp->GetBaseEntity());
	}
}
EHANDLE CRPGPlayer::GetActiveWeapon()
{
	return *(EHANDLE*)((char*)GetBaseEntity() + GetOffset("CAI_BaseNPC", "m_hActiveWeapon"));
}
int CRPGPlayer::GetPlayerButtons()
{
	return *(int*)((char*)GetBaseEntity() + m_iButtonsOffset);
}