SA-MP Forums Archive
Dialog not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dialog not working (/showthread.php?tid=566582)



Dialog not working - Alex_T - 07.03.2015

Okay so I have a dialog that allows you to change the time and bail of a person in prison except it is not working. I am able to release the person but I am not able to change their bail or time. Anyone got any idea?

PHP код:
case EFactionsDialog_PMDC: {
            if(!
response)
            {
            new 
mdcs[256];
            
format(mdcs,sizeof(mdcs),"Police MDC System - Logged in: %s",GetPlayerNameEx(playeridENameType_RPName_NoMask));
            
ShowPlayerDialog(playeridEFactionDialog_MDCDIALOG_STYLE_LISTmdcs,"Name Search\nWanted\nSubmit Charges\nPlate Search((Plate))\nPrisoners Database\nRequest Backup\nAnswer Backup\nCancel Backup\nFind Business Address""Select""Cancel");
            }
            else if(
response) {
                new 
msg[128];
                if(
listitem == 0)
                {
                    
format(msgsizeof(msg), "Please type how long %s has left in jail"GetPlayerNameEx(Prisoners[listitem], ENameType_RPName_NoMask));
                    
ShowPlayerDialog(playerid,EFactionDialog_CTime,DIALOG_STYLE_INPUT,"MDC",msg,"Confirm","Go back");
                }
                else if(
listitem == 1)
                {
                    
format(msgsizeof(msg), "Please type how much %s bail should be"GetPlayerNameEx(Prisoners[listitem], ENameType_RPName_NoMask));
                    
ShowPlayerDialog(playerid,EFactionDialog_CBail,DIALOG_STYLE_INPUT,"MDC",msg,"Confirm","Go back");
                }
                else if(
listitem == 2)
                {
                    
format(msgsizeof(msg), "%s has released %s from prison."GetPlayerNameEx(playerid,ENameType_RPName), GetPlayerNameEx(Prisoners[listitem], ENameType_RPName_NoMask));
                    
SendCopMessage(TEAM_BLUE_COLORmsg);
                    
releaseFromJail(Prisoners[listitem]);                     
                    
DeletePVar(Prisoners[listitem], "ReleaseTime"); 
                }
            }
        }
        
/*This dialog*/case EFactionDialog_CTime: {
            if(
response) {
                new 
msg[128];
                new 
time GetPVarInt(Prisoners[listitem], "ReleaseTime");
                new 
ATime strval(inputtext);
                
format(msgsizeof(msg), "%s has changed %s prison time from %d to %d ."GetPlayerNameEx(playerid,ENameType_RPName), GetPlayerNameEx(Prisoners[listitem], ENameType_RPName_NoMask),time,ATime);
                
SendCopMessage(TEAM_BLUE_COLORmsg);
                
SetPVarInt(Prisoners[listitem], "ReleaseTime"ATime);
            }
        }
        
/*and this Dialog*/case EFactionDialog_CBail: {
            if(
response) {
                new 
msg[128];
                new 
bail GetPVarInt(Prisoners[listitem], "Bail");
                new 
ATime strval(inputtext);
                
format(msgsizeof(msg), "%s has changed %s bail from %d to %d ."GetPlayerNameEx(playerid,ENameType_RPName), GetPlayerNameEx(Prisoners[listitem], ENameType_RPName_NoMask),bail,ATime);
                
SendCopMessage(TEAM_BLUE_COLORmsg);
                
SetPVarInt(Prisoners[listitem], "Bail"ATime);
            }
        } 



Re : Dialog not working - Golimad - 07.03.2015

add print("check") below SetPVarInt(Prisoners[listitem], "Bail", ATime); and SetPVarInt(Prisoners[listitem], "ReleaseTime", ATime); to see if it reached there atleast.


Re: Dialog not working - Alex_T - 07.03.2015

It is not reaching it that means it is getting stuck somewhere before it, I am not sure where though. Anyone got any ideas?


Re: Dialog not working - SickAttack - 07.03.2015

The issues are caused by:
pawn Код:
(listitem)
Obviously, listitem is null since the dialogs aren't a list style dialog. I don't even know why you're using listitem in the first place, it would be better to store the id of the player you're interacting with in a different variable.