SA-MP Forums Archive
Problem show dialog! - 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: Problem show dialog! (/showthread.php?tid=623794)



Problem show dialog! - Cerealguy - 05.12.2016

PHP код:
BanCheck(playerid)
{
    new
        
retrieveName[MAX_PLAYER_NAME],
        
retrieveBannedBy[MAX_PLAYER_NAME],
        
retrieveReason[50],
        
retrieveBanDate,
        
retrieveDuration,
        
retrieveGCPI[60],
        
retrieveIP[16 + 1],
        
Query[380]
    ;
    
GetPlayerIp(playerid, retrieveIP, sizeof(retrieveIP));
    
gpci(playerid, retrieveGCPI, sizeof(retrieveGCPI));
    
    
format(Query, sizeof(Query), "SELECT * FROM `Bans` WHERE `Name` = '%s' COLLATE NOCASE OR `GPCI` = '%s' OR `IP` = '%s' LIMIT 1", GetPlayerName(playerid), retrieveGCPI, retrieveIP);
    
queryresult = db_query(Database, Query);
    if(
db_num_rows(queryresult))
    {
        
db_get_field_assoc(queryresult, "Name", retrieveName, sizeof(retrieveName));
        
db_get_field_assoc(queryresult, "BannerName", retrieveBannedBy, sizeof(retrieveBannedBy));
        
db_get_field_assoc(queryresult, "Reason", retrieveReason, sizeof(retrieveReason));
        
retrieveBanDate = db_get_field_assoc_int(queryresult, "BANDATE");
        
retrieveDuration = db_get_field_assoc_int(queryresult, "UNBANDATE");
        if(
gettime() - retrieveDuration > (retrieveDuration - retrieveBanDate))
        {
            
format(Query, sizeof(Query), "Your ban expired on %s \nWelcome back %s!", TimestampToDateTime(retrieveDuration), GetPlayerName(playerid));
            
SendClientMessage(playerid, COLOR_SERVER, Query);
            
format(Query, sizeof(Query), "DELETE * FROM `Bans` WHERE `Name` = '%s'", retrieveName);
            
queryresult = db_query(Database, Query);
            
        }
        else
        {
            new 
globalString[400];
            
format(globalString, sizeof(globalString), "Username: %s - Banned IP: %s", retrieveName, retrieveIP, retrieveBannedBy);
            return 
ShowPlayerDialog(playerid, DIALOG_BANINFO, DIALOG_STYLE_MSGBOX, ""COL_BLUE"Information - "COL_RED"Account BANNED!", globalString, "Exit", ""); //no show this dialog!
        
}
    }
    
db_free_result(queryresult);
    return 
0;
} 
This dialog!
PHP код:
new globalString[400];
format(globalString, sizeof(globalString), "Username: %s - Banned IP: %s", retrieveName, retrieveIP, retrieveBannedBy);
return 
ShowPlayerDialog(playerid, DIALOG_BANINFO, DIALOG_STYLE_MSGBOX, ""COL_BLUE"Information - "COL_RED"Account BANNED!", globalString, "Exit", ""); //no show this dialog! 



Re: Problem show dialog! - TheRohlikar - 05.12.2016

Well,... I don't know, if that is problem which cause not showing dialog but...

" format(globalString, sizeof(globalString), "Username: %s - Banned IP: %s", retrieveName, retrieveIP, retrieveBannedBy); "

You do not use all three parameters in your string.


Respuesta: Re: Problem show dialog! - Cerealguy - 05.12.2016

Quote:
Originally Posted by TheRohlikar
Посмотреть сообщение
Well,... I don't know, if that is problem which cause not showing dialog but...

" format(globalString, sizeof(globalString), "Username: %s - Banned IP: %s", retrieveName, retrieveIP, retrieveBannedBy); "

You do not use all three parameters in your string.
I did not notice it, but it is not the cause of the problem jeje


Re: Problem show dialog! - TheRohlikar - 05.12.2016

Have you tried "prints" ?
Where it ends...


Respuesta: Re: Problem show dialog! - Cerealguy - 05.12.2016

Quote:
Originally Posted by TheRohlikar
Посмотреть сообщение
Have you tried "prints" ?
Where it ends...
i test with SendClientMessage and working


Re: Problem show dialog! - TheRohlikar - 05.12.2016

Try it without "return". Make less "globalString" (this is unnecessary too I guess).. I really do not know, so I am just trying.


Respuesta: Re: Problem show dialog! - Cerealguy - 05.12.2016

Quote:
Originally Posted by TheRohlikar
Посмотреть сообщение
Try it without "return". Make less "globalString" (this is unnecessary too I guess).. I really do not know, so I am just trying.
Thank you for trying to help me, but that will not help. Globalstring 400 is for testing i chaging later


Respuesta: Problem show dialog! - Cerealguy - 05.12.2016

SOLVED, i add leave fuction and add code direct in OnPlayerConnect!