24.08.2018, 23:42
Quote:
Again, why are you storing multiple values in a single column? That's really not how you should be using a database. Make a new table for the object IDs and store one per row.
|
I already have a table with all objects and x,y,z: https://imgur.com/a/jmB80p3
So, above is a pictures with all the objects and x,y,z. When a new player register, he got some random objectID from this table, and all the id that player get, i'm saving in a different table.
And i'm using something like that to save the id in database.
Код:
public saveQuest(playerid) { generateIdRandomFromDb(playerid); new string[256]; string[0] = (EOS); for(new x; x < 50; x++) { format(string, sizeof string, "%s %d", questInfo[playerid][databaseID_object][x]); } mysql_format(db, string, sizeof string, "UPDATE `special_table` SET `objectID` = '%e' WHERE `playerID` = %d LIMIT 1;", string, pID[playerid]); mysql_tquery(db, string); }
And simply, when a player connect, i've loaded his id of an object from database:
Код:
// public LoadQuest (playerid) { mysql_format(db, Gstring, "SELECt blablabla.... WHERE id .. bla blabla mysql_tquery(db, Gstrin, bla bla bla.. } //another public public finishLoad(playerid) { if(!cache_num_rows()) return 1; new show_s[300], var_storage[50]; cache_get_field_content(0, "ObjectID", show_s); sscanf(show_s, "a<i>[50]", var_storage); for(new x; x < 50; x++) { questInfo[playerid][databaseID_object][x] = var_storage[x]; } }
to make a loop and create red marker on the San Andreas map.