anti spam cmd help
#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


Messages In This Thread
anti spam cmd help - by nbx2000 - 20.05.2018, 16:18
Re: anti spam cmd help - by Lokii - 20.05.2018, 16:35
Re: anti spam cmd help - by nbx2000 - 20.05.2018, 17:15
Re: anti spam cmd help - by Kraeror - 20.05.2018, 17:26
Re: anti spam cmd help - by nbx2000 - 20.05.2018, 17:50
Re: anti spam cmd help - by nbx2000 - 21.05.2018, 04:21

Forum Jump:


Users browsing this thread: 1 Guest(s)