anti ping freeze player
#1

-removed- -----------
Reply
#2

When using const, it means that it cannot be modified. Besides that, when not setting a size for your string, its size becomes 46 in your case but a name can be up to 24 characters and ping can be a 3-digit or 4-digit number so it will be cut.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
When using const, it means that it cannot be modified. Besides that, when not setting a size for your string, its size becomes 46 in your case but a name can be up to 24 characters and ping can be a 3-digit or 4-digit number so it will be cut.
Код HTML:
fmt_str[46]
edit:
is this the right section where people can improve the script?
Reply
#4

Quote:
Originally Posted by billy1337samp
Посмотреть сообщение
Код HTML:
fmt_str[46]
edit:
is this the right section where people can improve the script?
Yeah.

By the way, Here is the code....

PHP код:
#define MAX_PING 15 //This is the max ping, you need to change it.
public OnPlayerUpdate(playerid) {
    if(
GetPlayerPing(playerid) > 15) {
        
//Do some stuff here.
    
}
    return 
1;

Reply
#5

Quote:
Originally Posted by Arbico
Посмотреть сообщение
Yeah.

By the way, Here is the code....

PHP код:
#define MAX_PING 15 //This is the max ping, you need to change it.
public OnPlayerUpdate(playerid) {
    if(
GetPlayerPing(playerid) > 15) {
        
//Do some stuff here.
    
}
    return 
1;

SORRY, i know i needed help but i spotted a mistake (incase anyone else wants to use that code)
he did
Код:
> 15
so
Код:
#define MAX_PING
is useless unless you write
Код:
> MAX_PING
This is how the code should look like:
PHP код:
#define MAX_PING 15
public OnPlayerUpdate(playerid) {
    if(
GetPlayerPing(playerid) > MAX_PING) {
        
//Execute code eg. Kick(playerid);
    
}
    return 
1;

Reply
#6

Well obviously that's going to spam, it executes the code whenever their ping is higher than MAX_PING (or below), with no exception. Instead you can try doing something such as:

pawn Код:
if (IllegalPing[i] == true && GetPlayerPing(i) < MAX_PLAYER_PING)
      {
              IllegalPing[i] = false;
              TogglePlayerControllable(i, true);
      }
   
      else if (IllegalPing[i] == false && (GetPlayerPing(i) > MAX_PLAYER_PING) && (GetPlayerPing(i) != 65535))
      {
          // send message or whatever else
          TogglePlayerControllable(i, false);
          IllegalPing[i] = true;
      }
Could also be optimized a little further by allowing a "grace period" in certain circumstances.
Reply
#7

Quote:
Originally Posted by billy1337samp
Посмотреть сообщение
SORRY, i know i needed help but i spotted a mistake (incase anyone else wants to use that code)
he did
Код:
> 15
so
Код:
#define MAX_PING
is useless unless you write
Код:
> MAX_PING
This is how the code should look like:
PHP код:
#define MAX_PING 15
public OnPlayerUpdate(playerid) {
    if(
GetPlayerPing(playerid) > MAX_PING) {
        
//Execute code eg. Kick(playerid);
    
}
    return 
1;

Yeah, thank you. I'm a fast typer, and therefore i make some mistakes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)