14.01.2013, 17:47
Quote:
I don't quite understand what is SetPlayerListenKeyFrequency?
|
Yes, but only server-side. SetPlayerListenKeyFrequency make safe traffic.
Quote:
You can see by function name, that SetPlayerListenKeyFrequency wouldn't somehow related with spam. I'm sure he meant something like SetPlayerKeyboardListenRate, I'm not sure how to explain it, with easy words it would be like how many characters can be wrote by just holding a key.
|
Why not? I explained this:
pawn Код:
native SetPlayerListenKeyFrequency(playerid, counts, pertime) - Available Frequency (counts per time).
// Example: SetPlayerListenKeyFrequency(playerid, 10, 5000); 10 count of push in 5 seconds Available. (Other Client must NOT SENDING TO SERVER) - (and server must protect if client not follow this rule, disconnect (scriptable or in code samp-server)).
native SetPlayerListenKey(playerid, keycode, bool:toggle) - return true or false.
// Example: SetPlayerListenKey(playerid, KEY_CODE_ENTER, true);
native GetPlayerListenedKey(playerid, keycode) - return true or false
// Example: GetPlayerListenedKey(playerid, KEY_CODE_ENTER); Should return TRUE if key is down.
public OnListenedKeyResponse(playerid, keycode, updown);
///////////////////////////////////////////////////////////////////////////
// Example script:
public OnPlayerConnect(playerid) {
SetPlayerListenKeyFrequency(playerid, 10, 5000);
SetPlayerListenKey(playerid, KEY_CODE_ENTER, true);
SetPlayerListenKey(playerid, KEY_CODE_F12, true);
}
public OnListenedKeyResponse(playerid, keycode, isdown) {
if(keycode == KEY_CODE_ENTER && isdown) { // DOWN
// Show dialog text "You Pushed ENTER"
} else if(keycode == KEY_CODE_F12) {
if(isdown) { // DOWN
// SHOW TEXTDRAW (CLOCK - TIME)
// Send Chat, like: /me looked watch
// Aply animation (see on clock (hand))
} else { // UP
// HIDE TEXTDRAW (CLOCK - TIME)
// CLEAR animation (see on clock (hand))
}
}
}
///////////////////////////////////////////////////////////////////////////