Ini to mysql
#1

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


Forum Jump:


Users browsing this thread: 1 Guest(s)