Server crashes.
#1

Hi all. I don't know what happen... When i use any variable, my server crashes... for ex:

when player spawn i set this variable:

Код:
PlayerData[ playerid ][ Spawned ] = 1;
i get crache...

I give player admin:

Код:
COMMAND:giveadmin(playerid,params[])
{
	if(!IsPlayerAdmin(playerid)) { return 1; }
	new AdminID;
	if (sscanf(params, "u", AdminID)){SendClientMessage(playerid, COLOR_ORANGE, "* Give player admin /giveadmin [part of name/ID]");return 1;}
	if( AdminID == INVALID_PLAYER_ID ){SendClientMessage( playerid, COLOR_RED, "* This player do not exist!" );return 1;}

	PlayerData[AdminID][Admin] = 1;
	SendClientMessage(AdminID,COLOR_GREEN,"* You are admin.");
	return 1;
}
I get message: "* You are admin.", but i get crache..

Can say anybody what happen here with variables?
Reply
#2

can you show me new PlayerData[MAX_PLAYERS][ENUM]; and the eum of the PlayerData ?
Reply
#3

Код:
enum PlayerDB
{
	Admin	,
        Vip,
        Money,
        XP
}
new PlayerData[ MAX_PLAYERS ][ PlayerDB ];
Reply
#4

okay,

there isnt Spawned in the enum.

you also forgot to write ; after } in enum

make like that:

pawn Код:
enum PlayerDB
{
        Admin,
        Vip,
        Money,
        XP,
        Spawned
};

new PlayerData[MAX_PLAYERS][PlayerDB];
This should work. Good Luck
Reply
#5

I think here is problem:


Код:
[21:38:35] >> mysql_query( Connection handle: 1 )
[21:38:35] CMySQLHandler::Query(SELECT * FROM `players2` WHERE `Name` = 'Audriuxxx') - Successfully executed.
[21:38:35] >> mysql_store_result( Connection handle: 1 )
[21:38:35] CMySQLHandler::StoreResult() - Result was stored.
[21:38:35] >> mysql_num_rows( Connection handle: 1 )
[21:38:35] CMySQLHandler::NumRows() - Returned 1 row(s)
[21:38:35] >> mysql_num_rows( Connection handle: 1 )
[21:38:35] CMySQLHandler::NumRows() - Returned 1 row(s)
[21:38:35] >> mysql_free_result( Connection handle: 1 )
[21:38:35] CMySQLHandler::FreeResult() - Result was successfully free'd.
[21:38:49] >> mysql_query( Connection handle: 1 )
[21:38:49] CMySQLHandler::Query(SELECT * FROM `players2` WHERE `Name` = 'Ohes' AND `password` = 'lNOTIMPORTANT') - Successfully executed.
[21:38:49] >> mysql_store_result( Connection handle: 1 )
[21:38:49] CMySQLHandler::StoreResult() - Result was stored.
[21:38:49] >> mysql_num_rows( Connection handle: 1 )
[21:38:49] CMySQLHandler::NumRows() - Returned 1 row(s)
[21:38:49] >> mysql_free_result( Connection handle: 1 )
[21:38:49] CMySQLHandler::FreeResult() - Result was successfully free'd.
[21:40:15]  
[21:40:15] ---------------------------
[21:40:15] MySQL Debugging activated (06/29/12)
[21:40:15] ---------------------------
[21:40:15]  
[21:40:15] >> mysql_connect( )
[21:40:15] CMySQLHandler::CMySQLHandler() - constructor called.
[21:40:15] CMySQLHandler::CMySQLHandler() - Connecting to "NOTIMPORTANT" | DB: "NOTIMPORTANT" | Username: "NOTIMPORTANT" ...
[21:40:15] CMySQLHandler::Connect() - Connection was successful.
[21:40:15] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[21:40:15] >> mysql_ping( Connection handle: 1 )
[21:40:15] CMySQLHandler::Ping() - Connection is still alive.
Can you explane me this? connected me to database later, then i use mysql in server, look at the time.... I connect mysql, OnGameModeInit()
Reply
#6

the logs of mysql goes fine. do you have skype or msn?
Reply
#7

i have mean, connect to database is later, before some time all was well:

First of all was connecting to my database. Now connect me to database later...
Reply
#8

Now i see a lot of times i get connect to mysql database, but i connect just when game mode is on.. look:

Код:
[22:03:34]  
[22:03:34] ---------------------------
[22:03:34] MySQL Debugging activated (06/29/12)
[22:03:34] ---------------------------
[22:03:34]  
[22:03:34] >> mysql_connect( )
[22:03:34] CMySQLHandler::CMySQLHandler() - constructor called.
[22:03:34] CMySQLHandler::CMySQLHandler() - Connecting to "NA" | DB: "NA" | Username: "NA" ...
[22:03:34] CMySQLHandler::Connect() - Connection was successful.
[22:03:34] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[22:03:34] >> mysql_ping( Connection handle: 1 )
[22:03:34] CMySQLHandler::Ping() - Connection is still alive.
[22:06:42] >> mysql_query( Connection handle: 1 )
[22:06:42] CMySQLHandler::Query(SELECT * FROM `players2` WHERE `Name` = 'NNN') - Successfully executed.
[22:06:42] >> mysql_store_result( Connection handle: 1 )
[22:06:42] CMySQLHandler::StoreResult() - Result was stored.
[22:06:42] >> mysql_num_rows( Connection handle: 1 )
[22:06:42] CMySQLHandler::NumRows() - Returned 1 row(s)
[22:06:42] >> mysql_num_rows( Connection handle: 1 )
[22:06:42] CMySQLHandler::NumRows() - Returned 1 row(s)
[22:06:42] >> mysql_free_result( Connection handle: 1 )
[22:06:42] CMySQLHandler::FreeResult() - Result was successfully free'd.
[22:07:15] >> mysql_query( Connection handle: 1 )
[22:07:15] CMySQLHandler::Query(SELECT * FROM `players2` WHERE `Name` = 'NNN' AND `password` = 'NNNN') - Successfully executed.
[22:07:15] >> mysql_store_result( Connection handle: 1 )
[22:07:15] CMySQLHandler::StoreResult() - Result was stored.
[22:07:15] >> mysql_num_rows( Connection handle: 1 )
[22:07:15] CMySQLHandler::NumRows() - Returned 1 row(s)
[22:07:15] >> mysql_free_result( Connection handle: 1 )
[22:07:15] CMySQLHandler::FreeResult() - Result was successfully free'd.
[22:09:08]  
[22:09:08] ---------------------------
[22:09:08] MySQL Debugging activated (06/29/12)
[22:09:08] ---------------------------
[22:09:08]  
[22:09:08] >> mysql_connect( )
[22:09:08] CMySQLHandler::CMySQLHandler() - constructor called.
[22:09:08] CMySQLHandler::CMySQLHandler() - Connecting to "NA" | DB: "NA" | Username: "NA" ...
[22:09:08] CMySQLHandler::Connect() - Connection was successful.
[22:09:08] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.
[22:09:08] >> mysql_ping( Connection handle: 1 )
[22:09:08] CMySQLHandler::Ping() - Connection is still alive.
How this can possible twice connections

Here is my connect to mysql:
Код:
public OnGameModeInit()
{
mysql_debug(1); //enable debug
	mysql_connect( MySQL_HOST,MySQL_USER,MySQL_DATA,MySQL_PASS );
	if( mysql_ping( ) >= 1 )
	{
		print( "CONNECTION TO MYSQL WAS SUCEFFULY" );
	}
	else
	{
		print( "PLEASE ON MSQL!" );
	}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)