Strval, Floatstr and for text?
#9

OK i fix it.. here is my code

Код:
public MysqlCargarDato(playerid, var[])
{
    new variable[128];
    new query[128];
    new pnombre[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pnombre, sizeof(pnombre));
    format(query, sizeof(query), "SELECT %s FROM `jugadores` WHERE nombre='%s'", var, pnombre);
    mysql_query(query);
    mysql_store_result();
    if(strcmp(var, "id", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][id] = strval(variable);
    }
    if(strcmp(var, "nombre", true) == 0)
    {
        mysql_fetch_row(pinfo[playerid][nombre]);
    }
    if(strcmp(var, "pass", true) == 0)
    {
        mysql_fetch_row(pinfo[playerid][pass]);
    }
    if(strcmp(var, "cedula", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][cedula] = strval(variable);
    }
    if(strcmp(var, "edad", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][edad] = strval(variable);
    }
    if(strcmp(var, "sexo", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][sexo] = strval(variable);
    }
    if(strcmp(var, "nivel", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][nivel] = strval(variable);
    }
    if(strcmp(var, "dinero", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][dinero] = strval(variable);
    }
    if(strcmp(var, "trabajo", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][trabajo] = strval(variable);
    }
    if(strcmp(var, "lic1", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][lic1] = strval(variable);
    }
    if(strcmp(var, "lic2", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][lic2] = strval(variable);
    }
    if(strcmp(var, "lic3", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][lic3] = strval(variable);
    }
    if(strcmp(var, "lic4", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][lic4] = strval(variable);
    }
    if(strcmp(var, "lic5", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][lic5] = strval(variable);
    }
    if(strcmp(var, "admin", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][admin] = strval(variable);
    }
    if(strcmp(var, "phone", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][phone] = strval(variable);
    }
    if(strcmp(var, "banco", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][banco] = strval(variable);
    }
    if(strcmp(var, "skin", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][skin] = strval(variable);
    }
    if(strcmp(var, "px", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][px] = strval(variable);
    }
    if(strcmp(var, "py", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][py] = strval(variable);
    }
    if(strcmp(var, "pz", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][pz] = strval(variable);
    }
    if(strcmp(var, "vida", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][vida] = strval(variable);
    }
    if(strcmp(var, "armor", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][armor] = strval(variable);
    }
    if(strcmp(var, "spawned", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][spawned] = strval(variable);
    }
    mysql_free_result();
}
i use thiss for example for an interger

Код:
    if(strcmp(var, "spawned", true) == 0)
    {
        mysql_fetch_row(variable);
        pinfo[playerid][spawned] = strval(variable);
    }
and if a string i dont need to use strval so i use this

Код:
    if(strcmp(var, "pass", true) == 0)
    {
        mysql_fetch_row(pinfo[playerid][pass]);
    }
Reply


Messages In This Thread
Strval, Floatstr and for text? - by Zafire1410 - 05.08.2010, 20:34
Re: Strval, Floatstr and for text? - by Kar - 05.08.2010, 20:36
Re: Strval, Floatstr and for text? - by Hiddos - 05.08.2010, 20:39
Re: Strval, Floatstr and for text? - by Sergei - 05.08.2010, 20:40
Re: Strval, Floatstr and for text? - by Kar - 05.08.2010, 20:43
Re: Strval, Floatstr and for text? - by Zafire1410 - 05.08.2010, 20:43
Re: Strval, Floatstr and for text? - by Hiddos - 05.08.2010, 20:45
Re: Strval, Floatstr and for text? - by Zafire1410 - 05.08.2010, 20:47
Re: Strval, Floatstr and for text? - by Zafire1410 - 05.08.2010, 20:53

Forum Jump:


Users browsing this thread: 4 Guest(s)