[Ajuda] comando /territorios [MySql]
#1

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;
}
Reply
#2

"%s: %s" na format.
Reply
#3

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.
Reply
#4

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

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]]);
Reply
#6

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
Reply
#7

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.
Reply
#8

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 :/
Reply
#9

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;
}
Reply
#10

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 :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)