30.11.2009, 23:22
Hey guys, im making an "auto unload variable" script to unload variables from an sql database and load them into an array for the player variables. Im having trouble tho...
So why is it when i call Players[playerid][loggedin] it says null even though it loads it?
Код:
//login command .... LoadPlayerVariables(playerid,query); // goes fine, prints all values how they should be if(Players[playerid][loggedin] == 0) { print(Players[playerid][loggedin]); // Printed as null .....
Код:
//Loading player variables public LoadPlayerVariables(playerid,query[]) { new fval = 0; new field[256],update[256],date[256],day,month,year,line[1024]; samp_mysql_query(query); samp_mysql_store_result(); samp_mysql_fetch_row(line); print(line); // to view the sql result... appears normal samp_mysql_strtok(field, "|", line); format(Players[playerid][pInfo:fval],256,"%s",field); // loads "R4nk3d" into Players[playerid][pInfo:fval] printf("%s is now stored as %s for player id (%i).",field,Players[playerid][pInfo:fval],playerid); fval ++; while(samp_mysql_strtok(field, "|", "")==1) { //Players[playerid][pInfo:fval] = format(Players[playerid][pInfo:fval],256,"%s",field); printf("%s is now stored as %s for player id (%i).",field,Players[playerid][pInfo:fval],playerid); fval ++; } ..... }