MySQL Database + Errorrs [REP+]
#1

Hello guys

I got a gamemode and I am trying to read and improve it as I can but when I am trying to run the gamemode not in local but on my public server it says that the gamemode is unknown

Here is a define

PHP код:
#define USE_LOCALHOST   true 
I want to run it on public so I have to change it to false right? If I will change it to false I get 2 errors


PHP код:
gamemode.pwn(33048) : error 017undefined symbol "LOCAL_HOST"
gamemode.pwn(33059) : error 017undefined symbol "LOCAL_HOST" 
Also I created a database a database and I tried to connect script with the phpMyAdmin and I don't know whats the problem but it says that the gamemode is unknown

REP+ to everybody who will reply to this topic
Thanks for reading
Reply
#2

The variable LOCAL_HOST that you are calling does not exist. Has nothing to do with your define posted. Also: some mysql servers are on the same server as the gamemode is. If your database is on that same server, call it as localhost.
Reply
#3

PHP код:
#if USE_LOCALHOST == true
#define LOCAL_HOST                 "localhost"
#define LOCAL_USER                 "root"
#define LOCAL_PASS                 ""
#define LOCAL_DB                   "server"
#else
#define SERVER_HOST                "127.0.0.1"
#define SERVER_USER                "port_7717"
#define SERVER_PASS                "mypass"
#define SERVER_DB                  "port_7717"
#endif 
So why it says that the gamemode is unknown? Also I want to run it on public server so if I will use local host I can't run the server for public
Reply
#4

Gamemode is unkown because your AMX is probably not compiled correctly. It's weird that your defines for the same variables are called differently. You should change LOCAL_HOST to SERVER_HOST and all LOCAL_HOSTs in your server to that as well. You can then use 'SERVER_HOST' to configure your database. Note that this is for all LOCAL_* variables to SERVER_* variable.
Reply
#5

Hi SecretBoss,

You should change your SERVER_ and LOCAL_ defines to the same defines and for example if you change LOCAL_ to SERVER_ you should edit all instances of LOCAL_ to SERVER_ to prevent further errors.

Because you are making USE_LOCALHOST false it LOCAL_HOST, LOCAL_DB etc... Here's an example:
pawn Код:
#define FILTERSCRIPT true

#include <a_samp>

#if defined FILTERSCRIPT true // Because FILTERSCRIPT is defined true only LOCAL_HOST will be defined. PUBLIC_HOST will not.

#define LOCAL_HOST "44"

#else

#define PUBLIC_HOST "55" // If we define FILTERSCRIPT as false PUBLIC_HOST will be defined, not LOCAL_HOST

#endif

main(){}

public OnGameModeInit()
{
    printf(LOCAL_HOST);
    printf(PUBLIC_HOST);
    return 1;
}
Reply
#6

This will take to long there are 30.000+ lines, is there any other way to fix that?
Reply
#7

Thanks you all guys I fixed the problem

I just changed

PHP код:
#if USE_LOCALHOST == true
#define LOCAL_HOST                 "localhost"
#define LOCAL_USER                 "root"
#define LOCAL_PASS                 ""
#define LOCAL_DB                   "server"
#else
#define SERVER_HOST                "127.0.0.1"
#define SERVER_USER                "port_7717"
#define SERVER_PASS                "mypass"
#define SERVER_DB                  "port_7717"
#endif 
to this

PHP код:
#if USE_LOCALHOST == true
#define SERVER_HOST                "127.0.0.1"
#define SERVER_USER                "port_7717"
#define SERVER_PASS                "mypass"
#define SERVER_DB                  "port_7717"
#else
#define LOCAL_HOST                 "localhost"
#define LOCAL_USER                 "root"
#define LOCAL_PASS                 ""
#define LOCAL_DB                   "server"
#endif 
Reply
#8

No problem SecretBoss.

For anyone wondering how they could quickly do this, I have created a quick guide below.
Quote:
Originally Posted by SecretBoss
Посмотреть сообщение
This will take to long there are 30.000+ lines, is there any other way to fix that?
There is a handy replace tool in Pawno that you can use to quickly replace characters.
http://i.imgur.com/UjjwEUd.png
http://i.imgur.com/8NzQ89M.png
Reply
#9

Oh thanks man I wish I could give you more rep, you worth it :P
Reply
#10

Quote:
Originally Posted by SecretBoss
Посмотреть сообщение
Thanks you all guys I fixed the problem

I just changed

PHP код:
#if USE_LOCALHOST == true
#define LOCAL_HOST                 "localhost"
#define LOCAL_USER                 "root"
#define LOCAL_PASS                 ""
#define LOCAL_DB                   "server"
#else
#define SERVER_HOST                "127.0.0.1"
#define SERVER_USER                "port_7717"
#define SERVER_PASS                "mypass"
#define SERVER_DB                  "port_7717"
#endif 
to this

PHP код:
#if USE_LOCALHOST == true
#define SERVER_HOST                "127.0.0.1"
#define SERVER_USER                "port_7717"
#define SERVER_PASS                "mypass"
#define SERVER_DB                  "port_7717"
#else
#define LOCAL_HOST                 "localhost"
#define LOCAL_USER                 "root"
#define LOCAL_PASS                 ""
#define LOCAL_DB                   "server"
#endif 
So you are not fixing the problem, but just making sure you can't work with it locally anymore. Also this is really prone to errors in the future. Spend some time with CTRL+R (replace) and you are done.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)