anti spam cmd help
#1

hello I wonder if it helps me do an anti spam command or pass me the full scrip zcmd
Reply
#2

PHP код:

public OnPlayerConnect(playerid)
{
    
SetPVarInt(playerid"PSPAM"0);
    return 
1;
}
public 
OnPlayerDisconnect(playerid)
{
    
SetPVarInt(playerid"PSPAM"0); //reset spam on disconnect
    
return 1;
}
public 
OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(
success)
    {
         
SetPVarInt(playerid"PSPAM"1); //spam to 1 use pvars so other scripts wont let you spam too
            
SetTimerEx("SpamDelay"1000false"i"playerid); //delay
    
}
}
public 
OnPlayerCommandReceived(playeridcmdtext[])
{
    if(
GetPVarInt(playerid"PSPAM") == 1//if spam still on
    
{
        
SendClientMessage(playerid0xFF0000FF"Do not spam!");
        return 
0//do not execute the command
    
}
    return 
1;
}
forward SpamDelay(playerid);
public 
SpamDelay(playerid)
{
    
SetPVarInt(playerid"PSPAM"0); //setting to no spam after 1 second

Reply
#3

error
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
 if(success == 0) {
	  if(ServerInfo[ReadCmds] == 1) {
	   	new string[150];
	   	format(string, sizeof(string)-1, "[Unknow CMD] %s [ID: %d] Command: %s", pName(playerid), playerid, cmdtext);
        foreach (new i : Player) {
	      if(PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= 6 && i != playerid) {
            SendClientMessage(i, 0xF6BB0AA, string);
          }
	   	}
	  }
	  ShowPlayerDialog(playerid, 199, DIALOG_STYLE_MSGBOX, "{b0b0b0}ERROR:Unknow Command", "\n{c6e2ff}you have typed an unknow commands.\n\n{c6e2ff}you can spawn any vehicles by type /veh\n\n{c6e2ff}Type /cmds and cmds2 to display the most commonly used commands", "Aceptar", "");
	  return 1;
	}
	else if(success == 1) {
      if(ServerInfo[ReadCmds] == 1) {
	   	new string[150];
	   	format(string, sizeof(string)-1, "[CMD] %s [ID: %d] Command: %s", pName(playerid), playerid, cmdtext);
        foreach (new i : Player) {
		  if(PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= 6 && i != playerid) {
            SendClientMessage(i, 0xF6BB0AA, string);
		  }
	   	}
      }
	}
	return 1;
}
    if(success)
    {
         SetPVarInt(playerid, "PSPAM", 1); //spam to 1 use pvars so other scripts wont let you spam too
           SetTimerEx("SpamDelay", 1000, false, "i", playerid); //delay
    }
}
Код:
public OnPlayerCommandReceived(playerid, cmdtext[]) {
   if(PlayerInfo[playerid][Registered] == 1 && PlayerInfo[playerid][LoggedIn] == 0)
	   if(strcmp(cmdtext,"/forgotpassword", true) == 1 || strcmp(cmdtext,"/forgotpassword", true) == -1 && strcmp(cmdtext,"/login", true) == 1 || strcmp(cmdtext,"/login", true) == -1) {
         SendClientMessage(playerid,red,"You are registered and not logged in!, login to use commands");
         return 1;
   }
   return 0;
}
    if(GetPVarInt(playerid, "PSPAM") == 1) //if spam still on
    {
        SendClientMessage(playerid, 0xFF0000FF, "Do not spam!");
        return 0; //do not execute the command
    }
    return 1;
}
C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36722) : error 010: invalid function or declaration
C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36725) : error 010: invalid function or declaration
C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36727) : error 010: invalid function or declaration
C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36755) : warning 217: loose indentation
C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36757) : error 010: invalid function or declaration
Pawn compiler 3.2.3664
Reply
#4

Quote:
Originally Posted by nbx2000
Посмотреть сообщение
error
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
 if(success == 0) {
	  if(ServerInfo[ReadCmds] == 1) {
	   	new string[150];
	   	format(string, sizeof(string)-1, "[Unknow CMD] %s [ID: %d] Command: %s", pName(playerid), playerid, cmdtext);
        foreach (new i : Player) {
	      if(PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= 6 && i != playerid) {
            SendClientMessage(i, 0xF6BB0AA, string);
          }
	   	}
	  }
	  ShowPlayerDialog(playerid, 199, DIALOG_STYLE_MSGBOX, "{b0b0b0}ERROR:Unknow Command", "\n{c6e2ff}you have typed an unknow commands.\n\n{c6e2ff}you can spawn any vehicles by type /veh\n\n{c6e2ff}Type /cmds and cmds2 to display the most commonly used commands", "Aceptar", "");
	  return 1;
	}
	else if(success == 1) {
      if(ServerInfo[ReadCmds] == 1) {
	   	new string[150];
	   	format(string, sizeof(string)-1, "[CMD] %s [ID: %d] Command: %s", pName(playerid), playerid, cmdtext);
        foreach (new i : Player) {
		  if(PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= 6 && i != playerid) {
            SendClientMessage(i, 0xF6BB0AA, string);
		  }
	   	}
      }
	}
	return 1;
}
    if(success)
    {
         SetPVarInt(playerid, "PSPAM", 1); //spam to 1 use pvars so other scripts wont let you spam too
           SetTimerEx("SpamDelay", 1000, false, "i", playerid); //delay
    }
}
Код:
public OnPlayerCommandReceived(playerid, cmdtext[]) {
   if(PlayerInfo[playerid][Registered] == 1 && PlayerInfo[playerid][LoggedIn] == 0)
	   if(strcmp(cmdtext,"/forgotpassword", true) == 1 || strcmp(cmdtext,"/forgotpassword", true) == -1 && strcmp(cmdtext,"/login", true) == 1 || strcmp(cmdtext,"/login", true) == -1) {
         SendClientMessage(playerid,red,"You are registered and not logged in!, login to use commands");
         return 1;
   }
   return 0;
}
    if(GetPVarInt(playerid, "PSPAM") == 1) //if spam still on
    {
        SendClientMessage(playerid, 0xFF0000FF, "Do not spam!");
        return 0; //do not execute the command
    }
    return 1;
}
C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36722) : error 010: invalid function or declaration
C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36725) : error 010: invalid function or declaration
C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36727) : error 010: invalid function or declaration
C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36755) : warning 217: loose indentation
C:\Users\carlos\Downloads\fenix\gamemodes\SATDMv12 .pwn(36757) : error 010: invalid function or declaration
Pawn compiler 3.2.3664
Try this:
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
     if(!
success)
     {
        if(
ServerInfo[ReadCmds] == 1)
        {
               new 
string[150];
               
format(stringsizeof(string)-1"[Unknow CMD] %s [ID: %d] Command: %s"pName(playerid), playeridcmdtext);
            foreach (new 
Player)
            {
                   if(
PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= && != playerid)
                   {
                    
SendClientMessage(i0xF6BB0AAstring);
                }
            }
        }
        
ShowPlayerDialog(playerid199DIALOG_STYLE_MSGBOX"{b0b0b0}ERROR:Unknow Command""\n{c6e2ff}you have typed an unknow commands.\n\n{c6e2ff}you can spawn any vehicles by type /veh\n\n{c6e2ff}Type /cmds and cmds2 to display the most commonly used commands""Aceptar""");
          return 
1;
    }
    else
    {
        if(
ServerInfo[ReadCmds] == 1)
          {
            new 
string[150];
               
format(stringsizeof(string)-1"[CMD] %s [ID: %d] Command: %s"pName(playerid), playeridcmdtext);
            foreach (new 
Player)
            {
                if(
PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= && != playerid)
                {
                    
SendClientMessage(i0xF6BB0AAstring);
                }
            }
        }
        
SetPVarInt(playerid"PSPAM"1); //spam to 1 use pvars so other scripts wont let you spam too
        
SetTimerEx("SpamDelay"1000false"i"playerid); //delay
        
return 1;
    }
    return 
1;
}
public 
OnPlayerCommandReceived(playeridcmdtext[])
{
    if(
PlayerInfo[playerid][Registered] == && PlayerInfo[playerid][LoggedIn] == 0)
    {
        if(
strcmp(cmdtext,"/forgotpassword"true) == || strcmp(cmdtext,"/forgotpassword"true) == -&& strcmp(cmdtext,"/login"true) == || strcmp(cmdtext,"/login"true) == -1)
        {
            
SendClientMessage(playerid,red,"You are registered and not logged in!, login to use commands");
            return 
1;
        }
           return 
0;
    }
    if(
GetPVarInt(playerid"PSPAM") == 1//if spam still on
    
{
        
SendClientMessage(playerid0xFF0000FF"Do not spam!");
        return 
0//do not execute the command
    
}
    return 
1;

Reply
#5

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
Try this:
PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
     if(!
success)
     {
        if(
ServerInfo[ReadCmds] == 1)
        {
               new 
string[150];
               
format(stringsizeof(string)-1"[Unknow CMD] %s [ID: %d] Command: %s"pName(playerid), playeridcmdtext);
            foreach (new 
Player)
            {
                   if(
PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= && != playerid)
                   {
                    
SendClientMessage(i0xF6BB0AAstring);
                }
            }
        }
        
ShowPlayerDialog(playerid199DIALOG_STYLE_MSGBOX"{b0b0b0}ERROR:Unknow Command""\n{c6e2ff}you have typed an unknow commands.\n\n{c6e2ff}you can spawn any vehicles by type /veh\n\n{c6e2ff}Type /cmds and cmds2 to display the most commonly used commands""Aceptar""");
          return 
1;
    }
    else
    {
        if(
ServerInfo[ReadCmds] == 1)
          {
            new 
string[150];
               
format(stringsizeof(string)-1"[CMD] %s [ID: %d] Command: %s"pName(playerid), playeridcmdtext);
            foreach (new 
Player)
            {
                if(
PlayerInfo[i][Level] > PlayerInfo[playerid][Level] && PlayerInfo[i][Level] >= && != playerid)
                {
                    
SendClientMessage(i0xF6BB0AAstring);
                }
            }
        }
        
SetPVarInt(playerid"PSPAM"1); //spam to 1 use pvars so other scripts wont let you spam too
        
SetTimerEx("SpamDelay"1000false"i"playerid); //delay
        
return 1;
    }
    return 
1;
}
public 
OnPlayerCommandReceived(playeridcmdtext[])
{
    if(
PlayerInfo[playerid][Registered] == && PlayerInfo[playerid][LoggedIn] == 0)
    {
        if(
strcmp(cmdtext,"/forgotpassword"true) == || strcmp(cmdtext,"/forgotpassword"true) == -&& strcmp(cmdtext,"/login"true) == || strcmp(cmdtext,"/login"true) == -1)
        {
            
SendClientMessage(playerid,red,"You are registered and not logged in!, login to use commands");
            return 
1;
        }
           return 
0;
    }
    if(
GetPVarInt(playerid"PSPAM") == 1//if spam still on
    
{
        
SendClientMessage(playerid0xFF0000FF"Do not spam!");
        return 
0//do not execute the command
    
}
    return 
1;

thanks I work but this bug anti spam cmd bug does not walk the cmd of the gamemode
Reply
#6

help ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)