SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/05/2018, 06:50 PM   #1
OsmanMalagic
Little Clucker
 
Join Date: Jul 2016
Location: EX-YU
Posts: 34
Reputation: 51
Question OnPlayerDeath && ShowPlayerDialog issue

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 Code:
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 Code:
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;

OsmanMalagic is offline   Reply With Quote
Old 14/05/2018, 08:27 PM   #2
CodeStyle175
Banned
 
Join Date: Apr 2014
Posts: 455
Reputation: 35
Default Re: OnPlayerDeath && ShowPlayerDialog issue

PHP Code:
#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;

CodeStyle175 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ShowPlayerDialog help tommzy09 Scripting Help 8 26/05/2015 02:41 AM
Unoccupied vehicle sync, boat surfing pausing issue, parachute with vehicle issue, surfing w/ skydiving issue Kar Bug Reports 2 10/06/2013 09:24 AM
ShowPlayerDialog Youtube12 Scripting Help 6 05/03/2013 05:24 PM


All times are GMT. The time now is 03:50 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.