Hey!
I'm trying to make an Elite vs Predators server (snipers vs predatored knifers).
The elite (bravo) are only allowed to use barret with any secondary. If they pick something else than barret it will be switched automatically to it. Also, they're not allowed to pick up snipers which will be automatically switched to knives.
The predators are only allowed to use knife and chainsaws; whatever primary they use it will be switched to hands and their only weapon will be knife or chainsaw.
The problem I'm having is that my script for the barret keeps crashing my server in the form of kicking me for flood kick. Here's a failed code I use for a reference which enters an infinite loop when I switch to my secondary which also turns into a barret. The script is only for the bravos/elites here 'cause that's the one causing me problems:
procedure OnJoinTeam(Id, Team: byte);
begin
if Team = 2 then begin
ForceWeapon( Id, 8, GetPlayerStat(Id, 'Secondary'), 0 );
end;
end;
procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: Byte);
begin
if GetPlayerStat(ID, 'Team') = 2 then begin
if GetPlayerStat(ID, 'Secondary') <> 8
then begin
ForceWeapon( ID, 8, GetPlayerStat(Id, 'Secondary'), 0 );
end;
end;