I have some mysql email problems! Maybe someone can help me!
#1

Код:
	mysql_real_escape_string(inputtext,inputtext);
	switch(dialogid)
	{
	    case DIALOGID-1: // reply/delete
	    {
	        if(response)
	        {
	            ShowPlayerDialog(playerid,DIALOGID+31,DIALOG_STYLE_INPUT,"Compose","Input the Subject.\nMax Lenght: 100 symbols.","Ok","Back");
				return 1;
	        }
	        else
	        {
	            new query[128];
	            format(query,sizeof(query),"DELETE FROM `Emails` WHERE MK=%i LIMIT 1",MkP[playerid]);
	            QUERY(query);
	            SendClientMessage(playerid,0xFFFFFF30," * Message deleted!");
	            ShowEmail(playerid);
	            return 1;
	        }
	    }
	    case DIALOGID-2:
	    {
	        ShowEmail(playerid);
	        return 1;
	    }
	    case DIALOGID+1: // inbox
	    {
	        if(response)
			{
		        new result[1024], //this line
					name[MAX_PLAYER_NAME],
					Subject[100],
					Sender[60],
					Time[15],
					Date[20],
					Message[256],
					New=0,
					Mk;

				GetPlayerName(playerid,name,MAX_PLAYER_NAME);
			    format(result,sizeof(result),"SELECT `Sender`,`Subject`,`Time`,`Date`,`New`,`MK`,`Text` FROM `Emails` WHERE `Reciever`='%s' ORDER BY `MK` DESC LIMIT %i,1",name,listitem);
				QUERY(result);
				STORE;
				mysql_fetch_row_format(result,"|",mysql_connection);
				sscanf(result,"ssssiis",Sender,Subject,Time,Date,New,Mk,Message);
				replaceChar(Message,'~','\n');
				format(result,sizeof(result),"{FFFFFF}Date:{FF9933} %s{FFFF33} %s\n{FFFFFF}Sender:{FFFF33} %s\n{FFFFFF}Subject: %s\n\n\n%s",Date,Time,Sender,Subject,Message);
				FREE;

				format(RecieverP[playerid],60,"%s",Sender);
				MkP[playerid]=Mk;
				ShowPlayerDialog(playerid,DIALOGID-1,DIALOG_STYLE_MSGBOX,"Message",result,"Reply","Delete");
				if(New)
				{
				    format(result,sizeof(result),"UPDATE `Emails` SET `New`=0 WHERE `MK`='%i' LIMIT 1",Mk);
				    QUERY(result);
				}
			}
			else ShowEmail(playerid);
		    return 1;
	    }
	    case DIALOGID+2: // outbox
	    {
	        if(response)
	        {
		        new result[1024], //this line
					name[MAX_PLAYER_NAME],
					Subject[100],
					Reciever[60],
					Time[15],
					Date[20],
					Message[256];

				GetPlayerName(playerid,name,MAX_PLAYER_NAME);
			    format(result,sizeof(result),"SELECT `Reciever`,`Subject`,`Time`,`Date`,`Text` FROM `Emails` WHERE `Sender`='%s' ORDER BY `MK` DESC LIMIT %i,1",name,listitem);
				QUERY(result);
				STORE;
				mysql_fetch_row_format(result,"|",mysql_connection);
				sscanf(result,"sssss",Reciever,Subject,Time,Date,Message);
				format(result,sizeof(result),"{FFFFFF}Date:{FF9933} %s{FFFF33} %s\n{FFFFFF}Reciever:{FFFF33} %s\n{FFFFFF}Subject: %s\n\n\n%s",Date,Time,Reciever,Subject,Message);
				FREE;
				ShowPlayerDialog(playerid,DIALOGID-2,DIALOG_STYLE_MSGBOX,"Message",result,"Ok","Cancel");
			}
			else ShowEmail(playerid);
		    return 1;
	    }
   		case DIALOGID: // main dialog
   		{
   		    if(response)
   		    {
	   		    switch(listitem)
	   		    {
					case 0: // inbox
					{
					    new result[3048], //This line
							name[MAX_PLAYER_NAME],
							QR[256],
							Subject[100],
							Sender[60],
							Time[10],
							New
							;
						GetPlayerName(playerid,name,MAX_PLAYER_NAME);
					    format(QR,sizeof(QR),"SELECT `Sender`,`Subject`,`Time`,`New` FROM `Emails` WHERE `Reciever`='%s' ORDER BY `MK` DESC LIMIT 20",name);
						QUERY(QR);
						STORE;
						if(!ROWS) return SendClientMessage(playerid,0xFFFFFF30," * You don't have any messages in your inbox!");
						while(mysql_fetch_row_format(QR,"|",mysql_connection))
						{
						    sscanf(QR,"sssi",Sender,Subject,Time,New);
							if(!New)
						    	format(result,sizeof(result),"%s{FFFFFF}'%s'{FF9933} FROM %s{FFFF33} %s\n",result,Subject,Sender,Time);
							else
							    format(result,sizeof(result),"%s{FFFFFF}'%s'{FF9933} FROM %s{FFFF33} NEW\n",result,Subject,Sender);

						}
					    FREE;
					    ShowPlayerDialog(playerid,DIALOGID+1,DIALOG_STYLE_LIST,"Inbox",result,"Ok","Back");
					    return 1;
					}
                    case 1: // outbox
					{
					    new result[3048],//This line!
							name[MAX_PLAYER_NAME],
							QR[256],
							Subject[100],
							Reciever[60],
							Time[10],
							New
							;
						GetPlayerName(playerid,name,MAX_PLAYER_NAME);
					    format(QR,sizeof(QR),"SELECT `Reciever`,`Subject`,`Time`,`New` FROM `Emails` WHERE `Sender`='%s' ORDER BY `MK` DESC LIMIT 20",name);
						QUERY(QR);
						STORE;
						if(!ROWS) return SendClientMessage(playerid,0xFFFFFF30," * You don't have any messages in your outbox!");
						while(mysql_fetch_row_format(QR,"|",mysql_connection))
						{
						    sscanf(QR,"sssi",Reciever,Subject,Time,New);
						    if(!New)
						    	format(result,sizeof(result),"%s{FFFFFF}'%s'{FF9933} TO %s{FFFF33} %s\n",result,Subject,Reciever,Time);
							else
							    format(result,sizeof(result),"%s{FFFFFF}'%s'{FF9933} TO %s{FFFF33} UNREAD\n",result,Subject,Reciever);
						}
					    FREE;
					    ShowPlayerDialog(playerid,DIALOGID+2,DIALOG_STYLE_LIST,"Outbox",result,"Ok","Back");
					    return 1;
					}
				 	case 2: // compose
					{
					    ShowPlayerDialog(playerid,DIALOGID+30,DIALOG_STYLE_INPUT,"Compose","Input the Recipients E-Mail address.\nFormat - Name","Ok","Back");
					    return 1;
					}
	   		    }
   		    }
   		}
   		case DIALOGID+30: // compose 1
   		{
   		    if(response)
   		    {
				if(strlen(inputtext) > 50 || strlen(inputtext) < 5 || strfind(inputtext,"\n",true) != -1 || strfind(inputtext,"{",true) != -1 || strfind(inputtext,"}",true) != -1 || strfind(inputtext,"|",true) != -1 ) return ShowPlayerDialog(playerid,DIALOGID+30,DIALOG_STYLE_INPUT,"Compose","Input the Recipients E-Mail address.\nFormat - Name\nE-Mail address Name is in wrong format!","Ok","Back");
				format(RecieverP[playerid],50,inputtext);
				ShowPlayerDialog(playerid,DIALOGID+31,DIALOG_STYLE_INPUT,"Compose","Input the Subject.\nMax Lenght: 100 symbols.","Ok","Back");
				return 1;
   		    }
   		    else
   		    {
			   ShowEmail(playerid);
			   return 1;
			}
   		}
   		case DIALOGID+31: // compose 2
   		{

   			if(response)
   		    {
				if(strlen(inputtext) > 98 || strlen(inputtext) < 2 || strfind(inputtext,"\n",true) != -1 || strfind(inputtext,"{",true) != -1 || strfind(inputtext,"}",true) != -1 || strfind(inputtext,"|",true) != -1) return ShowPlayerDialog(playerid,DIALOGID+30,DIALOG_STYLE_INPUT,"Compose","Input the Subject.\nMax Lenght: 100 symbols.\nSubject is invalid format!","Ok","Back");
				format(SubjectP[playerid],100,inputtext);
				ShowPlayerDialog(playerid,DIALOGID+32,DIALOG_STYLE_INPUT,"Compose","Write the message.\nMax Lenght: 256 symbols.\n '~' Indicates a new line.","Ok","Back");
				return 1;
   		    }
   		    else
   		    {
			   ShowEmail(playerid);
			   return 1;
			}
   		}
   		case DIALOGID+32: // compose 3
   		{
   			if(response)
   		    {
				if(strlen(inputtext) > 255 || strlen(inputtext) < 2) return ShowPlayerDialog(playerid,DIALOGID+32,DIALOG_STYLE_INPUT,"Compose","Write the message.\nMax Lenght: 256 symbols.\nMessage too short or too long!","Ok","Back");
				if(strfind(inputtext,"\n",true) != -1 || strfind(inputtext,"{",true) != -1 || strfind(inputtext,"}",true) != -1 || strfind(inputtext,"|",true) != -1) return ShowPlayerDialog(playerid,DIALOGID+32,DIALOG_STYLE_INPUT,"Compose","Write the message.\nMax Lenght: 256 symbols.\nMessage contains blocked symbols!","Ok","Back");
				new
					query[1024],
					hour,
					minute,
					second,
					day,
					month,
					year,
					mk,
					name[MAX_PLAYER_NAME];

				gettime(hour,minute,second);
				getdate(year,month,day);
    			mk = mktime(hour,minute,second,day,month,year);
    			GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    			format(query,sizeof(query),"INSERT INTO `Emails` (Sender,Reciever,Date,Time,MK,New,Subject,Text) VALUES('%s','%s','%i-%i-%i','%i:%i',%i,1,'%s','%s')",
																name,RecieverP[playerid],day,month,year,hour,minute,mk,SubjectP[playerid],inputtext);
				QUERY(query);
				SendClientMessage(playerid,0xFFFFFF30," * Message sent!");
				return 1;
   		    }
   		    else
   		    {
			   ShowEmail(playerid);
			   return 1;
			}
   		}
    }
Warnings..
Код:
warning 219: local variable "result" shadows a variable at a preceding level
D:\Windows-Server\gamemodes\vx-rp.pwn(9046) : warning 219: local variable "result" shadows a variable at a preceding level
D:\Windows-Server\gamemodes\vx-rp.pwn(9075) : warning 219: local variable "result" shadows a variable at a preceding level
D:\Windows-Server\gamemodes\vx-rp.pwn(9103) : warning 219: local variable "result" shadows a variable at a preceding level
Server Consule!

Код:
 sscanf warning: Strings without a length are deprecated, please add a destination size.
Screen from email:

http://postimage.org/image/9ssrj203f/

There was needed to be: "Hey man! How are you?"

I hope you will help me out.. Thanks for your time and if you will ask for rep then I will give you without a problems.. I'm really appreciate for your time!

Sincerely Scrillex!
Reply
#2

First of all, you need to use this string sizes inside that sscanf..
Код:
					Subject[100],
					Sender[60],
					Time[15],
					Date[20],
					Message[256],
sscanf(result,"s[60]s[100]s[15]s[20]iis[256]",Sender,Subject,Time,Date,New,Mk,Message);
let me check the other things
Reply
#3

Thanks for your time...
isn't string crated by new result[1024]; //


Still have problems...
Reply
#4

BUMP!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)