Lol please help
#1

Guys please help :P

I want that you can do something when you push F or ENTER on your keyboard.
How does this function work?
Never did something with it. that's whyI''m asking

Thanks
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange -- The public that checks if player has pressed any buttons.
https://sampwiki.blast.hk/wiki/GetPlayerKeys -- Scroll a little bit down to see the key list.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SECONDARY_ATTACK) // KEY_SECONDARY_ATTACK is enter/f.
    {
        SendClientMessage(playerid,0x00FFFFFF,"You have pressed enter!");
    }
    return 1;
}
Reply
#3

Second way:
1. Check all the time if player is using this key, for example, KEY_FIRE (likely to be ctrl), keys differ onfoot/invehicle
Forkilling=SetTimer("Function'sName", from 200 till 500, Repeat most likely 1);
pawn Код:
public FunctionsName(playerid, keys, updown, leftright)
{
    new keys, updown, leftright;
    GetPlayerKeys(playerid, keys, updown, leftright);
    if(keys&KEY_FIRE) OR if(keys==KEY_FIRE)
    {
        //ToDo
        if(DoneAll) KillTimer(Forkilling);
    }
}
Reply
#4

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

EDIT:i was making topic,so didnt see before me ppl posted sry
Reply
#5

Ye thanks guys :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)