Modme Forums
Menu:

Buyable Ammo

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: zhesslow
i need a trigger that with him can buy ammo, how?


ModmeBot:

Reply By: Blink-420
Add this to the bottom of your mapname.gsc

function MaxAmmo()
{
    trigger = GetEnt("maxammo_trigger", "targetname");
    trigger SetHintString("Press ^3&&1^7 for max ammo."); // Changes the string that shows when looking at the trigger.
    trigger SetCursorHint("HINT_NOICON"); // Changes the icon that shows when looking at the trigger.
    trigger1cost = 4500;
  
    while(1)
    {
        while(1)
        {
            // Purchase Code
            trigger waittill("trigger", player);
                 
            if(player.score >= trigger1cost)
            {
                player zm_score::minus_to_player_score(trigger1cost);
                trigger PlayLocalSound( "cha-ching" );
                break;
            }
            else
            {
                trigger PlayLocalSound( "deny" );
            }
        }
  		
		players = GetPlayers();

		for (i = 0; i < players.size; i++)
		{
			primaryWeapons = players[i] GetWeaponsList(); 
			players[i] PlayLocalSound( "maxammosnd" );	
			players[i] notify( "zmb_max_ammo" );

			for( x = 0; x < primaryWeapons.size; x++ )
			{

				players[i] GiveMaxAmmo( primaryWeapons[x] );
			}
		}

        wait(5);
    }
}



Add this to your main function

thread MaxAmmo();



and add this to your #using list at the top of your .gsc

#using scripts\zm\_zm_score;



Then place a trigger_use on your map and give it a targetname of

maxammo_trigger

Credits to Tomzen