int CLuaPedDefs::IsPedDead ( lua_State* luaVM ) { CPed* pPed; CScriptArgReader argStream ( luaVM ); argStream.ReadUserData ( pPed ); if ( !argStream.HasErrors () ) { lua_pushboolean ( luaVM, pPed->IsDead () ); return 1; } else m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () ); lua_pushboolean ( luaVM, false ); return 1; }
void CRPCFunctions::RequestStealthKill ( NetBitStreamInterface & bitStream ) { ElementID ID; bitStream.ReadCompressed ( ID ); CElement * pElement = CElementIDs::GetElement ( ID ); if ( pElement ) { int elementType = pElement->GetType (); if ( elementType == CElement::PLAYER || elementType == CElement::PED ) { CPed * pTarget = static_cast < CPed * > ( pElement ); // Are they both alive? if ( !m_pSourcePlayer->IsDead () && !pTarget->IsDead () ) { //Do we have any record of the killer currently having a knife? if ( m_pSourcePlayer->GetWeaponType( 1 ) == 4 ) { // Are they close enough? if ( DistanceBetweenPoints3D ( m_pSourcePlayer->GetPosition (), pTarget->GetPosition () ) <= STEALTH_KILL_RANGE ) { CLuaArguments Arguments; Arguments.PushElement ( pTarget ); if ( m_pSourcePlayer->CallEvent ( "onPlayerStealthKill", Arguments, false ) ) { // Start the stealth kill CStaticFunctionDefinitions::KillPed ( pTarget, m_pSourcePlayer, 4 /*WEAPONTYPE_KNIFE*/, 9/*BODYPART_HEAD*/, true ); } } } else { //You shouldn't be able to get here without cheating to get a knife. if ( !g_pGame->GetConfig ()->IsDisableAC ( "2" ) ) { CStaticFunctionDefinitions::KickPlayer ( m_pSourcePlayer, NULL, "AC #2: You were kicked from the game" ); } } } } } }