UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

How to add buyable max ammo

broken avatar :(
Created 8 years ago
by Blink-420
0 Members and 1 Guest are viewing this topic.
3,450 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 18 February 2015
Last active: 2 months ago
Posts
63
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
Blink-420's Groups
Blink-420's Contact & Social LinksBlink-420
My map is in need of max ammo that is buyable..I tried a few old World at War scripts but couldn't seem to get any of them working..please help!
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 27 December 2014
Last active: 4 years ago
Posts
13
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
Tomzen's Groups
Tomzen's Contact & Social Links
I have a script at home, if you wait till 3 my time. (it's 12:58 right now) I'll PM it to you when I'm home.

Double Post Merge: October 11, 2016, 09:16:52 am
I might as well share it here:

Code Snippet
Plaintext
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 a trigger to your map with the targetname "maxammo_trigger"
Last Edit: October 11, 2016, 09:16:52 am by Tomzen
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 18 February 2015
Last active: 2 months ago
Posts
63
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
Blink-420's Groups
Blink-420's Contact & Social LinksBlink-420
I have a script at home, if you wait till 3 my time. (it's 12:58 right now) I'll PM it to you when I'm home.

Double Post Merge: October 11, 2016, 09:16:52 am
I might as well share it here:

Code Snippet
Plaintext
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 a trigger to your map with the targetname "maxammo_trigger"

I'm getting this error, any ideas? I added the script to the bottom of my mapname.gsc and did "level thread MaxAmmo(); under the main.


UNRECOVERABLE ERROR:
  ^1SCRIPT ERROR: No generated data for 'scripts/zm/zm_kfc3.gsc'
ERR(6E) scripts/zm/zm_kfc3.gsc (355,1)  : Compiler Internal Error :  Unresolved external 'zm_score::minus_to_player_score'
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 27 December 2014
Last active: 4 years ago
Posts
13
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
Tomzen's Groups
Tomzen's Contact & Social Links
Oh yeah, sorry you have to also add this with the others:

Code Snippet
Plaintext
#using scripts\zm\_zm_score;

 
Loading ...