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

Buyable Max Ammo(Single Only)

broken avatar :(
Created 10 years ago
by daedra descent
0 Members and 1 Guest are viewing this topic.
3,549 views
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Basic buyable max ammo script. Can only be used once. Has option function arguments to easily customize the trigger(Cost, wait time).

Script:

Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;

main()
{
trig = getEnt("ammo_trig", "targetname");

trig ammo_trig(); // change the function input argument here. Example: trig ammo_trig(10000, 30);
}

ammo_trig(zombie_cost, time)
{

while(1)
{

if(!isdefined(zombie_cost) )
{
zombie_cost = 1000;
}

self sethintstring("Press F to buy ammo[Cost:" + zombie_cost + "]");

players = get_players();

self waittill( "trigger", players );

self.is_available = 1;

if(players.score >= zombie_cost && self.is_available == 1)
{

players maps\_zombiemode_score::minus_to_player_score( zombie_cost );

play_sound_at_pos( "purchase", self.origin );

players give_ammo();

self.is_available = 0;

if(isdefined(time) && time > 1 )
{
wait(time);
}
else
{
wait(1);
}
}
}
}
give_ammo()
{
players = get_players();

for (i = 0; i < players.size; i++)
{
player_weapons = self GetWeaponsListPrimaries();

for( x = 0; x < player_weapons.size; x++ )
{
self GiveMaxAmmo( player_weapons[x] );
}
}
}

Example of a proper argument set:

Code Snippet
Plaintext
trig ammo_trig(10000, 30);

The input "10000" represents the cost(zombie_cost), while the 30 represents the time(in seconds) before the trigger will allow the players to buy it again. Neither function arguments take a variable unless it is declared a number.
Last Edit: March 25, 2014, 01:20:17 am by daedra descent
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
lol you forgot to specify some things and the values inside the that runs
Code Snippet
Plaintext
trig ammo_trig();
like
Code Snippet
Plaintext
trig ammo_trig(10000, 10);
you should comment there that they only have to change those values to whatever they want and script will do the rest
Last Edit: March 25, 2014, 12:41:43 am by jjbradman
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
lol you forgot to specify some things and the values inside the that runs
Code Snippet
Plaintext
trig ammo_trig();
like
Code Snippet
Plaintext
trig ammo_trig(10000, 10);
you should comment there that they only have to change those values to whatever they want and script will do the rest

Added. Also added an explanation to first post to make it easier to understand. Hopefully it'll make a bit more sense.  ;D

 
Loading ...