SQL Problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQL Problem (
/showthread.php?tid=405063)
SQL Problem -
Jony_Cruze - 05.01.2013
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.
Re: SQL Problem - Riddy - 05.01.2013
Check the SaveFactions and LoadFactions.
Re: SQL Problem -
Jony_Cruze - 05.01.2013
Код:
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.