I make a function, for load some data of the mysql and store it on vars.. this works for numbers.. but no works for letters like "pass" var.. so what i need to change.. here is my function
Код:
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();
mysql_fetch_row(variable);
mysql_free_result();
if(strcmp(var, "id", true) == 0)
{
pinfo[playerid][id] = strval(variable);
}
if(strcmp(var, "nombre", true) == 0)
{
pinfo[playerid][nombre] = strval(variable);
}
if(strcmp(var, "pass", true) == 0)
{
pinfo[playerid][pass] = strval(variable);
}
if(strcmp(var, "cedula", true) == 0)
{
pinfo[playerid][cedula] = strval(variable);
}
if(strcmp(var, "edad", true) == 0)
{
pinfo[playerid][edad] = strval(variable);
}
if(strcmp(var, "sexo", true) == 0)
{
pinfo[playerid][sexo] = strval(variable);
}
if(strcmp(var, "nivel", true) == 0)
{
pinfo[playerid][nivel] = strval(variable);
}
if(strcmp(var, "dinero", true) == 0)
{
pinfo[playerid][dinero] = strval(variable);
}
if(strcmp(var, "trabajo", true) == 0)
{
pinfo[playerid][trabajo] = strval(variable);
}
if(strcmp(var, "lic1", true) == 0)
{
pinfo[playerid][lic1] = strval(variable);
}
if(strcmp(var, "lic2", true) == 0)
{
pinfo[playerid][lic2] = strval(variable);
}
if(strcmp(var, "lic3", true) == 0)
{
pinfo[playerid][lic3] = strval(variable);
}
if(strcmp(var, "lic4", true) == 0)
{
pinfo[playerid][lic4] = strval(variable);
}
if(strcmp(var, "lic5", true) == 0)
{
pinfo[playerid][lic5] = strval(variable);
}
if(strcmp(var, "admin", true) == 0)
{
pinfo[playerid][admin] = strval(variable);
}
if(strcmp(var, "phone", true) == 0)
{
pinfo[playerid][phone] = strval(variable);
}
if(strcmp(var, "banco", true) == 0)
{
pinfo[playerid][banco] = strval(variable);
}
if(strcmp(var, "skin", true) == 0)
{
pinfo[playerid][skin] = strval(variable);
}
if(strcmp(var, "px", true) == 0)
{
pinfo[playerid][px] = strval(variable);
}
if(strcmp(var, "py", true) == 0)
{
pinfo[playerid][py] = strval(variable);
}
if(strcmp(var, "pz", true) == 0)
{
pinfo[playerid][pz] = strval(variable);
}
if(strcmp(var, "vida", true) == 0)
{
pinfo[playerid][vida] = strval(variable);
}
if(strcmp(var, "armor", true) == 0)
{
pinfo[playerid][armor] = strval(variable);
}
if(strcmp(var, "spawned", true) == 0)
{
pinfo[playerid][spawned] = strval(variable);
}
}
Well it doesn't work for strings because you're parsing the variable as an integer...