getplayerkeys
#1

i am making an anti cbug,is there any way to detect it only if player shoots a player or a car?like if i shoot the air it doesnt do anything,if i shoot play it does the effect,how?
Reply
#2

I think the only Callback for the one you are asking is
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
Well, It works when a player shoots, doesn't matter if it hit anything/anyone.

Maybe, these callbacks can help you:
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
And

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
Reply
#3

i know,i am trying to use OnPlayerWeaponShot,i detected if the shooted thing is player,but how can i use the same keys,i mean how to detect the keys?because i am detecting them using OnPlayerKeyStateChange,how can i use newkeys and oldkeys in OnPlayerWeaponShot?or...
Reply
#4

An Example:
pawn Код:
public OnPlayerUpdate(playerid)
{
    new Keys,ud,lr;
    GetPlayerKeys(playerid,Keys,ud,lr);
 
    if(ud == KEY_UP) SendClientMessage(playerid, -1, "UP");
    else if(ud == KEY_DOWN) SendClientMessage(playerid, -1, "DOWN");
 
    if(lr == KEY_LEFT) SendClientMessage(playerid, -1, "LEFT");
    else if(lr == KEY_RIGHT) SendClientMessage(playerid, -1, "RIGHT");
 
    return 1;
}
Taken from the SA-MP Wiki.^
Reply
#5

...i wanna detect key fire not these keys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)