//This is under OnGameModeInit
mysql_function_query(Connection,"SELECT * FROM houses",false,"LoadHouses","i",playerid);
//The public
public LoadHouses()
{
new string[128];
static rows,fields;
cache_get_data(rows, fields, Connection);
for(new i = 0; i < rows; i++)
{
Houses++;
cache_get_field_content(0,"Owner",hInfo[i][hOwner],Connection,64);
hInfo[i][hIndex] = cache_get_field_content_int(0,"ID");
hInfo[i][hPrice] = cache_get_field_content_int(0,"Price");
hInfo[i][hPos][0] = cache_get_field_content_float(0,"X");
hInfo[i][hPos][1] = cache_get_field_content_float(0,"Y");
hInfo[i][hPos][2] = cache_get_field_content_float(0,"Z");
}
format(string,sizeof(string),"Loaded %d houses",Houses);
print(string);
Housess = Houses;
SpawnHouses();
return 1;
}
//SpawnHouses
stock SpawnHouses()
{
new string[128];
while(Housess >= 1)
{
hInfo[Housess][hOne] = CreateDynamicPickup(1273, 1, hInfo[Housess][hPos][0], hInfo[Housess][hPos][1], hInfo[Housess][hPos][2], 0);
format(string, sizeof(string), "House owner:%s", hInfo[Housess][hOwner]);
hInfo[Housess][hTwo] = CreateDynamic3DTextLabel(string, COLOR_WHITE, hInfo[Housess][hPos][0], hInfo[Housess][hPos][1], hInfo[Housess][hPos][2], 0, 0, 0);
Housess--;
}
}
cache_get_field_content(0,"Owner",hInfo[i][hOwner],Connection,64);
hInfo[i][hIndex] = cache_get_field_content_int(0,"ID");
hInfo[i][hPrice] = cache_get_field_content_int(0,"Price");
hInfo[i][hPos][0] = cache_get_field_content_float(0,"X");
hInfo[i][hPos][1] = cache_get_field_content_float(0,"Y");
hInfo[i][hPos][2] = cache_get_field_content_float(0,"Z");
cache_get_field_content(i,"Owner",hInfo[i][hOwner],Connection,64);
hInfo[i][hIndex] = cache_get_field_content_int(i,"ID");
hInfo[i][hPrice] = cache_get_field_content_int(i,"Price");
hInfo[i][hPos][0] = cache_get_field_content_float(i,"X");
hInfo[i][hPos][1] = cache_get_field_content_float(i,"Y");
hInfo[i][hPos][2] = cache_get_field_content_float(i,"Z");
//This is under OnGameModeInit
mysql_function_query(Connection,"SELECT * FROM houses",true,"LoadHouses","");
public LoadHouses()
{
new string[40] = "House owner:",fields;
cache_get_data(Housess, fields, Connection);
for(new i = 0; i < Housess; i++)
{
cache_get_field_content(i,"Owner",hInfo[i][hOwner],Connection,64);
hInfo[i][hIndex] = cache_get_field_content_int(i,"ID");
hInfo[i][hPrice] = cache_get_field_content_int(i,"Price");
hInfo[i][hPos][0] = cache_get_field_content_float(i,"X");
hInfo[i][hPos][1] = cache_get_field_content_float(i,"Y");
hInfo[i][hPos][2] = cache_get_field_content_float(i,"Z");
hInfo[i][hOne] = CreateDynamicPickup(1273, 1, hInfo[i][hPos][0], hInfo[i][hPos][1], hInfo[i][hPos][2], 0);
strcat(string, hInfo[i][hOwner], sizeof (string));
hInfo[i][hTwo] = CreateDynamic3DTextLabel(string, COLOR_WHITE, hInfo[i][hPos][0], hInfo[i][hPos][1], hInfo[i][hPos][2], 0, 0, 0);
}
printf("Loaded %d houses",Housess);
return 1;
}
public LoadAccount(playerid)
{
cache_get_field_content(0,"Password",pInfo[playerid][Password]);
pInfo[playerid][Level] = cache_get_field_content_int(0,"Level");
pInfo[playerid][Hours] = cache_get_field_content_int(0,"Hours");
pInfo[playerid][Minutes] = cache_get_field_content_int(0,"Minutes");
return 1;
}
|
Then how to load player account ? ?
Код:
public LoadAccount(playerid)
{
cache_get_field_content(0,"Password",pInfo[playerid][Password]);
pInfo[playerid][Level] = cache_get_field_content_int(0,"Level");
pInfo[playerid][Hours] = cache_get_field_content_int(0,"Hours");
pInfo[playerid][Minutes] = cache_get_field_content_int(0,"Minutes");
return 1;
}
|
cache_get_field_content(0,"Password",pInfo[playerid][Password]);
pInfo[playerid][Level] = cache_get_field_content_int(1,"Level");
pInfo[playerid][Hours] = cache_get_field_content_int(2,"Hours");
pInfo[playerid][Minutes] = cache_get_field_content_int(3,"Minutes");
Password | Level | Hours | Minutes