OnPlayerDeath && ShowPlayerDialog issue
#1

I have some issue with onplayerdeath and showplayerdialog. When i show dialog for killer, killer can leave dialog empty and press ok.I trying on many ways to find solution for fix, but i don't have more ideas.
When i showing this dialog for player via command YCMD, everything work fine, but when i show dialog for killer under onplayerdeath, conditions in that dialog not work.
Although they are correct

Example of code:
PHP код:
new GetKillerID[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
GetKillerID[playerid] = 0;
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    
ShowPlayerDialog(killerid654DIALOG_STYLE_INPUT"Simple question for you""Are you smart?""Ok""");
    return 
1;
}
fDialog(654)
{
    if(
response)
    {
        if(!
strlen(inputtext))
        {
            
SCM(playeridCOLOR_GRAD1"Dialog is Empty");
             return 
1;
        }
         if(
strlen(inputtext) < 5)
          {
               
SCM(playeridCOLOR_GRAD1"Inputtext can't be under 5 letters");
             return 
1;
           }
           if(((!(
inputtext[0])) || (((inputtext[0]) == '\1') && (!(inputtext[1])))))
           {
               
SCM(playeridCOLOR_GRAD1"wtf?");
            return 
1;
           }
           
           
// other code
    
}
    else
    {
         
ShowPlayerDialog(playerid654DIALOG_STYLE_INPUT"Simple question for you""Are you smart?""Ok""");
    }
    return 
1;

And also i tryed to store killerid - id in variable, and that variable use in fDialog but again same problem.

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
GetKillerID[killerid] = killerid;
    
ShowPlayerDialog(killerid654DIALOG_STYLE_INPUT"Simple question for you""Are you smart?""Ok""");
    return 
1;
}
fDialog(654)
{
    if(
response)
    {
        
//NOT WORK
        
if(!strlen(inputtext))
        {
            
SCM(GetKillerID[playerid], COLOR_GRAD1"Dialog is Empty");
             return 
1;
        }
         if(
strlen(inputtext) < 5)
          {
               
SCM(GetKillerID[playerid], COLOR_GRAD1"Inputtext can't be under 5 letters");
             return 
1;
           }
           if(((!(
inputtext[0])) || (((inputtext[0]) == '\1') && (!(inputtext[1])))))
           {
               
SCM(GetKillerID[playerid], COLOR_GRAD1"wtf?");
            return 
1;
           }
           
//NOT WORK
           // other code WORK
    
}
    else
    {
         
ShowPlayerDialog(GetKillerID[playerid], 654DIALOG_STYLE_INPUT"Simple question for you""Are you smart?""Ok""");
    }
    return 
1;

Reply
#2

PHP код:
#define scm SendClientMessage
enum{
    
d_deathmsg
};
public 
OnPlayerDeath(playeridkilleridreason) { 
    
ShowPlayerDialog(killeridd_deathmsgDIALOG_STYLE_INPUT"Simple question for you""Are you smart?""Ok"""); 
    return 
1

public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[]){
    new 
pid=playerid;
    switch(
dialogid){
        case 
d_deathmsg:{
            
//must answer, cant be closed with pressing ESC
            
if(strlen(inputtext) < 5)
                return 
scm(pid,-1,"Text must be longer then 5 letters!"),
                
ShowPlayerDialog(killeridd_deathmsgDIALOG_STYLE_INPUT"Simple question for you""Are you smart?""Ok""");
            for(new 
i,i2=strlen(inputtext); i2i++){
                if(!(
'a' <= inputtext[i] <= 'z'))
                    return 
scm(pid,-1,"Only letters are allowed!"),
                        
ShowPlayerDialog(killeridd_deathmsgDIALOG_STYLE_INPUT"Simple question for you""Are you smart?""Ok""");
            }
            
//your other code
        
}
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)