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

Give weapon to all players

broken avatar :(
Created 7 years ago
by ihmiskeho
0 Members and 1 Guest are viewing this topic.
2,119 views
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 2 January 2015
Last active: 3 years ago
Posts
125
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
Signature
Beginner mapper trying to make something for the community to enjoy
×
ihmiskeho's Groups
ihmiskeho's Contact & Social Linksihmiskeho
So I want to give a certain weapon to every player. Is it possible and if it is, how would I do it?

Thanks in advance!
Marked as best answer by ihmiskeho 7 years ago
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 3 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
respect the dead

donates greatly appreciated :) paypal.me/F3ARxReaper666
discord server:
https://discord.gg/tsGHW99
×
death_reaper0's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
So I want to give a certain weapon to every player. Is it possible and if it is, how would I do it?

Thanks in advance!

Code Snippet
Plaintext
players = get_players();
for ( i = 0; i < players.size; i++ )
{
players[i] GiveWeapon( weapon, );
players[i] GiveMaxAmmo( weapon );
players[i] SwitchToWeapon( weapon );

}

obviously replacing weapon with the weapon name inside of " " eg    players GiveWeapon( "weapon_name" );
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 2 January 2015
Last active: 3 years ago
Posts
125
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
ihmiskeho's Groups
ihmiskeho's Contact & Social Linksihmiskeho
Code Snippet
Plaintext
players = get_players();
for ( i = 0; i < players.size; i++ )
{
players[i] GiveWeapon( weapon, );
players[i] GiveMaxAmmo( weapon );
players[i] SwitchToWeapon( weapon );

}

obviously replacing weapon with the weapon name inside of " " eg    players GiveWeapon( "weapon_name" );

Thanks! This was the way I tried doing it first but it didn't work.
Later I noticed that i forgot this line from the script :poker:
Code Snippet
Plaintext
players[i] SwitchToWeapon( weapon );
But everything works now. Thanks for the reply!
broken avatar :(
×
broken avatar :(
Location: aupotato
Date Registered: 27 September 2013
Last active: 3 years ago
Posts
588
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
×
death_reaper0's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
if you didnt put that line in, the player will still have the gun and stuff, they just wont automatically switch to it
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 2 January 2015
Last active: 3 years ago
Posts
125
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
ihmiskeho's Groups
ihmiskeho's Contact & Social Linksihmiskeho
if you didnt put that line in, the player will still have the gun and stuff, they just wont automatically switch to it

True but my script also disables weapon cycling so I couldn't check that.

 
Loading ...