0 Members and 2 Guests are viewing this topic.
And as the lyrics go in the United State's national anthem: "America, f**k YEAH!".
if GetPlayerStat(ID,'Human') = False then begin if (GetPlayerStat(ID,'Active') = true) then beginif (GetPlayerStat(ID,'name') = 'ZoMbIe') then begin
What's so hard to understand about "You must check whether the ID is active before you can access any other data"?
Whenever you access an ID in AppOnIdle (in general when you loop through the player list) you must check whether the ID is active (whether the ID is a player/bot on the server).
function Chance(Perc: single): boolean;beginresult := (strtofloat(inttostr(random(0,101)))/100.0 < perc);end;procedure LootAmmo(ID: byte);beginForceWeapon(ID,GetPlayerStat(ID,'primary'),GetPlayerStat(ID,'secondary'),11);end;function OnPlayerDamage(Victim,Shooter: Byte;Damage: Integer;Weapon: Byte) : integerbeginif soldier[ID].level >= 50 then beginif chance(0.1) then beginLootAmmo(Shooter);end; end;
LootAmmoChance = 10;Procedure LootAmmo(ID:Byte);var Amount,MaxAmmo:Byte;begin case GetPlayerStat(ID,'Primary') of 1: MaxAmmo := 7; 2: MaxAmmo := 30; 3: MaxAmmo := 40; 4: MaxAmmo := 25; 5: MaxAmmo := 8; 6: MaxAmmo := 4; 7: MaxAmmo := 1; 8: MaxAmmo := 10; 9: MaxAmmo := 50; 10: MaxAmmo := 100; 11: MaxAmmo := 200; 12: MaxAmmo := 1; 13: MaxAmmo := 1; 14: MaxAmmo := 1; 15: MaxAmmo := 150 16: MaxAmmo := 1; 0: MaxAmmo := 12; 255:Exit; end; if (MaxAmmo <> 1) then Amount := MaxAmmo / 10 + Random(2,6) else Amount := 0; ForceWeapon(ID,GetPlayerStat(ID,'Primary'),GetPlayerStat(ID,'Secondary'),Amount); WriteConsole(ID,'Looted: ' + IntToStr(Amount) + ' ammunition.', $FFFFFF);end;Function OnPlayerDamage(Victim,Shooter:Byte; Damage:Integer):Integer;begin Result := Damage; if (Random(1,101) <= LootAmmoChance) then LootAmmo(Shooter);end;
LootAmmoChance = 10;Procedure LootAmmo(ID:Byte);var Amount,MaxAmmo:Byte;begin case GetPlayerStat(ID,'Primary') of 1: MaxAmmo := 7; 2: MaxAmmo := 30; 3: MaxAmmo := 40; 4: MaxAmmo := 25; 5: MaxAmmo := 8; 6: MaxAmmo := 4; 7: MaxAmmo := 1; 8: MaxAmmo := 10; 9: MaxAmmo := 50; 10: MaxAmmo := 100; 11: MaxAmmo := 200; 12: MaxAmmo := 1; 13: MaxAmmo := 1; 14: MaxAmmo := 1; 15: MaxAmmo := 150 16: MaxAmmo := 1; 0: MaxAmmo := 12; 255:Exit; end; if (MaxAmmo <> 1) then begin Amount := MaxAmmo / 10 + Random(2,6) + GetPlayerStat(ID,'Ammo') if (Amount > MaxAmmo) then Amount := 0; end else Amount := 0; ForceWeapon(ID,GetPlayerStat(ID,'Primary'),GetPlayerStat(ID,'Secondary'),Amount); WriteConsole(ID,'Looted: ' + IntToStr(Amount) + ' ammunition.', $FFFFFF);end;Function OnPlayerDamage(Victim,Shooter:Byte; Damage:Integer):Integer;begin Result := Damage; if (Random(1,101) <= LootAmmoChance) then LootAmmo(Shooter);end;