SA-MP Forums Archive
When a player left clicks? - 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: When a player left clicks? (/showthread.php?tid=162091)



When a player left clicks? - VictorMartinez - 22.07.2010

ok so i just want the basic code for when a player left clicks, right clicks, and middle mouse buttons. I know how to script and all but i've never used player buttons. If theres a wiki please post link b/c i have no idea what i'm even looking for. Thanks.


Re: When a player left clicks? - Lorenc_ - 22.07.2010

This? https://sampwiki.blast.hk/wiki/GetPlayerKeys


Re: When a player left clicks? - VictorMartinez - 22.07.2010

well i read that and I might use that sometime, but like here... something simple. How do i make it to where when a player left clicks his health gets set to 0 using SetPlayerHealth(playerid,0); like i don't know if there's a OnPlayerLeftClick(playerid) callback or something like it.


Re: When a player left clicks? - Lorenc_ - 22.07.2010

I dont think u can get a callback to get the persons Left Click


Re: When a player left clicks? - ettans - 22.07.2010

Your best chance would be to check KEY_FIRE (I'm sure most people use left mouse button for it).

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
        SetPlayerHealth(playerid,0.0);
    return 1;
}



Re: When a player left clicks? - (SF)Noobanatior - 22.07.2010

there is OnPlayerClickPlayer but it only works for the score board witch is source 0


Re: When a player left clicks? - VictorMartinez - 22.07.2010

Ettans, is there a list on wiki that shows all the keys?


Re: When a player left clicks? - (SF)Noobanatior - 22.07.2010

look in a_samp.inc in the include folder

#define KEY_....


Re: When a player left clicks? - VictorMartinez - 22.07.2010

u can't i'm on my windows phone and i forgot to put pawno on there


Re: When a player left clicks? - VictorMartinez - 22.07.2010

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
        OnPlayerLeftClick(playerid);
    return 1;
}
yaaay i got what i needed and thanks noobinator for the list