SA-MP Forums Archive
Job Dialog won't work. - 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: Job Dialog won't work. (/showthread.php?tid=301948)



Job Dialog won't work. - Kindred - 06.12.2011

Well, i'm making a job center where you can choose from different jobs, and it won't show up when i do /jobs.

Here is my complete filterscript for it:

pawn Код:
#include <a_samp>

#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define DIALOG_JOBCENTER 9939123
#define DIALOG_MAILMAN 9939124
#include <zcmd>

new MailManJob[256];

public OnFilterScriptInit()
{
    AddStaticVehicle(498,1807.9707,-2023.5115,13.6025,89.4466,0,0); // Mailman vehicle 1
    AddStaticVehicle(498,1808.0648,-2028.2402,13.6047,89.7643,0,0); // Mailman vehicle 2
    AddStaticVehicle(498,1808.1003,-2033.1456,13.6044,89.7046,0,0); // Mailman vehicle 3
    AddStaticVehicle(498,1807.8750,-2037.8630,13.6007,89.7430,0,0); // Mailman vehicle 4
    AddStaticVehicle(498,1807.8707,-2042.4125,13.6139,90.6334,0,0); // Mailman vehicle 5
    AddStaticVehicle(498,1808.3198,-2046.6622,13.6282,90.2119,0,0); // Mailman vehicle 6
}

CMD:jobs(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 7.0, 361.8299,173.5622,1008.3828))
    {
        ShowPlayerDialog(playerid,9939123,DIALOG_STYLE_LIST,"Job Center","Mailman","Join", "Cancel");
    }
    else
    {
        SendClientMessage(playerid,COLOR_YELLOW,"You are not in range of the Job Center!");
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/startjob", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
        {
            if(MailManJob[playerid] == 1)
            {
                new name[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                SetPlayerCheckpoint(playerid,-484.5330,-1480.2612,13.9457,10);
                SendClientMessage(playerid,COLOR_YELLOW,"* Follow the red markers and you'll recieve money!");
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED,"You are not a mailman! To become one, go to the Job Center!");
            }
            return 1;
        }
        if(MailManJob[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_YELLOW,"You are not a Mailman!");
        }
        SendClientMessage(playerid, COLOR_RED,"You have to be in a Boxville truck to start the job");
    }
    return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
     {
         SendClientMessage(playerid, COLOR_RED, "* You can start the sweepingjob by using /startjob");
     }
     return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 9939123)
    {
        if(response)
        {
            if(listitem == 0)
            {
                ShowPlayerDialog(playerid, 9939124, DIALOG_STYLE_MSGBOX, "MailMan", "So, you are interested in becoming a mailman?\nMailman deliver mail to houses, and get rewarded with cash.", "Join Job", "Cancel");
            }
        }
    }
    if(dialogid == 9939124)
    {
        if(response)
        {
            MailManJob[playerid] = 1;
            SendClientMessage(playerid, COLOR_YELLOW, "You are now a mailman! Use /jobhelp for more details.");
        }
    }
    return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
     {
        if(MailManJob[playerid] == 1){
            MailManJob[playerid] = 2;
            SetPlayerCheckpoint(playerid,-488.9691,-1454.4095,13.6985,10);
            SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
            return 1;
         }
        if(MailManJob[playerid] == 2){
            MailManJob[playerid] = 3;
            SetPlayerCheckpoint(playerid,-491.1559,-1590.0781,6.0986,10);
            return 1;
         }
        if(MailManJob[playerid] == 3){
            MailManJob[playerid] = 4;
            SetPlayerCheckpoint(playerid,-517.1489,-1494.8715,10.6554,10);
            return 1;
         }
        if(MailManJob[playerid] == 4){
            MailManJob[playerid] = 5;
            SetPlayerCheckpoint(playerid,-537.1957,-1495.2427,9.5398,10);
            return 1;
         }
        if(MailManJob[playerid] == 5){
            MailManJob[playerid] = 6;
            SetPlayerCheckpoint(playerid,-538.4468,-1594.6807,7.9598,10);
            return 1;
         }
        if(MailManJob[playerid] == 6){
            MailManJob[playerid] = 7;
            SetPlayerCheckpoint(playerid,-562.2611,-1505.3055,8.7389,10);
            return 1;
         }
        if(MailManJob[playerid] == 7){
            MailManJob[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $300 for your work!");
            GivePlayerMoney(playerid,300);
         }
     }
     return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(MailManJob[playerid] > 0)
    {
        SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
        DisablePlayerCheckpoint(playerid);
        MailManJob[playerid] = 0;
    }
}
I'm new to pawn, so my knowledge isn't great. I may have forgot something easily understood. If you can look over this and tell me whats wrong so i can fix it, it will be greatly appreciated.


Re: Job Dialog won't work. - Qur - 06.12.2011

I think the ZCMD should be under all of the script.. at the bottom


Re: Job Dialog won't work. - Marshall32 - 06.12.2011

Lol man the limit for dialogs is at 700 you gone to far. I tested it it works just set the dialog ids to 600 and 601 or what number you want :P.

pawn Код:
#include <a_samp>
#include <zcmd>

#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define DIALOG_JOBCENTER 600
#define DIALOG_MAILMAN 601

new MailManJob[256];

public OnFilterScriptInit()
{
    AddStaticVehicle(498,1807.9707,-2023.5115,13.6025,89.4466,0,0); // Mailman vehicle 1
    AddStaticVehicle(498,1808.0648,-2028.2402,13.6047,89.7643,0,0); // Mailman vehicle 2
    AddStaticVehicle(498,1808.1003,-2033.1456,13.6044,89.7046,0,0); // Mailman vehicle 3
    AddStaticVehicle(498,1807.8750,-2037.8630,13.6007,89.7430,0,0); // Mailman vehicle 4
    AddStaticVehicle(498,1807.8707,-2042.4125,13.6139,90.6334,0,0); // Mailman vehicle 5
    AddStaticVehicle(498,1808.3198,-2046.6622,13.6282,90.2119,0,0); // Mailman vehicle 6
}

CMD:jobs(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 7.0, 361.8299,173.5622,1008.3828))
    {
        ShowPlayerDialog(playerid,9939123,DIALOG_STYLE_LIST,"Job Center","Mailman","Join", "Cancel");
    }
    else
    {
        SendClientMessage(playerid,COLOR_YELLOW,"You are not in range of the Job Center!");
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/startjob", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
        {
            if(MailManJob[playerid] == 1)
            {
                new name[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                SetPlayerCheckpoint(playerid,-484.5330,-1480.2612,13.9457,10);
                SendClientMessage(playerid,COLOR_YELLOW,"* Follow the red markers and you'll recieve money!");
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED,"You are not a mailman! To become one, go to the Job Center!");
            }
            return 1;
        }
        if(MailManJob[playerid] == 0)
        {
            SendClientMessage(playerid, COLOR_YELLOW,"You are not a Mailman!");
        }
        SendClientMessage(playerid, COLOR_RED,"You have to be in a Boxville truck to start the job");
    }
    return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
     {
         SendClientMessage(playerid, COLOR_RED, "* You can start the sweepingjob by using /startjob");
     }
     return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 600)
    {
        if(response)
        {
            if(listitem == 0)
            {
                ShowPlayerDialog(playerid, 9939124, DIALOG_STYLE_MSGBOX, "MailMan", "So, you are interested in becoming a mailman?\nMailman deliver mail to houses, and get rewarded with cash.", "Join Job", "Cancel");
            }
        }
    }
    if(dialogid == 601)
    {
        if(response)
        {
            MailManJob[playerid] = 1;
            SendClientMessage(playerid, COLOR_YELLOW, "You are now a mailman! Use /jobhelp for more details.");
        }
    }
    return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
     {
        if(MailManJob[playerid] == 1){
            MailManJob[playerid] = 2;
            SetPlayerCheckpoint(playerid,-488.9691,-1454.4095,13.6985,10);
            SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
            return 1;
         }
        if(MailManJob[playerid] == 2){
            MailManJob[playerid] = 3;
            SetPlayerCheckpoint(playerid,-491.1559,-1590.0781,6.0986,10);
            return 1;
         }
        if(MailManJob[playerid] == 3){
            MailManJob[playerid] = 4;
            SetPlayerCheckpoint(playerid,-517.1489,-1494.8715,10.6554,10);
            return 1;
         }
        if(MailManJob[playerid] == 4){
            MailManJob[playerid] = 5;
            SetPlayerCheckpoint(playerid,-537.1957,-1495.2427,9.5398,10);
            return 1;
         }
        if(MailManJob[playerid] == 5){
            MailManJob[playerid] = 6;
            SetPlayerCheckpoint(playerid,-538.4468,-1594.6807,7.9598,10);
            return 1;
         }
        if(MailManJob[playerid] == 6){
            MailManJob[playerid] = 7;
            SetPlayerCheckpoint(playerid,-562.2611,-1505.3055,8.7389,10);
            return 1;
         }
        if(MailManJob[playerid] == 7){
            MailManJob[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $300 for your work!");
            GivePlayerMoney(playerid,300);
         }
     }
     return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(MailManJob[playerid] > 0)
    {
        SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
        DisablePlayerCheckpoint(playerid);
        MailManJob[playerid] = 0;
    }
}


There is it . Add me reputation by clicking at the star under my name .Thanks


Re: Job Dialog won't work. - array13 - 06.12.2011

this is for your dialog works.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    case 9939123:
    {
        if(response)
        {
            if(listitem == 0)
            {
                ShowPlayerDialog(playerid, 9939124, DIALOG_STYLE_MSGBOX, "MailMan", "So, you are interested in becoming a mailman?\nMailman deliver mail to houses, and get rewarded with cash.", "Join Job", "Cancel");
            }
        }
    }
    case 9939124:
    {
        if(response)
        {
            MailManJob[playerid] = 1;
            SendClientMessage(playerid, COLOR_YELLOW, "You are now a mailman! Use /jobhelp for more details.");
        }
    }
    return 1;
}



Re: Job Dialog won't work. - Kindred - 06.12.2011

Quote:
Originally Posted by kikito
Посмотреть сообщение
this is for your dialog works.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    case 9939123:
    {
        if(response)
        {
            if(listitem == 0)
            {
                ShowPlayerDialog(playerid, 9939124, DIALOG_STYLE_MSGBOX, "MailMan", "So, you are interested in becoming a mailman?\nMailman deliver mail to houses, and get rewarded with cash.", "Join Job", "Cancel");
            }
        }
    }
    case 9939124:
    {
        if(response)
        {
            MailManJob[playerid] = 1;
            SendClientMessage(playerid, COLOR_YELLOW, "You are now a mailman! Use /jobhelp for more details.");
        }
    }
    return 1;
}
I get errors:

Код:
C:\Users\Administrator\Desktop\EXRP\EXRP\filterscripts\Jobs.pwn(73) : error 014: invalid statement; not in switch
C:\Users\Administrator\Desktop\EXRP\EXRP\filterscripts\Jobs.pwn(73) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\EXRP\EXRP\filterscripts\Jobs.pwn(73) : error 001: expected token: ";", but found ":"
C:\Users\Administrator\Desktop\EXRP\EXRP\filterscripts\Jobs.pwn(73) : error 029: invalid expression, assumed zero
C:\Users\Administrator\Desktop\EXRP\EXRP\filterscripts\Jobs.pwn(73) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Job Dialog won't work. - sleepysnowflake - 06.12.2011

You set the ID too big. Change it to 555 or something.

Also, you have to put switch(dialogid) in order to work.


Re: Job Dialog won't work. - Marshall32 - 07.12.2011

Lol just look at my one it works fully i tested :P.