SA-MP Forums Archive
Send mysql logs to ingame - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Send mysql logs to ingame (/showthread.php?tid=650078)



Send mysql logs to ingame - Score - 20.02.2018

Hello, is there any way to send mysql logs ingame?

I have a code on my script but that doesn't work..

PHP код:
public OnGameModeInit()
{
    new 
string[300];
    
format(string, sizeof(string), "%s", mysql_log(ALL));
    
mysql_log(ALL);
    
SendClientMessageToAll(COLOR_ORANGE, string); 



Re: Send mysql logs to ingame - AlexMSK - 20.02.2018

yep you can do it under onqueryerror
https://sampwiki.blast.hk/wiki/MySQL#OnQueryError


Re: Send mysql logs to ingame - Score - 20.02.2018

Quote:
Originally Posted by AlexMSK
Посмотреть сообщение
yep you can do it under onqueryerror
https://sampwiki.blast.hk/wiki/MySQL#OnQueryError
I want to send debugs and stuff, for example i get this on my mysql_logs.txt

PHP код:
[00:54:30] [DEBUG] mysql_tquery: return value: '1'
[00:54:30] [DEBUG] mysql_tquery(1, "CREATE TABLE IF NOT EXISTS `temp_blocked_users` (`ip` VARCHAR(18), `lock_timestamp` INT, `user_id` INT)", "", "")
[
00:54:30] [DEBUG] CCallback::Create(amx=0x236a4a0, name='', format='', params=0x341d72c, param_offset=5)
[
00:54:30] [DEBUG] CHandle::Execute(this=0x5e7ee0, type=1, query=0x5f7250)
[
00:54:30] [DEBUG] CHandle::Execute - return value: true
[00:54:30] [DEBUG] mysql_tquery: return value: '1'
[00:54:30] [DEBUG] CConnection::Execute(query=0x5f4c38, this=0x52f020, connection=0x5f4858)
[
00:54:30] [DEBUG] CConnection::GetError(this=0x52f020, connection=0x5f4858)
[
00:54:30] [DEBUG] CConnection::Execute(query=0x5f7250, this=0x52f020, connection=0x5f4858)
[
00:54:30] [DEBUG] CConnection::GetError(this=0x52f020, connection=0x5f4858)
[
00:54:30] [DEBUG] CCallback::Create(amx=0x236a4a0, name='OnQueryError', format='dsssd)
[00:54:30] [DEBUG] CCallback::Create(amx=0x236a4a0, name='
OnQueryError', format='dsssd) 
i want to send that ingame too..


Re: Send mysql logs to ingame - AlexMSK - 20.02.2018

PHP код:
#define DIALOG_ERROR -1
public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
{
    for(new 
i = 0, j = GetPlayerPoolSize(); i <= j; i++)
    {
        new
            
string[2048];
        
format(string, sizeof(string), "Error ID: %i\nCallback: %s\nQuery: %s\nError: %s\n", errorid, callback, query, error);
        
ShowPlayerDialog(i, DIALOG_ERROR, DIALOG_STYLE_MSGBOX, "Mysql Error", string, "Close", "");
    }
    return 
1;
} 



Re: Send mysql logs to ingame - Score - 20.02.2018

Quote:
Originally Posted by AlexMSK
Посмотреть сообщение
PHP код:
#define DIALOG_ERROR -1
public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
{
    for(new 
i = 0, j = GetPlayerPoolSize(); i <= j; i++)
    {
        new
            
string[2048];
        
format(string, sizeof(string), "Error ID: %i\nCallback: %s\nQuery: %s\nError: %s\n", errorid, callback, query, error);
        
ShowPlayerDialog(i, DIALOG_ERROR, DIALOG_STYLE_MSGBOX, string, "Close", "");
    }
    return 
1;
} 
I think you can't understand me, i want to send the same exact texts from mysql_logs.txt to ingame.

PHP код:
new string[300];
    
format(string, sizeof(string), "%s", mysql_log(ALL));
    
mysql_log(ALL);
    
SendClientMessageToAll(COLOR_ORANGE, string); 
This is what i tried to do, thanks.


Re: Send mysql logs to ingame - AlexMSK - 20.02.2018

It will send you the same log, just in another explication


Re: Send mysql logs to ingame - Score - 20.02.2018

Quote:
Originally Posted by AlexMSK
Посмотреть сообщение
It will send you the same log, just in another explication
How can i do it like this, example send the text to all players online.


PHP код:
[DEBUG] mysql_tquery: return value: '1' 
[DEBUG] mysql_tquery(1, "CREATE TABLE IF NOT EXISTS `temp_blocked_users` (`ip` VARCHAR(18), `lock_timestamp` INT, `user_id` INT)", "", "") 
[
DEBUG] CCallback::Create(amx=0x236a4a0, name='', format='', params=0x341d72c, param_offset=5) 
[
DEBUG] CHandle::Execute(this=0x5e7ee0, type=1, query=0x5f7250) 
[
DEBUG] CHandle::Execute - return value: true 
[DEBUG] mysql_tquery: return value: '1' 
[DEBUG] CConnection::Execute(query=0x5f4c38, this=0x52f020, connection=0x5f4858) 
[
DEBUG] CConnection::GetError(this=0x52f020, connection=0x5f4858) 
[
DEBUG] CConnection::Execute(query=0x5f7250, this=0x52f020, connection=0x5f4858) 
[
DEBUG] CConnection::GetError(this=0x52f020, connection=0x5f4858) 
[
DEBUG] CCallback::Create(amx=0x236a4a0, name='OnQueryError', format='dsssd) 
[DEBUG] CCallback::Create(amx=0x236a4a0, name='
OnQueryError', format='dsssd) 
How to send all of these debugs ingame?


Re: Send mysql logs to ingame - iLearner - 20.02.2018

I think you can't unless Maddinat0r makes a function for that.


Re: Send mysql logs to ingame - rfr - 20.02.2018

can't you just read the log file and then send it ingame


Re: Send mysql logs to ingame - iKarim - 20.02.2018

Why do you even want to send that ingame? That's totally unnecessary, you have the files for a reason.