SA-MP Forums Archive
getplayerkeys - 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)
+--- Thread: getplayerkeys (/showthread.php?tid=513245)



getplayerkeys - iBots - 15.05.2014

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?


Re: getplayerkeys - Parallex - 15.05.2014

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)



Re: getplayerkeys - iBots - 15.05.2014

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...


Re: getplayerkeys - Parallex - 15.05.2014

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.^


Re: getplayerkeys - iBots - 15.05.2014

...i wanna detect key fire not these keys