Zmajk0

Untitled

Aug 29th, 2020
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public OnGameModeInit()
  2. {
  3. //Connecting to the MySQL database, default connection handle.
  4. SQL::Connect(mysql_host, mysql_user, mysql_pass, mysql_db);
  5. //Checking if the table 'players' exists
  6.  
  7. //Checking if the table 'players' exists
  8. if(!SQL::ExistsTable(SQL_PLAYERS_TABLE))
  9. {
  10. //If not, then create a table called 'players'.
  11. new handle = SQL::Open(SQL::CREATE, SQL_PLAYERS_TABLE); //Opening a valid handle to create a table called 'players'
  12. SQL::AddTableColumn(handle, "p_id", SQL_TYPE_INT, 11, true); //Setting auto-increment for this field.
  13. SQL::AddTableColumn(handle, "p_name", SQL_TYPE_VCHAR, 24);
  14. SQL::AddTableColumn(handle, "p_password", SQL_TYPE_VCHAR, 64);
  15. SQL::AddTableColumn(handle, "p_score", SQL_TYPE_INT);
  16. SQL::AddTableColumn(handle, "p_posx", SQL_TYPE_FLOAT);
  17. SQL::AddTableColumn(handle, "p_posy", SQL_TYPE_FLOAT);
  18. SQL::AddTableColumn(handle, "p_posz", SQL_TYPE_FLOAT);
  19. SQL::Close(handle);//Closing the previous opened handle.
  20. }
  21. return 1;
  22. }
RAW Paste Data