When a player left clicks?
#1

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.
Reply
#2

This? https://sampwiki.blast.hk/wiki/GetPlayerKeys
Reply
#3

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.
Reply
#4

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

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;
}
Reply
#6

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

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

look in a_samp.inc in the include folder

#define KEY_....
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)