SA-MP Forums Archive
Dialog not responding + some questions. - 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 responding + some questions. (/showthread.php?tid=525770)



Dialog not responding + some questions. - iOxide - 13.07.2014

Hi,

I have a dialog to pay the police ticket, everything works fine but its not responding when player click "Pay" button. But its responding when they click "Cancel" button. I made a test FS to check if other dialogs aren't responding as well or not and they too didn't respond. I am pretty sure its not the script fault cause some old dialogs that i had scripted in the same way are working fine but its not working for newly added dialogs. If i make a /pay command with the same scripts, it works fine.

pawn Код:
if(dialogid == DIALOG_TICKET)
{
    new
        str[100],
        Fines
    ;
   
    if(!response)
    {
        format(str, sizeof(str), "Suspect %s did not pay the ticket. You can jail him now.", GetName(playerid));
        SendClientMessage(pInfo[playerid][TicketingID], RED, str);
        SendClientMessage(playerid, RED, "You didn't pay the fine, police are able to jail you!");
        KillTimer(pInfo[playerid][Timer_PoliceCanJailMe]);
        pInfo[playerid][Ticketed] = false;
        pInfo[playerid][PoliceWarnedMe] = false;
        SetJobText(playerid);
        pInfo[playerid][PoliceCanJailMe] = true;
    }
    if(response)
    {
        if(pInfo[playerid][Ticketed] == true)
        {
            Fines = GetPlayerWantedLevel(playerid) * DefaultFinePerStar;
            RewardPlayer(pInfo[playerid][TicketingID], Fines, GetPlayerWantedLevel(playerid));
            format(str, 80, "%s has paid the ticket of $%i", GetName(playerid), Fines);
            SendClientMessage(pInfo[playerid][TicketingID], BLUE, str);
            RewardPlayer(playerid, -Fines, 0);
            RewardPlayer(pInfo[playerid][TicketingID], Fines, 0);
            format(str, 80, "You have paid the ticket of $%i to Officer %s", Fines, GetName(pInfo[playerid][TicketingID]));
            SendClientMessage(playerid, RED, str);
            SetJobText(playerid);
            pInfo[pInfo[playerid][TicketingID]][StatsPoliceFined]++;
            SetPlayerWantedLevel(playerid, 0);
            if(pInfo[playerid][WantedID] == playerid)
            {
                pInfo[playerid][TicketingID] = 0;
                pInfo[playerid][WantedID] = 0;
            }
            pInfo[playerid][Ticketed] = false;
            pInfo[playerid][PoliceWarnedMe] = false;
            KillTimer(pInfo[playerid][Timer_PoliceCanJailMe]);
            PlayerFile_Save(pInfo[playerid][TicketingID]);
            PlayerFile_Save(playerid);
        }
    }
    return 1;
}
Dialog is defined as #define DIALOG_TICKET 742

And another problem is, i have set
pawn Код:
if(IsPlayerConnected(targetid))
{
    //do stuffs here
}
else
    return SendClientMessage(playerid, 0xFF0000FF, "Player is not connected1");
in all of my commands and sometimes when player reconnects to the server it says "Player is not connected" even if they are, while using all the commands on the selected players. I have latest version of sscanf so what else could be the reason?


Re: Dialog not responding + some questions. - iOxide - 14.07.2014

/Bump

Sorry for bumping faster, but i need to fix it. Someone help.


Re: Dialog not responding + some questions. - BroZeus - 14.07.2014

is it sending this message format(str, sizeof(str), "Suspect %s did not pay the ticket. You can jail him now.", GetName(playerid));?


Re: Dialog not responding + some questions. - iOxide - 14.07.2014

Yes its sending. The cancel button is respondin but not the Pay button.


Re: Dialog not responding + some questions. - BroZeus - 14.07.2014

then the problem is this if(pInfo[playerid][Ticketed] == true)
remove this


Re: Dialog not responding + some questions. - greentarch - 14.07.2014

Have you set
pawn Код:
if(pInfo[playerid][Ticketed] == true)
to the target when the cop gives him a ticket?


Re: Dialog not responding + some questions. - iOxide - 14.07.2014

Well, i am not a noob at making a boolean var. as i said, i made a test fs to check if the dialog responses or not and it didn't. I had set 2 messages with cancel and ok button but they both didn't work. Same scripted stuff is working with old dialog, and i believe that i haven't reach the max dialog limit. But still, i will try to remove the true statement from the dialog and see if it works.