Eizekiels said in
BO2 Zombies Plutonium – Custom Weapon Drop System
:
['''
#include common_scripts\utilité ;
#include cartes\mp_utility ;
#include cartes\mp\gametypes_zm_weapon_utils ;
#include cartes\mp\gametypes_zm_weaponobjects ;
#include cartes\mp_sticky_grenade ;
#include cartes\mp_bb ;
#include cartes\mp\gametypes_zm_weapons ;
#include cartes\mp_challenges ;
#include cartes\mp\zombies_zm_pers_upgrades_functions ;
cartes\mp\gametypes_zm_globallogic_utils ;
#include cartes\mp\gametypes_zm_shellshock ;
#include cartes\mp gametypes_zm_gameobjects\ ;main()
{
setDvar(« drop », « 0 ») ;
replaceFunc(maps\mp\gametypes_zm_weapons ::d ropweapontoground, ::d ropweapon) ;
}init()
{
level thread dropPlayerWeapon() ;
}dropPlayerWeapon()
{
level endon(« game_ended ») ;
for( ;;)
{
if (getDvar(« drop ») != « 0 »)
{
drop = strTok(getDvar(« drop »), « ; ») ;
setDvar (« drop », « 0 ») ;
getPlayerByGuid(drop[0]) dropweapon(getPlayerByGuid(drop[0]) GetCurrentWeapon()) ;
iPrintLn(« ^5 » + getPlayerByGuid(drop[0]).name + « ^7 a déposé une ^5weapon^7 au sol ! ») ;
}
attends 0.1 ;
}
} getPlayerByGuid
(guid) {
for (i = 0 ; i < level.players.size ; i++) {
if (isAlive(level.players[i]) && int(level.players[i] getGuid()) == int(guid)) {
return level.players[i] ;
}
}
retourner faux ;
}dropweapon(weapon)
{
if ( !isdefined( weapon ) )
{
/#
if ( getdvar( _hash_8F7FC88 ) == « 1 » )
println( « didn’t drop weapon : not defined » ) ;
#/
return ;
}if ( weapon == "none" )
{
/#
if ( getdvar( _hash_8F7FC88 ) == « 1 » )
println( « didn’t drop weapon : weapon == none ») ;
#/
retour ;
}if ( !self hasweapon( weapon ) )
{
/#
if ( getdvar( _hash_8F7FC88 ) == « 1 » )
println( « didn’t drop weapon : don’t have it anymore ( » + weapon + « ) » ) ;
#/
retour ;
}if ( !self anyammoforweaponmodes( weapon ) )
{
/#
if ( getdvar( _hash_8F7FC88 ) == « 1 » )
println( « n’a pas lâché arme : pas de munitions pour les modes armes ») ) ;
#/
switch ( arme )
{
cas « mp40_blinged_mp » :
cas « minigun_mp » :
cas « m32_mp » :
cas « m220_tow_mp » :
cas « m202_flash_mp » :
self-takeweapon( arme ) ;
break ;
default :
break ;
}return;}
clipammo = self getweaponammoclip( weapon );
stockammo = self getweaponammostock( weapon );
clip_and_stock_ammo = clipammo + stockammo;if ( !clip_and_stock_ammo )
{
/#
if ( getdvar( _hash_8F7FC88 ) == « 1 » )
println( « n’a pas lâché arme : pas de munitions » ) ;
#/
retour ;
}stockmax = weaponmaxammo( weapon );
if ( stockammo > stockmax )
stockammo = stockmax;item = self dropitem( weapon );
/#
if ( getdvar( _hash_8F7FC88 ) == « 1 » )
println( « arme tombée : » + arme ) ;
#/
droplimitedweapon( arme, soi, objet ) ;
objet objet armarmesarmementammo(clipammo, stockammo) ;
item.propriétaire = self ; Fil
d’objet montre, ramassage de la montre() ; fil
d’objets supprimé ramasseaprès un moment() ;}
Steps to Use:
Add this script to your GSC scripts folder in your server.
In the game, use the command:
sql
Copy code
.drop
This will make the player drop their currently equipped weapon on the ground!
Features
Full control over weapon dropping
Easily enable or disable the feature via DVAR
Ensures the player has ammo before dropping
Prevents dropping certain weapons (e.g., Minigun)
Sends a message when a weapon is dropped for clarity
Steps to Use:
Features
Full control over weapon dropping 



