What's new

Solved Code for blocking certain weapons

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

Reactiionz

Enthusiast
Messages
869
Reaction score
91
can someone give me the code to block certain weapons? i just wanna block launchers
 
demon dylan

demon dylan

Enthusiast
Messages
1,409
Reaction score
179
never heard of it
 
BigWalrus

BigWalrus

Enthusiast
Messages
1,991
Reaction score
885
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.
 
demon dylan

demon dylan

Enthusiast
Messages
1,409
Reaction score
179
nice code never knew about it
 
D

dconnor

Enthusiast
Messages
755
Reaction score
187
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 );
}
}
}
}
 
Status
Not open for further replies.
Top Bottom