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

Refill Weapon Ammo

broken avatar :(
Created 10 years ago
by MZslayer11
0 Members and 1 Guest are viewing this topic.
1,342 views
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 7 March 2014
Last active: 14 hours ago
Posts
1,191
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Site Moderator
My Groups
More
My Contact & Social Links
More
×
MZslayer11's Groups
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
MZslayer11's Contact & Social LinksMZslayer11Service_Code_30#2655
How would I make a trigger that refills a players ammo in the gun they are holding?
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
make a new .gsc and name it ammo_buy_triggers.gsc for example. And paste this in it:


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

main()
{
ammo_trig = getentarray( "ammo_trigger", "targetname" );
array_thread(ammo_trig,::ammo_refill);
}


ammo_refill()
{
cost = 500;

self setcursorhint("HINT_NOICON");
self sethintstring("Press and Hold &&1 to refill your current weapon. Cost ["+ cost +"] ");

while(1)
{
player = undefined;

self waittill( "trigger", player );

weapon = player getcurrentweapon();
ammo_count = player GetFractionMaxAmmo( weapon );

if( player.score >= cost && ammo_count != 1 && !player maps\_laststand::player_is_in_laststand() && !isdefined( player.being_revived) ||
player.score >= cost && ammo_count != 1 && !player maps\_laststand::player_is_in_laststand() && isdefined( player.being_revived) && !player.being_revived)
{
player maps\_zombiemode_score::minus_to_player_score( cost );
player playsound( "cha_ching" );
player givemaxammo( weapon );
}

else
{
player playsound( "deny" );
}
}
}



Now go into you mapname.gsc and after this line:

Code Snippet
Plaintext
	maps\_zombiemode::main();

Put this one:

Code Snippet
Plaintext
      maps\ammo_buy_triggers::main();             //  IF YOU USED ANOTHER NAME FOR THE .GSC CHANGE IT HERE TOO!!





Now in radiant make triggers with the kvp's:

targetname - ammo_trigger





That should work..

 
Loading ...