FS Press Keybroad - 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: FS Press Keybroad (
/showthread.php?tid=638472)
FS Press Keybroad -
Hiei - 01.08.2017
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
Re: FS Press Keybroad -
C4rtm4n - 01.08.2017
Hello,See Topic In Wiki
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Re: FS Press Keybroad -
Arbico - 01.08.2017
With E you can't because you use that key to switch weapons
You can do with Y
PHP код:
public OnPlayerKeyStatChange(playerid, oldkeys, newkeys)
{
if ((newkeys & KEY_YES) && !(oldkeys & KEY_YES))
{
//some action here
}
return 1;
}
Rep+ If i helped
Re: FS Press Keybroad -
GaByM - 01.08.2017
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.
Re: FS Press Keybroad -
Hiei - 01.08.2017
Quote:
Originally Posted by Arbico
With E you can't because you use that key to switch weapons
You can do with Y
PHP код:
public OnPlayerKeyStatChange(playerid, oldkeys, newkeys)
{
if ((newkeys & KEY_YES) && !(oldkeys & KEY_YES))
{
//some action here
}
return 1;
}
Rep+ If i helped
|
Quote:
Originally Posted by GaByM
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.
|
Thanks ! it work, so, can you help me how to create file .SQL and config game mode to it ?
Re: FS Press Keybroad -
Hiei - 01.08.2017
Quote:
Originally Posted by Arbico
With E you can't because you use that key to switch weapons
You can do with Y
PHP код:
public OnPlayerKeyStatChange(playerid, oldkeys, newkeys)
{
if ((newkeys & KEY_YES) && !(oldkeys & KEY_YES))
{
//some action here
}
return 1;
}
Rep+ If i helped
|
It Work ! thanks