toggleplayercontrallable and repeats
#1

The purpose of this script is to warn the user that their ping exceeds the maximum amount and freezes the player until their ping calms down... but that hasn't got quit the way I expected it too.

Why does it keep freezing, freezing, freezing them? I just want it to freeze the player once.
Why does it keep unfreezing, unfreezing, unfreezing them? I just want it to unfreeze the player once.



(You can see this when the text 'true/false' repeats)

PHP код:
#include <a_samp>
#define FILTERSCRIPT
#define MAX_PING 15
public OnPlayerUpdate(playerid) {
if (
GetPlayerPing(playerid) < MAX_PING)
      {
              
TogglePlayerControllable(playerid0); //true/freeze
              
SendClientMessage(playerid, -1"true");
      }
      
      else if (
GetPlayerPing(playerid) > MAX_PING)
      {
          
TogglePlayerControllable(playerid1); //false/unfreeze
          
SendClientMessage(playerid, -1"false");
      }
      

Can someone improve the script (help me)?
Reply
#2

Thank you to who ever will help me (rep).
Reply
#3

Try this
PHP код:
#include <a_samp> 
#define FILTERSCRIPT 
#define MAX_PING 15 
public OnPlayerUpdate(playerid) { 
if(
GetPlayerPing(playerid) > MAX_PING
      { 
              
TogglePlayerControllable(playerid0); //true/freeze 
              
SendClientMessage(playerid, -1"true"); 
      } 
       
      else if(
GetPlayerPing(playerid) < MAX_PING
      { 
          
TogglePlayerControllable(playerid1); //false/unfreeze 
          
SendClientMessage(playerid, -1"false"); 
      } 
       

Reply
#4

PHP код:
public OnPlayerUpdate(playerid) {  
if(
GetPlayerPing(playerid) > MAX_PING)  
    {  
    if(!
isFrozen[playerid])
        {      
            
TogglePlayerControllable(playerid0); //true/freeze  
            
SendClientMessage(playerid, -1"true");
            
isFrozen[playerid] = true;
        }
    }        
    else if(
GetPlayerPing(playerid) < MAX_PING)  
    {
        if(
isFrozen[playerid])
        {
            
TogglePlayerControllable(playerid1); //false/unfreeze  
            
SendClientMessage(playerid, -1"false"); 
            
isFrozen[playerid] = false;
        }
    }        

Reply
#5

Quote:
Originally Posted by Arbico
Посмотреть сообщение
Try this
PHP код:
#include <a_samp> 
#define FILTERSCRIPT 
#define MAX_PING 15 
public OnPlayerUpdate(playerid) { 
if(
GetPlayerPing(playerid) > MAX_PING
      { 
              
TogglePlayerControllable(playerid0); //true/freeze 
              
SendClientMessage(playerid, -1"true"); 
      } 
       
      else if(
GetPlayerPing(playerid) < MAX_PING
      { 
          
TogglePlayerControllable(playerid1); //false/unfreeze 
          
SendClientMessage(playerid, -1"false"); 
      } 
       

still spams. what exactly did you change?
Reply
#6

Quote:
Originally Posted by frouzen
Посмотреть сообщение
PHP код:
public OnPlayerUpdate(playerid) {  
if(
GetPlayerPing(playerid) > MAX_PING)  
    {  
    if(!
isFrozen[playerid])
        {      
            
TogglePlayerControllable(playerid0); //true/freeze  
            
SendClientMessage(playerid, -1"true");
            
isFrozen[playerid] = true;
        }
    }        
    else if(
GetPlayerPing(playerid) < MAX_PING)  
    {
        if(
isFrozen[playerid])
        {
            
TogglePlayerControllable(playerid1); //false/unfreeze  
            
SendClientMessage(playerid, -1"false"); 
            
isFrozen[playerid] = false;
        }
    }        

Код:
C:\Users\User\Desktop\SAE\filterscripts\sPing.pwn(8) : error 017: undefined symbol "isFrozen"
C:\Users\User\Desktop\SAE\filterscripts\sPing.pwn(8) : warning 215: expression has no effect
C:\Users\User\Desktop\SAE\filterscripts\sPing.pwn(8) : error 001: expected token: ";", but found "]"
C:\Users\User\Desktop\SAE\filterscripts\sPing.pwn(8) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\SAE\filterscripts\sPing.pwn(8) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#7

Try now.
PHP код:
#include <a_samp>  
#define FILTERSCRIPT  
#define MAX_PING 15
new isFrozen[MAX_PLAYERS];

public 
OnPlayerConnect(playerid)
{
    
isFrozen[playerid] = false;
    return 
1;

public 
OnPlayerUpdate(playerid) {  
if(
GetPlayerPing(playerid) > MAX_PING)  
    {  
    if(!
isFrozen[playerid])
        {      
            
TogglePlayerControllable(playerid0); //true/freeze  
            
SendClientMessage(playerid, -1"true");
            
isFrozen[playerid] = true;
        }
    }        
    else if(
GetPlayerPing(playerid) < MAX_PING)  
    {
        if(
isFrozen[playerid])
        {
            
TogglePlayerControllable(playerid1); //false/unfreeze  
            
SendClientMessage(playerid, -1"false"); 
            
isFrozen[playerid] = false;
        }
    }        

Reply
#8

Quote:
Originally Posted by frouzen
Посмотреть сообщение
Try now.
PHP код:
#include <a_samp>  
#define FILTERSCRIPT  
#define MAX_PING 15
new isFrozen[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
isFrozen[playerid] = false;
    return 
1;

public 
OnPlayerUpdate(playerid) {  
if(
GetPlayerPing(playerid) > MAX_PING)  
    {  
    if(!
isFrozen[playerid])
        {      
            
TogglePlayerControllable(playerid0); //true/freeze  
            
SendClientMessage(playerid, -1"true");
            
isFrozen[playerid] = true;
        }
    }        
    else if(
GetPlayerPing(playerid) < MAX_PING)  
    {
        if(
isFrozen[playerid])
        {
            
TogglePlayerControllable(playerid1); //false/unfreeze  
            
SendClientMessage(playerid, -1"false"); 
            
isFrozen[playerid] = false;
        }
    }        

This works. Thank you very much. +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)