[Ajuda] Tempo De Comando
#1

Quero Que A Pessoa Execute Esse Comando Em 2 i 2 Minutos

pawn Код:
COMMAND:assistencia(playerid, params[])
{
// Setup local variables
new bool:AssistOnline = false, Msg[128], Name[24];

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

// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Get the player's name
GetPlayerName(playerid, Name, sizeof(Name));
// Preset the message that needs to be sent to assistance players
format(Msg, 128, "{808080}O Player {FFFFFF}%s{808080} Pediu Assistencia!", Name);

// Check if there is at least one assistance player online
for (new i; i < MAX_PLAYERS; i++)
{
// Check if this player is connected
if (IsPlayerConnected(i))
{
// Check if this player is assistance class
if (APlayerData[i][PlayerClass] == ClassAssistance)
{
// Set the flag to indicate that at least one assistance player is online
AssistOnline = true;
// Send the assistance player a message to inform him who needs assistance
SendClientMessage(i, 0xFFFFFFFF, Msg);
}
}
}

// Check if there is at least one assistance player online
if (AssistOnline == true)
{
// Set yourself as "AssistanceNeeded"
APlayerData[playerid][AssistanceNeeded] = true;
// Let the player know he called for assistance
SendClientMessage(playerid, 0xFFFFFFFF, "{808080}Voce ja Pediu Assistencia");
}
else // No assistance is online
{
// Check if the player is the driver of a vehicle
if (GetPlayerVehicleSeat(playerid) == 0)
{
// Fully repair the vehicle (damage value and bodywork)
RepairVehicle(GetPlayerVehicleID(playerid));
// Also re-fuel the vehicle
AVehicleData[GetPlayerVehicleID(playerid)][Fuel] = MaxFuel;
// Let the player pay for the repairs and refuel (default $2000)
RewardPlayer(playerid, -2000, 0);
// Let the player know he spent $2000 for auto-repair because there were no assistance players online
SendClientMessage(playerid, 0xFFFFFFFF, "{808080}Seu Veiculo Foi Auto Reparado e Reabastecido Por R$:2000");
SendClientMessage(playerid, 0xFFFFFFFF, "{808080}Porque nao tem Mecanicos Online");
}
}
}
else
return 0;

// Let the server know that this was a valid command
return 1;
}

Por Favor Sou nube modifique o meu comando nao me mande um settime , Se Poder !
Reply
#2

Vou fazer um treco aqui perae
Reply
#3

@Juniito3
La a ultima linha q eu digitei ,
Quote:

Por Favor Sou nube modifique o meu comando nao me mande um settime , Se Poder !

Obrigado !
Reply
#4

pawn Код:
// topo
new podeusar[MAX_PLAYERS];

// comando
if(podeusar[playerid] + 120000 > GetTickCount()) return SendClientMessage(playerid, -1, "Vocк precisa esperar 2 mins pra usar esse comando novamente.");
podeusar[playerid] = GetTickcCount();
Reply
#5

pawn Код:
COMMAND:assistencia(playerid, params[])
{
    // Setup local variables
    new bool:AssistOnline = false, Msg[128], Name[24], bool:PodeUsarOComando[MAX_PLAYERS] = true;

    if (PodeUsarOComando[playerid] == false) return SendClientMessage(playerid, 0xFF0000FF, "Vocк deve esperar 3 minutos para digitar o comando novamente!");
   
   
    SetTimerEx("TimerDoComando", 1000 * 60 * 3, false, "i", playerid);
    PodeUsarOComando[playerid] = false;
   
   
    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/assistencia", params);
   
    if (GetPlayerWantedLevel(playerid) > 0)
        return SendClientMessage(playerid, VERMELHO, "Vocк nгo pode usar esse comando sendo procurado pela polнcia.");

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Get the player's name
        GetPlayerName(playerid, Name, sizeof(Name));
        // Preset the message that needs to be sent to assistance players
        format(Msg, 128, "{808080}O Jogador {FFFFFF}%s{808080} Pediu Assistencia! Va socorre-lo!", Name);

        // Check if there is at least one assistance player online
        for (new i; i < MAX_PLAYERS; i++)
        {
            // Check if this player is connected
            if (IsPlayerConnected(i))
            {
                // Check if this player is assistance class
                if (APlayerData[i][PlayerClass] == ClassAssistance)
                {
                    // Set the flag to indicate that at least one assistance player is online
                    AssistOnline = true;
                    // Send the assistance player a message to inform him who needs assistance
                    SendClientMessage(i, 0xFFFFFFFF, Msg);
                }
            }
        }

        // Check if there is at least one assistance player online
        if (AssistOnline == true)
        {
            // Set yourself as "AssistanceNeeded"
            APlayerData[playerid][AssistanceNeeded] = true;
            // Let the player know he called for assistance
            SendClientMessage(playerid, 0xFFFFFFFF, "{808080}Voce pediu Assistencia");
        }
        else // No assistance is online
        {
            // Check if the player is the driver of a vehicle
            if (GetPlayerVehicleSeat(playerid) == 0)
            {
                // Fully repair the vehicle (damage value and bodywork)
                RepairVehicle(GetPlayerVehicleID(playerid));
                // Also re-fuel the vehicle
                AVehicleData[GetPlayerVehicleID(playerid)][Fuel] = MaxFuel;
                // Let the player pay for the repairs and refuel (default $2000)
                RewardPlayer(playerid, -3000, 0);
                // Let the player know he spent $2000 for auto-repair because there were no assistance players online
                SendClientMessage(playerid, 0xFFFFFFFF, "{808080}Seu Veiculo Foi Reparado,Reabastecido e Revisado Por R$:3000");
                SendClientMessage(playerid, 0xFFFFFFFF, "{808080}Porque nao tem Mecanicos Online");
            }
        }
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}


forward TimerDoComando(playerid)

public TimerDoComando(playerid)
{
    PodeUsarOComando[playerid] = true;
   
    SendClientMessage(playerid, 0xFF0000FF, "Autorizado a usar o comando /assistencia.");
   
    return 1;
}
Reply
#6

nenhum dos dois ta funcionando

@Kuddy
1 erro
Quote:

\pawno\include\PPC_PlayerCommands.inc(3206) : error 017: undefined symbol "GetTickcCount"

@Juniiro3
Varios Erros
Reply
#7

pawn Код:
new Podeusarcomando = 0;// topo do gm

Podeusarcomando = 1;// no comando
if(Podeusarcomando == 1) return SendClientMessage(playerid, Vermelho, "Aguarde 10 segundos para usar o comando");
SetTimerEx("liberar",10000,1,"i",playerid);// no comando

forward liberar();// fim do GM
public liberar()
{
Podeusarcomando = 0;
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)