SA-MP Forums Archive
just a question about keystatechange - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: just a question about keystatechange (/showthread.php?tid=163097)



just a question about keystatechange - Kar - 26.07.2010

hey. i'm Going To Make If Someone Fires A Weapon In Public There Wanted Level Goes up. what should i be using.

should i use if holding key_fire || and if released? or if pressed and holding. im confused.


Re: just a question about keystatechange - DJDhan - 26.07.2010

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
    {
        if(GetPlayerWeapon(playerid) != 0) SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+1);
    }
    return 1;
}



Re: just a question about keystatechange - Kar - 26.07.2010

getplayerweapon(playerid) != 0 detects if he fires a shot?


Re: just a question about keystatechange - ViruZZzZ_ChiLLL - 26.07.2010

Quote:
Originally Posted by Kar
Посмотреть сообщение
getplayerweapon(playerid) != 0 detects if he fires a shot?
No, it detects if the player has weapons or != 0


Re: just a question about keystatechange - Kar - 26.07.2010

thats the only way to do it?


Re: just a question about keystatechange - Kyosaur - 26.07.2010

Quote:
Originally Posted by DJDhan
Посмотреть сообщение
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
    {
        if(GetPlayerWeapon(playerid) != 0) SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+1);
    }
    return 1;
}
What if i try to parachute off of something ? What happends if im beating someone up with a parachute? What happens if i just simply hold down the fire button and spray everyone with bullets (would waste a whole clip, and only get 1 star lol) ?


Re: just a question about keystatechange - willsuckformoney - 26.07.2010

uh maybe try using GetPlayerWeapon(playerid) or something like that