AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   melee weapon in incapable (https://forums.alliedmods.net/showthread.php?t=331553)

Gold Fish 03-25-2021 18:50

melee weapon in incapable
 
How do I find out a melee weapon when a player is incapacitated?

Psyk0tik 03-25-2021 19:55

Re: melee weapon in incapable
 
Here's how I do it in my Mutant Tanks plugin:
PHP Code:

char sWeapon[32];
int iSlot 0;
if (
GetEntProp(survivorProp_Send"m_isIncapacitated"1) == || GetEntProp(survivorProp_Send"m_isHangingFromLedge") == 1// Only check if player is incapacitated or hanging from ledge.
{
    
int iOffset g_bLinux 16320 16340// Offsets found in: CTerrorPlayer::OnIncapacitatedAsSurvivor(CTakeDamageInfo const&)
        
iMelee GetEntDataEnt2(survivoriOffset);

    switch (
IsValidEntity(iMelee))
    {
        case 
trueiSlot iMelee;
        case 
falseiSlot GetPlayerWeaponSlot(survivor1);
    }
}
else
{
    
iSlot GetPlayerWeaponSlot(survivor1);
}

if (
iSlot MaxClients)
{
    
GetEntityClassname(iSlotsWeaponsizeof(sWeapon));
    if (
StrEqual(sWeapon"weapon_melee"))
    {
        
GetEntPropString(iSlotProp_Data"m_strMapSetScriptName"sWeaponsizeof(sWeapon)); // Get the melee weapon's script name.
    
}




All times are GMT -4. The time now is 23:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.