dialog input
#1

The script:
Код:
COMMAND:mdc(playerid, params[])
{
    new criminal, string[128];
	new Float:X, Float:Y, Float:Z;
	GetPlayerPos(criminal, X, Y, Z);
	new caption[32], info[256];
	format(caption, sizeof(caption), "%s", GetName(criminal));

    if(sscanf(params, "u", criminal)) return SendClientMessage(playerid, COLOR_GREY, "[Usage:] /mdc [name].");
    if(criminal == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_LIGHTRED, "That player is not connected.");
    if(PlayerInfo[playerid][pFaction] != 2) return SCM(playerid, COLOR_LIGHTRED, "You are not a police officer.");
	
	//format(string, sizeof(string),"_______________________________[%s]_______________________________", GetName(criminal));
	//SCM(playerid, COLOR_WHITE, string);
	if(PlayerInfo[criminal][pActiveOffenses] < 1)
	{
	    format(info, sizeof(info), "Varsta: %d \nNumar Telefon: %d \nAdresa Casa: %d \nAdresa Firma: %d \n__________________\nAceasta persoana nu este cautata.", PlayerInfo[playerid][pAge], PlayerInfo[playerid][pNumber], PlayerInfo[playerid][HouseID], PlayerInfo[playerid][BizID]);
	    ShowPlayerDialog(playerid, DIALOG_MDC, DIALOG_STYLE_MSGBOX, caption, info, "Adauga", "Inchide");
		//SendClientMessage(playerid, COLOR_SJPD, "[SJPD Database:] "COL_WHITE"None.");
	}
	else
	{
	    format(info, sizeof(info), "Varsta: %d \nNumar Telefon: %d \nAdresa Casa: %d \nAdresa Firma: %d \n__________________\nINFRACTIUNI: \n%s.", PlayerInfo[playerid][pAge], PlayerInfo[playerid][pNumber], PlayerInfo[playerid][HouseID], PlayerInfo[playerid][BizID], PlayerInfo[criminal][pActiveOffense]);
	    ShowPlayerDialog(playerid, DIALOG_MDC, DIALOG_STYLE_MSGBOX, caption, info, "Adauga", "Inchide");
		/*format(string, sizeof(string), "[SJPD Database:] "COL_WHITE"%s", PlayerInfo[criminal][pActiveOffense]);
		SCM(playerid, COLOR_SJPD, string);*/
	}
  	return 1;
}
Код:
case DIALOG_MDC:
        {
      		if (!response)
            {
				SendClientMessage(playerid, COLOR_WHITE, "[Police Database] Deconectat");
                return 1;
            }
            else if(response) // Pressed ENTER or clicked 'Login' button
            {
                ShowPlayerDialog(playerid, DIALOG_SUSPECT , DIALOG_STYLE_INPUT, "Police Database", "Te rugam tasteaza infractiunea comisa", "Adauga", "Inchide");
            	return 1;
            }
        }
Код:
case DIALOG_SUSPECT:
  		{
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_SUSPECT, DIALOG_STYLE_INPUT, "Police Database","Ai introdus o infractiune gresita.\n""Introduceti infractiunea,","Enter","Cancel");
                new criminal, string[128], offense[128];
				format(string, sizeof(string), "[LSPD:] %s has reported %s as a suspect, offense: %s", GetName(playerid), GetName(criminal), offense);
				format(PlayerInfo[playerid][pActiveOffense], 46, string);
				PoliceBroadcast(COLOR_SJPD,string,1);
				//PlayerInfo[criminal][pActiveOffense] = offense;
				PlayerInfo[criminal][pActiveOffenses] += 1;
            }
		}
So.. in game when I type /mdc name, everything works, the informations are okay but if I click on "Adauga" and I type a crime it will show like this.
[LSPD:] %s has reported %s as a suspect, offense:

But the offense won't show neither save, how I make the offense to show?
Reply
#2

Hello!

You can use inputtext instead of offense. Also you have to take a auxiliary variable to save the player who is reported.
So, it would look like this:
PHP код:
COMMAND:mdc(playeridparams[])
{
    new 
criminalstring[128];
    new 
Float:XFloat:YFloat:Z;
    
GetPlayerPos(criminalXYZ);
    new 
caption[32], info[256];
    
format(captionsizeof(caption), "%s"GetName(criminal));
    if(
sscanf(params"u"criminal)) return SendClientMessage(playeridCOLOR_GREY"[Usage:] /mdc [name].");
    if(
criminal == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_LIGHTRED"That player is not connected.");
    if(
PlayerInfo[playerid][pFaction] != 2) return SCM(playeridCOLOR_LIGHTRED"You are not a police officer.");
    
SetPVarInt(playerid,"criminal_value",criminal);
    
//format(string, sizeof(string),"_______________________________[%s]_______________________________", GetName(criminal));
    //SCM(playerid, COLOR_WHITE, string);
    
if(PlayerInfo[criminal][pActiveOffenses] < 1)
    {
        
format(infosizeof(info), "Varsta: %d \nNumar Telefon: %d \nAdresa Casa: %d \nAdresa Firma: %d \n__________________\nAceasta persoana nu este cautata."PlayerInfo[playerid][pAge], PlayerInfo[playerid][pNumber], PlayerInfo[playerid][HouseID], PlayerInfo[playerid][BizID]);
        
ShowPlayerDialog(playeridDIALOG_MDCDIALOG_STYLE_MSGBOXcaptioninfo"Adauga""Inchide");
        
//SendClientMessage(playerid, COLOR_SJPD, "[SJPD Database:] "COL_WHITE"None.");
    
}
    else
    {
        
format(infosizeof(info), "Varsta: %d \nNumar Telefon: %d \nAdresa Casa: %d \nAdresa Firma: %d \n__________________\nINFRACTIUNI: \n%s."PlayerInfo[playerid][pAge], PlayerInfo[playerid][pNumber], PlayerInfo[playerid][HouseID], PlayerInfo[playerid][BizID], PlayerInfo[criminal][pActiveOffense]);
        
ShowPlayerDialog(playeridDIALOG_MDCDIALOG_STYLE_MSGBOXcaptioninfo"Adauga""Inchide");
        
/*format(string, sizeof(string), "[SJPD Database:] "COL_WHITE"%s", PlayerInfo[criminal][pActiveOffense]);
        SCM(playerid, COLOR_SJPD, string);*/
    
}
      return 
1;
}
case 
DIALOG_SUSPECT:
{
    if(
response)
    {
         if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_SUSPECTDIALOG_STYLE_INPUT"Police Database","Ai introdus o infractiune gresita.\n""Introduceti infractiunea,","Enter","Cancel");
           new 
criminal GetPVarInt(playerid,"criminal_value"), string[128];
        
format(stringsizeof(string), "[LSPD:] %s has reported %s as a suspect, offense: %s"GetName(playerid), GetName(criminal), inputtext);
        
format(PlayerInfo[playerid][pActiveOffense], 46string);
        
PoliceBroadcast(COLOR_SJPD,string,1);
        
//PlayerInfo[criminal][pActiveOffense] = offense;
        
PlayerInfo[criminal][pActiveOffenses] += 1;
    }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)