Пользователь
- Сообщения
- 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;
}