SA-MP Forums Archive
Ini to mysql - 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: Ini to mysql (/showthread.php?tid=643828)



Ini to mysql - ArianGubetini - 28.10.2017

Hello guys.Im trying to move my users from ini to mysql but im having many errors and I can not get it to work.

This is my code when it stores the data when player register...,can you guys just show me some of the lines how it should be on the mysql then i will continue with others....Thank you.

https://pastebin.com/P9kDUFfP


Re: Ini to mysql - Lucases - 28.10.2017

pawn Код:
new MySQL:database;
pawn Код:
public OnGameModeInit()
{
         database = mysql_connect(MYSQL_HOSt, MYSQL_USER, MYSQL_PASS, MYSQL_DATABASE);
         print("Database succesfully loaded");
         return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
         new query[128], pname[MAX_PLAYER_NAME];
         GetPlayerName(playerid, pname, sizeof(pname));
         mysql_format(database, query, sizeof(query), "SELECT * FROM players WHERE username = '%s' , pname);
         new Cache:result = mysql_query(database, query);
         if(cache_get_num_rows(result));
         {
               // login
         }
         else
         {
               //register
         }
         cache_delete(result);
         return 1;
}
You don't need to convert all your script, just loading and saving data parts.