01.08.2017, 08:44
Hi all, i'm newbie, i have one server ( zombie survival ) i want to press E to loot item in the road, but how to do it ?
Any One Can Help Me ? Pleasee
Any One Can Help Me ? Pleasee
public OnPlayerKeyStatChange(playerid, oldkeys, newkeys)
{
if ((newkeys & KEY_YES) && !(oldkeys & KEY_YES))
{
//some action here
}
return 1;
}
With E you can't because you use that key to switch weapons
You can do with Y PHP код:
|
SA:MP can't detect when a player press 'E', it can only detect when he press a game key.
For example: Let's say I set my game to jump on SHIFT and sprint on SPACE (which is deafult) and X set his game to jump on SPACE and sprint on SHIFT. Ok, now when i jump I press SHIFT; and when X jumps he press SPACE, but we will both be detected by the server that they pressed 'KEY_JUMP'. So you can't say that all players will jump on SHIFT or sprint on SPACE. Here is a link to all keys that can be detected and their default value (which can be changed in game by players) https://sampwiki.blast.hk/wiki/Keys Unfortunately, there is no default key for 'E' (unless in vehicle), but you can detect when a player press 'C' (KEY_CROUCH); Left alt (KEY_WALK), 'Y' (KEY_YES), 'N' (KEY_NO), etc. |