Modify plugin

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
86
Реакции
2
Hi. I would like if anyone can help me with modifying this plugin. I am using it for a respawn server to respawn with weapon in hand, only the plugin only puts you slot1, not the last weapon used. I would like to respawn to give you the last weapon in your hand (ak, m4, awp, deagle), that is what you had in your hand when you died.

Код:
#include <amxmodx>
#include <hamsandwich>
#include <fun>

#pragma semicolon 1

#define MAX_PLAYERS 32

enum WeaponsData
{
    WEAPONS[32],
    NUM
}

new g_eWeapons[ MAX_PLAYERS + 1 ][WeaponsData];

public plugin_init( ) 
{
    register_plugin( "Save Weapons On Death", "1.0a", "maqi" );
    
    RegisterHam( Ham_Killed, "player", "Event_HamKilledPre", 0 );
    RegisterHam( Ham_Spawn, "player", "Event_PlayerSpawnPost", 1 );
}

public client_connect( iIndex )
    g_eWeapons[iIndex][NUM] = 0;

public Event_HamKilledPre( iIndex )
{
    new iWeapons[32];
    
    get_user_weapons( iIndex, iWeapons, g_eWeapons[iIndex][NUM] );
    
    g_eWeapons[iIndex][WEAPONS] = iWeapons;
    
    return HAM_IGNORED;
}

public Event_PlayerSpawnPost( iIndex )
{
    new sWeapon[32];
    
    for( new i = 0; i < g_eWeapons[iIndex][NUM]; i++ )
    {
        get_weaponname( g_eWeapons[iIndex][WEAPONS][i], sWeapon, charsmax(sWeapon) );
        give_item( iIndex, sWeapon );
    }
    
    g_eWeapons[iIndex][NUM] = 0;

    return HAM_IGNORED;
}
 

Ayk

Сообщения
763
Реакции
476
Помог
19 раз(а)
claudiuandrei10,

  • В данном разделе размещаются темы, в которых требуется помощь с доработкой или объяснением материала.
    В теме должны быть опубликованы попытки (diff кода или последовательность действий) самостоятельного поиска решения.
    Если у вас нет наработок и попыток самому вникнуть в проблему, тогда вам в раздел "Покупка"
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу