SA-MP Forums Archive
MySQL system ( Get prameters ) - 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: MySQL system ( Get prameters ) (/showthread.php?tid=589447)



MySQL system ( Get prameters ) - AlexBlack - 19.09.2015

Hello, today i'am going to make a IC Email system and i have a small problem, so i want when player use /email command he got a dialog like this format " Email Title - Sender " and it's load this from database ( load when player do /email not when gamemode launched or player connect ) , but now i don't have really idea how to make when player select one of the Emails he got the text, check my code :

PHP код:
CMD:email(playeridparams[])
{
    new 
option[24], string[24];
    if(
sscanf(params"s[24]S()[128]"optionstring))
    {
        
Usage(playerid"/email [action]");
        
Usage(playerid"[ACTIONS] write, view.");
    }
    if (!
strcmp(option"write"true))
    {
/*        static
            email[24], text;
        if (sscanf(string, "s[24]s[255]", email, text))
            return Usage(playerid, "/email [send] [Email destination] [text]");
            
        if(strfind(string, DEFAULT_DOMAIN, true) != -1)
        {
                         --  COMING SOON --
        }*/
        
return 1;
    }
    if (!
strcmp(option"giew"true))
    {
        
ListPlayerEmail(playerid);
    }
    return 
1;

Load from database :

PHP код:
ListPlayerEmail(playerid)
{
    static
        
query[160];
    
format(querysizeof(query), "SELECT * FROM `emails` WHERE `Receiver` = %s"pInfo[playerid][pICEmail]);
    return 
mysql_tquery(dbHandlequery"OnEmailFind""d"playerid);

Response callback:

PHP код:
public OnEmailFind(playerid)
{
    new 
emailtitle[50], emailsender[50], string[1024], emailstatus;
    new 
rows cache_num_rows();
    if(
rows)
    {
        new 
loaded;
        for (
loaded 0loaded != rows; ++loaded)
        {
            
cache_get_field_content(loaded"Sender"emailsender50);
            
cache_get_field_content(loaded"Title"emailtitle255);
            
emailstatus cache_get_field_content_int(loaded"Status");
            
pInfo[playerid][EmailChoice] = rows;
            if(
emailstatus == 1format(stringsizeof(string), "%s "COL_RED" Title : %s - By : %s\n"emailtitleemailsender);
            else 
format(stringsizeof(string), "%s "COL_WHITE" Title: %s - by : %s\n"emailtitleemailsender);
        }
        
Dialog_Show(playeridDialogEmailDIALOG_STYLE_TABLISTpInfo[playerid][pICEmail], string"Select""Close");
    }
    else return 
Server(playerid"You don't have any Email.");
    return 
1;

Thank's for advance.


Re : MySQL system ( Get prameters ) - AlexBlack - 19.09.2015

Anyone ?