0 Members and 1 Guest are viewing this topic.
procedure SetWeaponActive(ID, WeaponNum: byte; State: boolean);begin SetWeaponActive(0,1,false); SetWeaponActive(0,2,false); SetWeaponActive(0,3,false);end;
procedure RestrictWeapons();begin SetWeaponActive(0,1,false); SetWeaponActive(0,2,false); SetWeaponActive(0,3,false);end;
ie just try this: Code: [Select]procedure RestrictWeapons();begin SetWeaponActive(0,1,false); SetWeaponActive(0,2,false); SetWeaponActive(0,3,false);end;and call this RestrictWeapons() procedure in onweaponchange or wherever you want it to be called
procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);begin RestrictWeapons;end;procedure RestrictWeapons();begin SetWeaponActive(0,1,false); SetWeaponActive(0,2,false); SetWeaponActive(0,3,false);end;
vari: Integer;procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);begin RestrictWeapons;end;procedure RestrictWeapons();begin for i := 1 to 3 do SetWeaponActive(0,i,false);end;
Quote from: miketh2005 on July 10, 2009, 07:31:20 pmDonate to enesceHAHAHAHAHAHAHA
Donate to enesce
place that procedure above OnWeaponChange
Quote from: danmer on June 23, 2009, 04:01:52 pmplace that procedure above OnWeaponChangeThank you it works now!--Edit--But how can we disable when player join?
But since you disable the weapons for everyone (ID 0), i'd just put it in activateserver
Then I'd change soldat.ini
procedure Activateserver;var i: Integer;begin for i := 1 to 3 do //Might wanna change to 10? SetWeaponActive(0,i,false);end;procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);begin If GetPlayerStat(Killer,'Kills') > 1 then SetWeaponActive(0,1,true); If GetPlayerStat(Killer,'Kills') > 2 then SetWeaponActive(0,2,true); //etc. etc, i suggest using ">", if its used on CTF modeend;
then tell us exactly what you want and we'll tell you how, or we'll make it.
Quote from: ~Niko~ on June 24, 2009, 06:29:21 amthen tell us exactly what you want and we'll tell you how, or we'll make it.What I want is all weapons to be disabled beside the first gun. When they get 10 kills, first gun is disabled and the second gun is enabled then next gun then .etc.
vari, b: Integer;procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);begin if GetPlayerStat(Killer,'Kills') in [11..20] then begin //If kill amount is needed for i := 1 to 10 do //To call all weapons inactive SetWeaponActive(Killer,i,false); //Set all weapons inactive SetWeaponActive(Killer,2,true); //Set next weapon active end; //End block if guy has 11 to 20 kills if GetPlayerStat(Killer,'Kills') in [21..30] then begin for i := 1 to 10 do SetWeaponActive(Killer,i,false); SetWeaponActive(Killer,3,true); end; if GetPlayerStat(Killer,'Kills') in [31..40] then begin for i := 1 to 10 do SetWeaponActive(Killer,i,false); SetWeaponActive(Killer,4,true); end; if GetPlayerStat(Killer,'Kills') in [41..50] then begin for i := 1 to 10 do SetWeaponActive(Killer,i,false); SetWeaponActive(Killer,5,true); end; if GetPlayerStat(Killer,'Kills') in [51..60] then begin for i := 1 to 10 do SetWeaponActive(Killer,i,false); SetWeaponActive(Killer,6,true); end; if GetPlayerStat(Killer,'Kills') in [61..70] then begin for i := 1 to 10 do SetWeaponActive(Killer,i,false); SetWeaponActive(Killer,7,true); end;end;//Damn this turned out in a huge code... fix anyone?procedure OnJoinTeam(ID, Team: byte);beginfor b := 2 to 10 doSetWeaponActive(ID,b,false);end;
Quote from: koolazngy94 on June 24, 2009, 12:28:12 pmQuote from: ~Niko~ on June 24, 2009, 06:29:21 amthen tell us exactly what you want and we'll tell you how, or we'll make it.What I want is all weapons to be disabled beside the first gun. When they get 10 kills, first gun is disabled and the second gun is enabled then next gun then .etc.k, ill do it.EDIT: this huge code should do the trick, but it seems that in doesn't works for soldat...Code: (Pascal) [Select]vari, b: Integer;procedure OnPlayerKill(Killer, Victim: byte;Weapon: string);begin if GetPlayerStat(Killer,'Kills') in [11..20] then begin //If kill amount is needed for i := 1 to 10 do //To call all weapons inactive SetWeaponActive(Killer,i,false); //Set all weapons inactive SetWeaponActive(Killer,2,true); //Set next weapon active end; //End block if guy has 11 to 20 kills if GetPlayerStat(Killer,'Kills') in [21..30] then begin for i := 1 to 10 do SetWeaponActive(Killer,i,false); SetWeaponActive(Killer,3,true); end; if GetPlayerStat(Killer,'Kills') in [31..40] then begin for i := 1 to 10 do SetWeaponActive(Killer,i,false); SetWeaponActive(Killer,4,true); end; if GetPlayerStat(Killer,'Kills') in [41..50] then begin for i := 1 to 10 do SetWeaponActive(Killer,i,false); SetWeaponActive(Killer,5,true); end; if GetPlayerStat(Killer,'Kills') in [51..60] then begin for i := 1 to 10 do SetWeaponActive(Killer,i,false); SetWeaponActive(Killer,6,true); end; if GetPlayerStat(Killer,'Kills') in [61..70] then begin for i := 1 to 10 do SetWeaponActive(Killer,i,false); SetWeaponActive(Killer,7,true); end;end;//Damn this turned out in a huge code... fix anyone?procedure OnJoinTeam(ID, Team: byte);beginfor b := 2 to 10 doSetWeaponActive(ID,b,false);end;
That is alot. One question tho, what you mean [51..60]?
function WithinInt(const Value, Low, High: integer): boolean;begin Result := (Value >= Low) and (Value <= High);end;
const Kills4Weap=2;procedure SetWeapons(ID: byte);var i: byte;begin for i:= 1 to 10 do SetWeaponActive(ID,i,false); SetWeaponActive(ID, (((GetPlayerStat(ID,'Kills') div Kills4Weap) mod 10) + 1), true);end;