[Plugin] [REL] SA:MP MySQL Plugin 2.1.1 - Released (1/25/2011
#81

Quote:
Originally Posted by Darkly_Face
no i know what that means but... idk how to connect
You need a Mysql server & DB
Then add this into your GM
pawn Код:
#define MYSQL_HOST "YOUR MYSQLIP"
#define MYSQL_USER "USERNAME"
#define MYSQL_PASS "PASS"
#define MYSQL_DB  "DATABASENAME"
There you go
Reply
#82

I'm sure he doesn't even have mysql_connect.

Do CTRL + F, and write "mysql_connect", without the ".
Any results?
Reply
#83

i didnt knew how to connect
Reply
#84

It needs MySQL Supporting Website
Reply
#85

Quote:
Originally Posted by [GTA
Deadly_Evil ]
It needs MySQL Supporting Website
What'd you mean?
Reply
#86

Quote:
Originally Posted by Sma_X
Quote:
Originally Posted by dengli
hello,this is a good plugin.
I run it on my PC with WINXP OS,it works fine.
But when i run this plugin in my Server with CentOS5.4, it can't work
I check the server log
it shows "Failed (/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by plugins/mysql.so))"
Can someone help me ,thx..
obviously you don't have libstdc installed.

on CentOS from root user use:

Код:
yum install libstdc++ -y 
yum install libstdc++-devel -y
thank you for your help,but it still don't work.
http://www.dumpt.com/img/viewer.php?...c9piamirwj.jpg
it show this , i don't know why.
Reply
#87

show me the output of
Код:
locate libstdc++.so
Reply
#88

Quote:
Originally Posted by Sma_X
show me the output of
Код:
locate libstdc++.so
thank you a lot
this is the output.
http://www.dumpt.com/img/viewer.php?...wp3fop7nb0.jpg
Reply
#89

If you use:
Код:
lls -al /usr/lib/libstdc++.so.6
I guess it should be symlinked like this
Код:
lrwxrwxrwx 1 root root 18 Jan 25 11:37 /usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.8
and.. it should work.

It's still not working ?
Reply
#90

Hi

Now I need help, because when my server online about 24 hours I don't know why but randomly if anybody connected this code start flooding, with mysql_query.
And the server freezed ( no crashed ), and when anybody trying to join its stops at "Connecting to .."

My code is this:

pawn Код:
public OnPlayerConnect(playerid)
{
  AccountInfo[playerid][SaveTick] = 0;
  return 1;
}

// This timer called every 1000ms
public Update()
{
    foreach(Player, i)
    {
      if(AccRegistered[i] == 1)
        {
          AccountInfo[i][SaveTick]++;
          // Stats saved every 10 minutes
            if(AccountInfo[i][SaveTick] > 600)
            {
              SavePlayerStats(i);
              AccountInfo[i][SaveTick] = 0;
            }
        }
    }
}
         
         
stock SavePlayerStats(playerid)
{
    new name[MAX_PLAYER_NAME],
        query[300];

    GetPlayerName(playerid, name, sizeof(name));
   
    // This code start flooding when XY connected to the server, and I think thats a reason for the server get freezed
    format(query,sizeof(query),"UPDATE `users` SET Score=%d,Kills=%d,Deaths=%d,RaceWon=%d,PickupFound=%d,KillingSpree=%d,Weeks=%d,Days=%d,Hours=%d,Minutes=%d,Color=%d,Money=%d WHERE (Username = '%s')",
        GetPlayerScore(playerid), AccountInfo[playerid][Kills], AccountInfo[playerid][Deaths], AccountInfo[playerid][RaceWon], AccountInfo[playerid][PickupFound], AccountInfo[playerid][KillingSprees], AccountInfo[playerid][Weeks], AccountInfo[playerid][Days], AccountInfo[playerid][Hours], AccountInfo[playerid][Minutes], AccountInfo[playerid][Color], GetPlayerMoneyEx(playerid), name);

    mysql_query(query);
    return 1;
}
Reply
#91

EDIT: Sorry, I must pay some more attention at the code in future
but just a question .. why don't you create the timer at 10 minutes then, instead of one at 1 sec and just keep incrementing that value?
Reply
#92

Quote:
Originally Posted by Sma_X
Код:
		  AccountInfo[i][SaveTick]++;
		  // Stats saved every 10 minutes
			if(AccountInfo[i][SaveTick] > 600)
Then, every time it's bigger than 600 if you don't reset it .. and it's just still updating.

perhaps if you reset the value of AccountInfo[i][SaveTick] ..

try this and see if it works

Quote:

stock SavePlayerStats(playerid)
{
new name[MAX_PLAYER_NAME],
query[300];

GetPlayerName(playerid, name, sizeof(name));

// This code start flooding when XY connected to the server, and I think thats a reason for the server get freezed
format(query,sizeof(query),"UPDATE `users` SET Score=%d,Kills=%d,Deaths=%d,RaceWon=%d,PickupFound =%d,KillingSpree=%d,Weeks=%d,Days=%d,Hours=%d,Minu tes=%d,Color=%d,Money=%d WHERE (Username = '%s')",
GetPlayerScore(playerid), AccountInfo[playerid][Kills], AccountInfo[playerid][Deaths], AccountInfo[playerid][RaceWon], AccountInfo[playerid][PickupFound], AccountInfo[playerid][KillingSprees], AccountInfo[playerid][Weeks], AccountInfo[playerid][Days], AccountInfo[playerid][Hours], AccountInfo[playerid][Minutes], AccountInfo[playerid][Color], GetPlayerMoneyEx(playerid), name);

mysql_query(query);
AccountInfo[playerid][SaveTick] = 0; // reset the value at 0
return 1;
}

but just a question .. why don't you create the timer at 10 minutes then, instead of one at 1 sec and just keep incrementing that value?
but gets reseted to 0:

pawn Код:
if(AccountInfo[i][SaveTick] > 600)
{
  SavePlayerStats(i)
  AccountInfo[i][SaveTick] = 0; // Reset SaveTick
}
I have some code in this timer, and I don't saving all players stats same time the savetick is because of this.

Up: But the timer is runing every 1000ms, and in the mysql log I see the qouery sended about ~10 times / second
Reply
#93

do you have anything in
OnPlayerUpdate ?
or is SavePlayerStats(playerid) called anywhere else ?
Reply
#94

Quote:
Originally Posted by Sma_X
do you have anything in

OnPlayerUpdate ?
No, I only update player stats there and at OnPlayerDisconnect, and I think, thats the problem because, I see this in the log.
Reply
#95

Is the same queries processed ~10 times per second or different queries (different players)?
Reply
#96

With same player and same queries ( only one player ), and continuously till then I do not restart the server.

I remembered now that the stats values were growing after updates.
Reply
#97

Why not to create a timer on each player's login when he logs in, that will save the account?
Reply
#98

To make 500 timer if 500 players are online? ( my server do not have 500 players, this only was hypothesis )
Reply
#99

Why not just save stats on disconnect? I find saving stats all the time pretty stupid.
Reply

Quote:
Originally Posted by $ЂЯĢ
Why not just save stats on disconnect? I find saving stats all the time pretty stupid.
Because if the server crashed, the players stats lose. ( Or i restarted the server from my control panel )

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)