OnDialogResponse
#1

Hi all. I have a problem. My code:
Код:
dcmd_amsg(playerid,params[])
{
	if(AccInfo[playerid][Level] >= 1 && AccInfo[playerid][LoggedIn] == 1)
    {
        new text[256], id;
        new str[128];
        if(sscanf(params, "us[256]",id,text)) return ShowPlayerDialog(playerid,DIALOGID2+1,DIALOG_STYLE_INPUT,"{FFFF00}Admin message","{ffffff}Enter the player id\n\n{ff0000}You can use: /amsg [playerid] [message]","Ok","Cancel");

  		if(AccInfo[id][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return GameTextForPlayer(playerid,"~r~You cannot use this command on this admin",6000,3);
		if(!IsPlayerConnected(id)) return GameTextForPlayer(playerid,"~g~player is not connected",4000,3);}
		GameTextForPlayer(playerid,"~g~message sent",3000,3);
        format(str,sizeof(str),"{FFFFFF}%s",text);
		ShowPlayerDialog(id,DIALOG_NO_RESPONSE,DIALOG_STYLE_MSGBOX,"{FFFF00}Admins Message",str,"Close","");
	}
	return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	new amsg_target;
	if(dialogid == DIALOGID2+1)
	{
		if(response)
		{
      		amsg_target = strval(inputtext);
		    if(AccInfo[amsg_target][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
			{
		 		return GameTextForPlayer(playerid,"~r~~h~You cannot use this command on this admin",6000,3);
		 	}
			if(!IsPlayerConnected(amsg_target))
			{
		 		return	GameTextForPlayer(playerid,"~g~player is not connected",4000,3);
		 	}
			ShowPlayerDialog(playerid,DIALOGID2+2,DIALOG_STYLE_INPUT,"{FFFF00}Admins message","{ffffff}Enter message","Ok","");
		}
		return 1;
	}
	if(dialogid == DIALOGID2+2)
	{
	    if(response)
	    {
	        new str[64];
	        format(str,64,"{ffffff}%s",inputtext);
        	GameTextForPlayer(playerid,"~g~message sent",3000,3);
            ShowPlayerDialog(amsg_target,DIALOG_NO_RESPONSE,DIALOG_STYLE_MSGBOX,"{FFFF00}Admin message",str,"Ok","");
	    }
	    return 1;
	}
amsg_target returns zero and the message is sent to the ID 0
Reply
#2

Enter the wrong dialog
Why write it to a variable at all?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)