Ini to mysql
#2

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.
Reply


Messages In This Thread
Ini to mysql - by ArianGubetini - 28.10.2017, 12:13
Re: Ini to mysql - by Lucases - 28.10.2017, 18:57

Forum Jump:


Users browsing this thread: 1 Guest(s)