Killable Cows - Problem #2
#2

The first thing that struck me when I looked through your script was the check to see whether a player is firing his gun in the OnPlayerKeyStateChange callback:
pawn Код:
if(newkeys == KEY_FIRE && GetPlayerWeapon(playerid) != 0 && IsPlayerSpawned[playerid] == true)
The first check (newkeys == KEY_FIRE) will pass if the player is pressing the "fire" key and nothing else. This is a problem as most people will also be holding down the "aim" key too. You need to do a bitwise AND (&) check instead of a logical AND (==) check. Change that line to:
pawn Код:
if(newkeys & KEY_FIRE && GetPlayerWeapon(playerid) != 0 && IsPlayerSpawned[playerid] == true)
As for the rest of the code, it's looking pretty nice. Although honestly I haven't quite got my head around the maths for the "has the player shot a cow" check. It's really interesting to go through though, so expect another reply from me later
Reply


Messages In This Thread
Killable Cows - Problem #2 - by Shadow_Gengar - 16.12.2010, 20:16
Re: Killable Cows - Problem #2 - by Benjo - 16.12.2010, 21:28
AW: Killable Cows - Problem #2 - by Shadow_Gengar - 17.12.2010, 12:13
AW: Killable Cows - Problem #2 - by Shadow_Gengar - 17.12.2010, 13:16
Re: Killable Cows - Problem #2 - by Benjo - 17.12.2010, 21:03

Forum Jump:


Users browsing this thread: 2 Guest(s)