[Ajuda] Comandos nгo funcionam
#1

os comandos /ban e /calar nгo estгo funcionando..

exemplo: eu dou /calar em um player, mais mesmo assim ele continua falando ou dou /ban e ele consegue entrar normalmente..

segue abaixo os comandos...

/calar..
Код:
COMMAND:calar(playerid, params[])
{
	new Msg[128], Name[24], AdminName[24], Reason[128], OtherPlayer;
	SendAdminText(playerid, "/calar", params);
	if (APlayerData[playerid][LoggedIn] == true)
	{
		if (APlayerData[playerid][PlayerLevel] >= 1)
		{
			if (sscanf(params, "us[128]", OtherPlayer, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Use: /calar [id] [motivo]");
			else
			{
				if (IsPlayerConnected(OtherPlayer))
				{
					GetPlayerName(playerid, AdminName, sizeof(AdminName));
					GetPlayerName(OtherPlayer, Name, sizeof(Name));
					APlayerData[OtherPlayer][Muted] = true;
					format(Msg, 128, "{FF0000}-| %s  foi calado por %s. Motivo: %s |-", Name, AdminName, Reason);
					SendClientMessageToAll(0xFFFFFFFF, Msg);
				    PlayerFile_Save(OtherPlayer);
				}
				else
				    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}O jogador nгo estб online.");
			}
		}
		else
		    return 0;
	}
	else
	    return 0;
	return 1;
}
/ban..
Код:
COMMAND:ban(playerid, params[])
{
	// Setup local variables
	new PlayerToBan, Days, Hours, Reason[128], TotalBanTime, Msg[128], Name[24], AdminName[24];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/ban", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 3
		if (APlayerData[playerid][PlayerLevel] >= 3)
		{
			if (sscanf(params, "uiis[128]", PlayerToBan, Days, Hours, Reason))
				SendClientMessage(playerid, 0xFF0000AA, "Digite: \"/ban <Player> <Dias> <Horas> <Motivo>\"");
			else
			{
				if (IsPlayerConnected(PlayerToBan))
				{
					// Get the names of the player and the admin who executed the ban
					GetPlayerName(playerid, AdminName, sizeof(AdminName));
					GetPlayerName(PlayerToBan, Name, sizeof(Name));

					// Increase the number of bans
					APlayerData[PlayerToBan][Bans]++;
					// Calculate the total bantime (when the player can login again)
					TotalBanTime = (Days * 86400) + (Hours * 3600) + gettime();
					// Check if this is the player's 5th ban
					if (APlayerData[PlayerToBan][Bans] == 5)
						APlayerData[PlayerToBan][BanTime] = 2147483640; // Make the ban permanent (as high as it can go)
					else
						APlayerData[PlayerToBan][BanTime] = TotalBanTime; // Store this value for the player

					// Inform the player about his ban
					// Check if this is the player's 5th ban
					if (APlayerData[PlayerToBan][Bans] == 5)
					{
						format(Msg, 128, "Voce foi Banido Permanente por %s, essa e a sua Ban numero 5", AdminName);
						SendClientMessage(PlayerToBan, 0x808080FF, Msg);
					}
					else
					{
						format(Msg, 128, "Voce Foi Banido Por %s por %i dias e %i horas", AdminName, Days, Hours);
						SendClientMessage(PlayerToBan, 0x808080FF, Msg);
						format(Msg, 128, "Motivo: %s", Reason);
						SendClientMessage(PlayerToBan, 0x808080FF, Msg);
						format(Msg, 128, "Voce Foi Banido %i Vezes, a 5t e Permanente", APlayerData[PlayerToBan][Bans]);
						SendClientMessage(PlayerToBan, 0x808080FF, Msg);
					}

					// Kick the player (his data will be saved)
					Kick(PlayerToBan);

					// Inform everybody else which player was banned and for how long
					format(Msg, 128, "-|%s %s Baniu %s por %i dias e  %i horas|-", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name, Days, Hours);
					SendClientMessageToAll(0xFF0000AA, Msg);
				}
			}
		}
		else
		    return 0;
	}
	else
	    return 0;

	return 1;
}
Reply
#2

Remova o return 0; que estб antes do ъltimo return
Reply
#3

Coloca estб verificaзгo em "public OnPlayerText", e veja se trabalhou!
PHP код:
    if(APlayerData[playerid][Muted] == true)
    {
        
SendClientMessage(playerid, -1"{FF0000}Vocк estб calado!");
        return 
0;
    } 
Reply
#4

Quote:
Originally Posted by ReyMysterio
Посмотреть сообщение
Remova o return 0; que estб antes do ъltimo return
Deu Warning..
Код:
warning 209: function "cmd_calar" should return a value

warning 209: function "cmd_ban" should return a value
Reply
#5

Quote:
Originally Posted by IgorLuiz
Посмотреть сообщение
Coloca estб verificaзгo em "public OnPlayerText", e veja se trabalhou!
PHP код:
    if(APlayerData[playerid][Muted] == true)
    {
        
SendClientMessage(playerid, -1"{FF0000}Vocк estб calado!");
        return 
0;
    } 
Ficou a msma coisa...
Reply
#6

Quote:
Originally Posted by MarcoAurelio
Посмотреть сообщение
Ficou a msma coisa...
Colocou no topo da public? caso contrario nгo ira funcionar!
Reply
#7

Quote:
Originally Posted by IgorLuiz
Посмотреть сообщение
Colocou no topo da public? caso contrario nгo ira funcionar!
Funcionou.. Obrgd, mais continuo com o problema do /ban
Reply
#8

Vocк estб fazendo uma verificaзгo na public onplayerconnect? se sim post estб verificaзгo.
Reply
#9

Quote:
Originally Posted by MarcoAurelio
Посмотреть сообщение
Funcionou.. Obrgd, mais continuo com o problema do /ban
Nгo vi nada de errado no cmd, Algo estб atrapalhando a verificaзгo, em "onplayerconnect"
Reply
#10

PHP код:
COMMAND:ban(playeridparams[])
{
    new 
PlayerToBanDaysHoursReason[128], TotalBanTimeMsg[128], Name[24], AdminName[24];
    
SendAdminText(playerid"/ban"params);
    if (
APlayerData[playerid][LoggedIn] == true)
    {
        if (
APlayerData[playerid][PlayerLevel] >= 3)
        {
            if (
sscanf(params"uiis[128]"PlayerToBanDaysHoursReason))
                
SendClientMessage(playerid0xFF0000AA"Use: /ban [id] [dias] [horas] [motivo]");
            else
            {
                if (
IsPlayerConnected(PlayerToBan))
                {
                    
GetPlayerName(playeridAdminNamesizeof(AdminName));
                    
GetPlayerName(PlayerToBanNamesizeof(Name));
                    
APlayerData[PlayerToBan][Bans]++;
                    
TotalBanTime = (Days 86400) + (Hours 3600) + gettime();
                    if (
APlayerData[PlayerToBan][Bans] == 5)
                        
APlayerData[PlayerToBan][BanTime] = 2147483640;
                    else
                        
APlayerData[PlayerToBan][BanTime] = TotalBanTime;
                    if (
APlayerData[PlayerToBan][Bans] == 5)
                    {
                        
format(Msg128"Vocк foi banido permanentemente por %s, pois ja й o seu 5° banimento."AdminName);
                        
SendClientMessage(PlayerToBan0x808080FFMsg);
                    }
                    else
                    {
                        
format(Msg128"Vocк foi banido por %s por %i dias e %i horas."AdminNameDaysHours);
                        
SendClientMessage(PlayerToBan0x808080FFMsg);
                        
format(Msg128"Motivo: %s"Reason);
                        
SendClientMessage(PlayerToBan0x808080FFMsg);
                        
format(Msg128"Vocк jб foi banido %i vezes, a 5° serб permanente."APlayerData[PlayerToBan][Bans]);
                        
SendClientMessage(PlayerToBan0x808080FFMsg);
                    }
                    
Kick(PlayerToBan);
                    
format(Msg128"{FF0000}-| O administrador %s %s baniu %s por %i dias e %i horas |-"AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminNameNameDaysHours);
                    
SendClientMessageToAll(0x808080FFMsg);
 
                }
            }
        }
        else
            return 
0;
    }
    else
        return 
0;
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)