911 system dialog
#1

How can I transfer my old system into a new dialog based system

pawn Code:
if(Mobile[playerid] != 255)
    {
        new idx;
        tmp = strtok(text, idx);
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(UnidentifedCall[playerid] == 1)
        {
          format(string, sizeof(string), "Stranger Says (cellphone): %s", text);
        }
        else
        {
            format(string, sizeof(string), "%s Says (cellphone): %s", sendername, text);
        }
        ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        //printf("callers line %d called %d caller %d",Mobile[Mobile[playerid]],Mobile[playerid],playerid);
        if(Mobile[playerid] == 914)
        {
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: Sorry I don't understand?");
                return 0;
            }
            new turner[MAX_PLAYER_NAME];
            new wanted[128];
            GetPlayerName(playerid, turner, sizeof(turner));
            SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: We have alerted all units in the area.");
            SendClientMessage(playerid, TEAM_CYAN_COLOR, "Thank you for reporting this incident");
            format(wanted, sizeof(wanted), "Dispatch: All Units IA: Caller: %s",turner);
            SendTeamBeepMessage(1, TEAM_CYAN_COLOR, wanted);
            format(wanted, sizeof(wanted), "Dispatch: Incident: %s",text);
            SendTeamMessage(1, TEAM_CYAN_COLOR, wanted);
            new Float:trace_x, Float:trace_y, Float:trace_z;
            GetPlayerPos(playerid, trace_x, trace_y, trace_z);
            emdtrace = 1; emdtrace_x = trace_x; emdtrace_y = trace_y; emdtrace_z = trace_z;
            SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
            Mobile[playerid] = 255;
            return 0;
        }
        if(Mobile[playerid] == 913)
        {
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand?");
                return 0;
            }
            if ((strcmp("no", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("no")))
            {
                new turner[MAX_PLAYER_NAME];
                new wanted[128];
                GetPlayerName(playerid, turner, sizeof(turner));
                SendClientMessage(playerid, COLOR_DBLUE, "Police Dispatch: We have alerted all units in the area.");
                SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
                format(wanted, sizeof(wanted), "HQ: All Units APB: Reporter: %s",turner);
                SendFamilyMessage(1, COLOR_DBLUE, wanted);
                format(wanted, sizeof(wanted), "HQ: Crime: %s, Suspect: Unknown",PlayerCrime[playerid][pAccusing]);
                SendFamilyMessage(1, COLOR_DBLUE, wanted);
                new Float:trace_x, Float:trace_y, Float:trace_z;
                GetPlayerPos(playerid, trace_x, trace_y, trace_z);
                pdtrace = 1; pdtrace_x = trace_x; pdtrace_y = trace_y; pdtrace_z = trace_z;
                SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
                Mobile[playerid] = 255;
                return 0;
            }
            new badguy;
            //badguy = strval(tmp);
            badguy = ReturnUser(tmp);
            if (IsPlayerConnected(badguy))
            {
              if(badguy != INVALID_PLAYER_ID)
              {
                    if (gTeam[badguy] == 2 || gTeam[badguy] == 1)
                    {
                        SendClientMessage(playerid, COLOR_DBLUE, "Police Dispatch: You will have to contact internal affairs. This is an emergency line");
                        SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
                        Mobile[playerid] = 255;
                        return 0;
                    }
                    if (WantedPoints[badguy] > 0)
                    {
                        SendClientMessage(playerid, COLOR_DBLUE, "Police Dispatch: Units are already assigned to that case");
                        SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
                        SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
                        Mobile[playerid] = 255;
                        return 0;
                    }
                    if (badguy == playerid)
                    {
                        SendClientMessage(playerid, COLOR_DBLUE, "Police Dispatch: Dont Fool Around, This is an emergency line.");
                        SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
                        Mobile[playerid] = 255;
                        return 0;
                    }
                    SendClientMessage(playerid, COLOR_DBLUE, "Police Dispatch: We have alerted all units in the area.");
                    SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
                    new Float:trace_x, Float:trace_y, Float:trace_z;
                    GetPlayerPos(playerid, trace_x, trace_y, trace_z);
                    pdtrace = 1; pdtrace_x = trace_x; pdtrace_y = trace_y; pdtrace_z = trace_z;
                    SetPlayerCriminal(badguy,playerid, PlayerCrime[playerid][pAccusing]);
                    if(WantedPoints[badguy] > 0) { } else { WantedPoints[badguy] += 2; }
                    SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
                    Mobile[playerid] = 255;
                    return 0;
                }//invalid id
                return 0;
            }//not connected
            else
            {
                format(string, sizeof(string), "Police Dispatch: I have no Information on %s, are you sure thats the right name?",tmp);
                SendClientMessage(playerid, COLOR_DBLUE, string);
                return 0;
            }
        }
        if(Mobile[playerid] == 912)
        {
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand?");
                return 0;
            }
            strmid(PlayerCrime[playerid][pAccusing], text, 0, strlen(text), 255);
            SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: If you know the assailant's name or part of it say it now or just say no.");
            Mobile[playerid] = 913;
            return 0;
        }
        if(Mobile[playerid] == 911)
        {
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand, police or paramedic?");
                return 0;
            }
            else if ((strcmp("police", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("police")))
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: I am patching you to Police HQ, please hold.");
                Mobile[playerid] = 912;
                SendClientMessage(playerid, COLOR_DBLUE, "HQ: Please give me a short description of the crime and location.");
                return 0;
            }
            else if ((strcmp("paramedic", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("paramedic")))
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: I am patching you to Paramedic HQ, please hold.");
                Mobile[playerid] = 914;
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: Please give me a short description of the Incident.");
                return 0;
            }
            else
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry I don't understand, police or paramedic?");
                return 0;
            }
        }
Reply
#2

Quote:
Originally Posted by The_J0ker
View Post
How can I transfer my old system into a new dialog based system

pawn Code:
if(Mobile[playerid] != 255)
    {
        new idx;
        tmp = strtok(text, idx);
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(UnidentifedCall[playerid] == 1)
        {
          format(string, sizeof(string), "Stranger Says (cellphone): %s", text);
        }
        else
        {
            format(string, sizeof(string), "%s Says (cellphone): %s", sendername, text);
        }
        ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        //printf("callers line %d called %d caller %d",Mobile[Mobile[playerid]],Mobile[playerid],playerid);
        if(Mobile[playerid] == 914)
        {
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: Sorry I don't understand?");
                return 0;
            }
            new turner[MAX_PLAYER_NAME];
            new wanted[128];
            GetPlayerName(playerid, turner, sizeof(turner));
            SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: We have alerted all units in the area.");
            SendClientMessage(playerid, TEAM_CYAN_COLOR, "Thank you for reporting this incident");
            format(wanted, sizeof(wanted), "Dispatch: All Units IA: Caller: %s",turner);
            SendTeamBeepMessage(1, TEAM_CYAN_COLOR, wanted);
            format(wanted, sizeof(wanted), "Dispatch: Incident: %s",text);
            SendTeamMessage(1, TEAM_CYAN_COLOR, wanted);
            new Float:trace_x, Float:trace_y, Float:trace_z;
            GetPlayerPos(playerid, trace_x, trace_y, trace_z);
            emdtrace = 1; emdtrace_x = trace_x; emdtrace_y = trace_y; emdtrace_z = trace_z;
            SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
            Mobile[playerid] = 255;
            return 0;
        }
        if(Mobile[playerid] == 913)
        {
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand?");
                return 0;
            }
            if ((strcmp("no", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("no")))
            {
                new turner[MAX_PLAYER_NAME];
                new wanted[128];
                GetPlayerName(playerid, turner, sizeof(turner));
                SendClientMessage(playerid, COLOR_DBLUE, "Police Dispatch: We have alerted all units in the area.");
                SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
                format(wanted, sizeof(wanted), "HQ: All Units APB: Reporter: %s",turner);
                SendFamilyMessage(1, COLOR_DBLUE, wanted);
                format(wanted, sizeof(wanted), "HQ: Crime: %s, Suspect: Unknown",PlayerCrime[playerid][pAccusing]);
                SendFamilyMessage(1, COLOR_DBLUE, wanted);
                new Float:trace_x, Float:trace_y, Float:trace_z;
                GetPlayerPos(playerid, trace_x, trace_y, trace_z);
                pdtrace = 1; pdtrace_x = trace_x; pdtrace_y = trace_y; pdtrace_z = trace_z;
                SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
                Mobile[playerid] = 255;
                return 0;
            }
            new badguy;
            //badguy = strval(tmp);
            badguy = ReturnUser(tmp);
            if (IsPlayerConnected(badguy))
            {
              if(badguy != INVALID_PLAYER_ID)
              {
                    if (gTeam[badguy] == 2 || gTeam[badguy] == 1)
                    {
                        SendClientMessage(playerid, COLOR_DBLUE, "Police Dispatch: You will have to contact internal affairs. This is an emergency line");
                        SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
                        Mobile[playerid] = 255;
                        return 0;
                    }
                    if (WantedPoints[badguy] > 0)
                    {
                        SendClientMessage(playerid, COLOR_DBLUE, "Police Dispatch: Units are already assigned to that case");
                        SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
                        SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
                        Mobile[playerid] = 255;
                        return 0;
                    }
                    if (badguy == playerid)
                    {
                        SendClientMessage(playerid, COLOR_DBLUE, "Police Dispatch: Dont Fool Around, This is an emergency line.");
                        SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
                        Mobile[playerid] = 255;
                        return 0;
                    }
                    SendClientMessage(playerid, COLOR_DBLUE, "Police Dispatch: We have alerted all units in the area.");
                    SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
                    new Float:trace_x, Float:trace_y, Float:trace_z;
                    GetPlayerPos(playerid, trace_x, trace_y, trace_z);
                    pdtrace = 1; pdtrace_x = trace_x; pdtrace_y = trace_y; pdtrace_z = trace_z;
                    SetPlayerCriminal(badguy,playerid, PlayerCrime[playerid][pAccusing]);
                    if(WantedPoints[badguy] > 0) { } else { WantedPoints[badguy] += 2; }
                    SendClientMessage(playerid, COLOR_GRAD2, "  They Hung Up...");
                    Mobile[playerid] = 255;
                    return 0;
                }//invalid id
                return 0;
            }//not connected
            else
            {
                format(string, sizeof(string), "Police Dispatch: I have no Information on %s, are you sure thats the right name?",tmp);
                SendClientMessage(playerid, COLOR_DBLUE, string);
                return 0;
            }
        }
        if(Mobile[playerid] == 912)
        {
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand?");
                return 0;
            }
            strmid(PlayerCrime[playerid][pAccusing], text, 0, strlen(text), 255);
            SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: If you know the assailant's name or part of it say it now or just say no.");
            Mobile[playerid] = 913;
            return 0;
        }
        if(Mobile[playerid] == 911)
        {
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand, police or paramedic?");
                return 0;
            }
            else if ((strcmp("police", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("police")))
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: I am patching you to Police HQ, please hold.");
                Mobile[playerid] = 912;
                SendClientMessage(playerid, COLOR_DBLUE, "HQ: Please give me a short description of the crime and location.");
                return 0;
            }
            else if ((strcmp("paramedic", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("paramedic")))
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: I am patching you to Paramedic HQ, please hold.");
                Mobile[playerid] = 914;
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: Please give me a short description of the Incident.");
                return 0;
            }
            else
            {
                SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry I don't understand, police or paramedic?");
                return 0;
            }
        }
use this https://sampwiki.blast.hk/wiki/ShowPlayerDialog
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)