[Ajuda] /contratos
#1

Boa Noite galera, eu queria saber como que faz para quando um Hitman/Assassins digitar "/contratos" aparecer todos os players que estгo com com contrato. Espero que alguйm me ajude

OBS: Eu jб criei o comando "/contrato"

@Edit

o comando /contrato que crieu foi esse:

Код:
CMD:contrato(playerid, params[])
{
    if (PlayerInfo[playerid][pOrg] == 1)
    {
        SendClientMessage(playerid, 0xFF0000AA, "[ERRO] Hitmans/Assassins nгo podem colocar contratos!");
        return 1;
    }
    else
    {
        new id;
        new preco;
        if (sscanf(params, "ud", id, preco))
        return SendClientMessage(playerid, 0xC0C0C0AA, "[INFO] Digite: /contrato [id] [preзo]");
        PlayerInfo[id][pCont] = preco;
        return 1;
    }
    return 1;
}
Reply
#2

PHP код:
CMD:contratos(playerid)
{
    new 
count 0iname[MAX_PLAYER_NAME], string[128];
    if(
Hitman[playerid] == 0)
        return 
SendClientMessage(playerid, -1"Vocк nгo й um Hitman/Assassins.");
    for(new 
iMAX_PLAYERSi++)
    {
        if(
Contratado[i] == && IsPlayerConnected(i))
        {
            
GetPlayerName(iinameMAX_PLAYER_NAME);
            
count++;
            
SendClientMessage(playerid, -1"Contratos abertos:");
            
format(stringsizeof(string), "%s[%d]"inamei);
            
SendClientMessage(playerid, -1string);
        }
    }
    if(
count == 0)
        return 
SendClientMessage(playerid, -1"Nгo hб contratados online.");
    return 
1;

Nгo testei.
Reply
#3

Quote:
Originally Posted by Luiiiz
Посмотреть сообщение
PHP код:
CMD:contratos(playerid)
{
    new 
count 0iname[MAX_PLAYER_NAME], string[128];
    if(
Hitman[playerid] == 0)
        return 
SendClientMessage(playerid, -1"Vocк nгo й um Hitman/Assassins.");
    for(new 
iMAX_PLAYERSi++)
    {
        if(
Contratado[i] == && IsPlayerConnected(i))
        {
            
GetPlayerName(iinameMAX_PLAYER_NAME);
            
count++;
            
SendClientMessage(playerid, -1"Contratos abertos:");
            
format(stringsizeof(string), "%s[%d]"inamei);
            
SendClientMessage(playerid, -1string);
        }
    }
    if(
count == 0)
        return 
SendClientMessage(playerid, -1"Nгo hб contratados online.");
    return 
1;

Nгo testei.
Nгo funfo
Reply
#4

PHP код:
CMD:contratos(playerid)
{
    static
        
name[MAX_PLAYER_NAME],
        
str[53];
    
SendClientMessage(playerid, -1"Contratos:");
    for (new 
0GetPlayerPoolSize(); <= j++)
    {
        if (!
PlayerInfo[i][pCont])
            continue;
        
GetPlayerName(inamesizeof(name));
        
format(strsizeof(str), "Nome: %s - Preзo: %i"namePlayerInfo[i][pCont]);
        
SendClientMessage(playerid, -1str);
    }
    if (!
strlen(str))
        
SendClientMessage(playerid, -1"Nenhum contrato encontrado.");
    return 
1;

Reply
#5

Quote:

CMD:contratos(playerid)
{
new cstr[128];
MEGAString[0] = EOS;
if(PlayerInfo[playerid][pOrg] != 1)
return SendClientMessage(playerid, -1, "Vocк nгo й um Assassino.");
strcat(MEGAString, "Id/Nome\tValor\n");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pCont] > 0 && IsPlayerConnected(i))
{
format(cstr, 128, "{FFFFFF}%d %s\t{00FF00}%d\n", i, GetName(i), PlayerInfo[i][pCont]);
strcat(MEGAString, cstr);
}
}
ShowPlayerDialog(playerid, 30303, DIALOG_STYLE_TABLIST_HEADERS, "Contratos", MEGAString, "Pegar", "Fechar");
return 1;
}

Se precisar do GetName
Quote:

GetName(playerid)
{
new Name[24];
GetPlayerName(playerid, Name, sizeof Name);
return Name;
}

Nгo cheguei a testar
Reply
#6

Quote:
Originally Posted by 1sbedx
Посмотреть сообщение
PHP код:
CMD:contratos(playerid)
{
    static
        
name[MAX_PLAYER_NAME],
        
str[53];
    
SendClientMessage(playerid, -1"Contratos:");
    for (new 
0GetPlayerPoolSize(); <= j++)
    {
        if (!
PlayerInfo[i][pCont])
            continue;
        
GetPlayerName(inamesizeof(name));
        
format(strsizeof(str), "Nome: %s - Preзo: %i"namePlayerInfo[i][pCont]);
        
SendClientMessage(playerid, -1str);
    }
    if (!
strlen(str))
        
SendClientMessage(playerid, -1"Nenhum contrato encontrado.");
    return 
1;

Vlw men, +rep pra vc
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)