别人发的据说无限子弹
#include <amxmodx>
#include <fakemeta>
#include <fun>
public plugin_init() {
register_plugin("Auto Full Ammo After Kill", "1.0", "kakke");
// Register the event for player kill
register_event("DeathMsg", "on_player_kill", "a", "1=0", "2=1");
}
public on_player_kill() {
// Loop through all players to check who killed someone
for (new i = 1; i <= get_maxplayers(); i++) {
if (is_user_connected(i)) {
// Check if player has just killed someone
if (get_user_health(i) > 0 && is_user_alive(i)) {
// Give the player full ammo for their current weapon
give_full_ammo(i);
}
}
}
}
public give_full_ammo(player) {
// Get the current weapon of the player
new weapon = get_user_weapon(player);
// Give the player max ammo for the weapon they are holding
if (weapon == CSW_KNIFE) {
// Knives don't use ammo, no action needed
return;
}
// Set max ammo for the player
new ammo_count = get_weapon_ammo(weapon);
set_user_ammo(player, ammo_count);
}
// Function to get the ammo count for the weapon
public get_weapon_ammo(weapon) {
switch (weapon) {
case CSW_AK47: return 90; // 90 bullets for AK47
case CSW_M4A1: return 90; // 90 bullets for M4A1
case CSW_DEAGLE: return 7; // 7 bullets for Desert Eagle
case CSW_P90: return 50; // 50 bullets for P90
case CSW_USP: return 12; // 12 bullets for USP
case CSW_XM1014: return 8; // 8 shells for XM1014
case CSW_MAC10: return 30; // 30 bullets for MAC10
case CSW_UMP45: return 25; // 25 bullets for UMP45
case CSW_GLOCK18: return 20; // 20 bullets for Glock18
case CSW_AWP: return 10; // 10 bullets for AWP
case CSW_FAMAS: return 90; // 90 bullets for FAMAS
case CSW_SG552: return 90; // 90 bullets for SG552
case CSW_GALIL: return 35; // 35 bullets for Galil
case CSW_ELITE: return 30; // 30 bullets for Dual Elites
case CSW_FIVESEVEN: return 20; // 20 bullets for Five-Seven
case CSW_P250: return 13; // 13 bullets for P250
case CSW_CZ75AUTO: return 20; // 20 bullets for CZ75
case CSW_AUG: return 90; // 90 bullets for AUG
case CSW_SG550: return 10; // 10