SA-MP Forums Archive
[Ajuda] comando /territorios [MySql] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] comando /territorios [MySql] (/showthread.php?tid=467217)



comando /territorios [MySql] - Caio_Freeze - 02.10.2013

estou tendo problema ao obter os donos das gangzones do meu banco de dados, ele nao mostra

comando:
pawn Код:
CMD:territorios(playerid,prarms[])
{
    new query[128];
    format(query,sizeof query,"SELECT * FROM `gangzoneinfo` WHERE id='%d'",GangZoneInfo[playerid][gzId]);
    mysql_function_query(xConexao, query, true, "g@GangZones", "d", playerid);
    return 1;
}
pawn Код:
forward g@GangZones(playerid);
public g@GangZones(playerid)
{
    new rows, fields, /*gzNome[128], gzDono[128],*/ result[128];

    cache_get_data(rows, fields, xConexao);

    if(rows)
    {
        cache_get_field_content(0, "name", GangZoneInfo[playerid][gzName], xConexao);
        cache_get_field_content(0, "dono", GangZoneInfo[playerid][gzOwner], xConexao);
        format(result,sizeof(result),"%s: %d",GangZoneInfo[playerid][gzName],GangZoneInfo[playerid][gzOwner], (GangZoneInfo[playerid][gzOwner] == 1 ? ("Groove Street") : GangZoneInfo[playerid][gzOwner] == 2  ? ("Ballas") : GangZoneInfo[playerid][gzOwner] == 3  ?  ("Vagos") : GangZoneInfo[playerid][gzOwner] == 4  ?  ("Aztecas") : ("Policia Militar")));
        //SendClientMessage(playerid,-1,result);
    }
    SendClientMessage(playerid,-1,result);
    return 1;
}



Re: comando /territorios [MySql] - arakuta - 02.10.2013

"%s: %s" na format.


Re: comando /territorios [MySql] - Caio_Freeze - 02.10.2013

Quote:
Originally Posted by arakuta
Посмотреть сообщение
"%s: %s" na format.
eu coloquei e nao tinha ido tb tipo ele executa o comando mais nao mostra nada.


Re: comando /territorios [MySql] - Abravanel - 02.10.2013

Код:
format(result,sizeof(result),"%s: %d",GangZoneInfo[playerid][gzName],GangZoneInfo[playerid][gzOwner], (GangZoneInfo[playerid][wner] == 1 ?...



Re: comando /territorios [MySql] - arakuta - 02.10.2013

Nгo sei se essa operaзгo ternбria ta certa...

pawn Код:
new ownername[5] = {"nada","groove","ballas","vagos","aztecas"};
//
format(result,sizeof(result),"%s: %s",GangZoneInfo[playerid][gzName],ownername[GangZoneInfo[playerid][gzOwner]]);



Re: comando /territorios [MySql] - Caio_Freeze - 02.10.2013

Quote:
Originally Posted by arakuta
Посмотреть сообщение
Nгo sei se essa operaзгo ternбria ta certa...

pawn Код:
new ownername[5] = {"nada","groove","ballas","vagos","aztecas"};
//
format(result,sizeof(result),"%s: %s",GangZoneInfo[playerid][gzName],ownername[GangZoneInfo[playerid][gzOwner]]);
nao deu deu esse erro que eu nunca vi rsrs

pawn Код:
error 018: initialization data exceeds declared size



Re: comando /territorios [MySql] - arakuta - 02.10.2013

Quote:
Originally Posted by Caio_Freeze
Посмотреть сообщение
nao deu deu esse erro que eu nunca vi rsrs

pawn Код:
error 018: initialization data exceeds declared size
pawn Код:
new ownername[5][15];
Desculpa, tava sem o tamanho das strings.


Re: comando /territorios [MySql] - Caio_Freeze - 02.10.2013

Quote:
Originally Posted by arakuta
Посмотреть сообщение
pawn Код:
new ownername[5][15];
Desculpa, tava sem o tamanho das strings.
ainda nada o bagulho ta loco kkk

engraзado que ele compila sem erros mais ele nao mostra :/


Re: comando /territorios [MySql] - zPain - 02.10.2013

pawn Код:
forward g@GangZones(playerid);
public g@GangZones(playerid)
{
    new rows, fields, /*gzNome[128], gzDono[128],*/ result[128];

    cache_get_data(rows, fields, xConexao);

    if(rows)
    {
        cache_get_field_content(0, "name", GangZoneInfo[playerid][gzName], xConexao);
       
        cache_get_field_content(0, "dono", result, xConexao);
        GangZoneInfo[playerid][gzOwner] = strval(result);
       
        switch(GangZoneInfo[playerid][gzOwner])
        {
            case 1: format(result, sizeof result, "Groove");
            case 2: format(result, sizeof result, "Ballas");
            case 3: format(result, sizeof result, "Vagos");
            case 4: format(result, sizeof result, "Aztecas");
        }
       
        format(result, sizeof result, "%s: %s", GangZoneInfo[playerid][gzName], result);
        SendClientMessage(playerid, -1, result);
    }
    return 1;
}



Re: comando /territorios [MySql] - Caio_Freeze - 02.10.2013

Quote:
Originally Posted by zPain
Посмотреть сообщение
pawn Код:
forward g@GangZones(playerid);
public g@GangZones(playerid)
{
    new rows, fields, /*gzNome[128], gzDono[128],*/ result[128];

    cache_get_data(rows, fields, xConexao);

    if(rows)
    {
        cache_get_field_content(0, "name", GangZoneInfo[playerid][gzName], xConexao);
       
        cache_get_field_content(0, "dono", result, xConexao);
        GangZoneInfo[playerid][gzOwner] = strval(result);
       
        switch(GangZoneInfo[playerid][gzOwner])
        {
            case 1: format(result, sizeof result, "Groove");
            case 2: format(result, sizeof result, "Ballas");
            case 3: format(result, sizeof result, "Vagos");
            case 4: format(result, sizeof result, "Aztecas");
        }
       
        format(result, sizeof result, "%s: %s", GangZoneInfo[playerid][gzName], result);
        SendClientMessage(playerid, -1, result);
    }
    return 1;
}
esse tambem nao funcionou :/