Necesito ayuda con esto
#4

pawn Код:
stock CargarServers()
{
    new query[300], string[128];
    for(new i=1; i < MAXSERVERS; i++)
    {
    format(query, sizeof(query), "SELECT * FROM servers WHERE id='%i'", i);
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query,"|"))
    {
    mysql_fetch_field_row(string, "id"); ServersInfo[i][id] = strval(string);
    mysql_fetch_field_row(string, "servername"); format(ServersInfo[i][servername],40,string);
    mysql_fetch_field_row(string, "adminserver"); ServersInfo[i][adminserver] = strval(string);
    mysql_fetch_field_row(string, "servermap"); ServersInfo[i][servermap] = strval(string);
    mysql_fetch_field_row(string, "serverstatus"); format(ServersInfo[i][serverstatus],8,string);
    servidores++;
    }
    }
    printf("[BFS Info]: %i Servidores cargados.", servidores);
}
Estas ocupando espacio de memoria realmente para nada. Me pregunto, para que haces esto.

pawn Код:
new query[300];
Si lo que almacenarб esa variable no son mas de "37+MAXIMO TAMAСO DE 'i'"? eso hace que el proceso sea mas lento (velocidad) y que ocupes memoria RAM sin alguna razуn.

Lo correcto serнa.


pawn Код:
new query[38+9]; //Uno mas por el carбcter nulo.
Puedes leer mas sobre esto, aquн.

https://sampforum.blast.hk/showthread.php?tid=170427

Ahora tu segundo problema.

pawn Код:
mysql_fetch_field_row(string, "servername"); format(ServersInfo[i][servername],40,string);
Porque usar un "format" si puedes usar directamente la variable.

pawn Код:
mysql_fetch_field_row(ServersInfo[i][servername], "servername");
Reply


Messages In This Thread
Necesito ayuda con esto - by The_Scope - 30.05.2013, 21:01
Respuesta: Necesito ayuda con esto - by Jovazxc - 30.05.2013, 22:30
Respuesta: Necesito ayuda con esto - by The_Scope - 30.05.2013, 22:46
Respuesta: Necesito ayuda con esto - by DesingMyCry - 30.05.2013, 23:27
Respuesta: Necesito ayuda con esto - by JustBored - 30.05.2013, 23:52
Respuesta: Necesito ayuda con esto - by The_Scope - 31.05.2013, 00:00

Forum Jump:


Users browsing this thread: 1 Guest(s)