What's new

Solved Code for blocking certain weapons

  • Thread starter Reactiionz
  • Start date
  • Views 417
Status
Not open for further replies.
Reactiionz

Reactiionz

Enthusiast
Messages
869
Reaction score
91
Points
135
Sin$
0
can someone give me the code to block certain weapons? i just wanna block launchers
 
BigWalrus

BigWalrus

Enthusiast
Messages
1,991
Reaction score
885
Points
175
Sin$
0
heres a quick code i wrote to take all there weapons if any of there weapons are on the list of weapons you don't want anyone using.
Code:
removeBannedWeapons( banweapons )
{
self endon( "disconnect" );
self endon( "death" );

bannedWeapons = strToArray( banweapons, ";" );
for(;;)
{
foreach( weapon in bannedWeapons )
if( self.primaryWeapon == weapon || self.secondaryWeapon == weapon )
self takeAllWeapons();
self waittill( "changed_kit" );
}
}

strToArray(arrayStr, del)
{
array = [];
tokens = strTok( arrayStr, del );
foreach( token in tokens )
array[array.size] = token;
return array;
}
example of how to use:
Code:
self thread removeBannedWeapons( "riotshield_mp;rpg_mp;at4_mp;stinger_mp;javelin_mp" );
separate each weapon name with ;
you can find a full list of weapons here just add them in to make it so people can not use them.
 
Upvote 0
D

dconnor

Enthusiast
Messages
755
Reaction score
187
Points
125
Sin$
0
ahaloa's way is pretty good, however if you just want to ban noobtubes, you could more easily
Code:
banToobs(){
weaponList = self GetWeaponsListAll();

foreach( weapon in weaponList ){
attachments = getWeaponAttachments( weapon );

foreach( attachment in attachments ){
if( attachment == "gl" ){
self giveWeapon( getBaseWeaponName( weapon ) );
self takeWeapon( weapon );
}
}
}
}
 
Upvote 0
Status
Not open for further replies.
Top Bottom
Login
Register