SQL Problem
#1

So this is how it goes , I have a problem with my "factions" table in the database. The server kinda mixes up two fields called "fName" and "fRankAmount" . If I set my RankAmount to 12 , after I restart the gamemode the faction will be called "12" instead of "Los Santos Police Department" for example.
I'm gonna give you a screenshot of the table.



After I restart the gamemode it reads my RankAmount as the faction's name and if I try to invite someone in the faction I get the message " You must set your FactionRankAmount first"

Here is the screenshot of the table design :




If anyone has any ideas/suggestions please speak your mind ! I'm in a dead spot right now,can't figure that out.
Reply
#2

Check the SaveFactions and LoadFactions.
Reply
#3

Код:
forward LoadFactions();
public LoadFactions()
{
	new arrCoords[28][64];
	new sql[80], row[512];
	format(sql, sizeof(sql), "SELECT COUNT(*) FROM Factions");
	mysql_query(sql);
	mysql_store_result();
	mysql_fetch_row(row);
	totalfactions = 11;
	mysql_free_result();
Код:
forward SaveFactions(busid);
public SaveFactions(busid)
{
	new query[1024];
	printf("Saving Faction %d.",busid);
	format(query, sizeof(query), "UPDATE Factions SET SpawnX=%f,SpawnY=%f,SpawnZ=%f,fName='%s',fBank=%d WHERE FactionID=%d",
	DynamicFactions[busid][fX],
	DynamicFactions[busid][fY],
	DynamicFactions[busid][fZ],
	DynamicFactions[busid][fName],
	DynamicFactions[busid][fBank],
	busid);
	mysql_query(query);
Is there anything wrong with these pieces of code ? I'm not that good with PAWN , I just know SQL.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)