When you drop... the knife?
There's the quick and dirty solution that'll spawn a knife at the player any time he throws a weapon out (not only knives):
procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: Byte);
begin
if PrimaryNum=255 then
SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),12);
end;
Another way would be to temporarily store the current Primary and Secondary weapon of the player in an array and then check if the player had a knife equipped when he loses his current weapon.
Something along the lines of this:
var
player_primary,player_secondary: array[1..32] of byte;
procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: Byte);
begin
if (PrimaryNum=255) and (player_primary[ID]=12) then
SpawnObject(GetPlayerStat(ID,'x'),GetPlayerStat(ID,'y'),12);
player_primary[ID]:=PrimaryNum;
player_secondary[ID]:=SecondaryNum;
end;
And another piece of advice. Since you spawn the knife at the player's current position I assume you want him to pick that knife up immediately when he loses it (=infinite knives?). Instead of spawning the knife object you could just use ForceWeapon:
procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: Byte);
begin
if PrimaryNum=255 then
ForceWeapon(ID,12,12,0);
end;
That piece of code would equip the player with two knives whenever he'd throw out a weapon. Don't know if that's what you asked for, but meh.