Making dialog system for jobs.
#1

hi all i was wondering how i could make these 2 filterscripts i have downloaded into a dialog system towork together.

example like the player types /manual and it shows them a dialog menu so they either pick sweeper or harvester and then they can start that job ?

and how can i make it so that only certain class can select that job

i use player classes like
pawn Код:
AddPlayerClassEx(6, 19,1235.6105,-2037.1107,61.0313,259.4714,0,0,0,0,0,0); //TEAM ID 6 ==DOLE DOSSER
SWEEPER JOB
pawn Код:
#include <a_samp>

#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA

new SweepingJob[256];

public OnFilterScriptInit()
{
    //addvehicleshere
}
forward SweeperJobFinish(playerid);
public SweeperJobFinish(playerid)
{
    if(SweepingJob[playerid] == 0){ return 1; }

    GivePlayerMoney(playerid,200);
    SetPlayerScore(playerid, GetPlayerScore(playerid)+2);
    SendClientMessage(playerid,COLOR_YELLOW,"You have been paid for the work you have done $200 and 2 score");
    SweepingJob[playerid] = 0;

    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/s", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 574)
        {
            SweepingJob[playerid] = 1;
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "* %s is now a StreetSweeper.", name );
            SendClientMessageToAll(COLOR_YELLOW, string);
            SendClientMessage(playerid,COLOR_YELLOW,"The Job is Temporary 2 Minutes to complete the Job");
            SetTimerEx("SweeperJobFinish",120000, false, "i", playerid);
            return 1;
        }
        SendClientMessage(playerid, COLOR_RED,"ERROR: You Have To Be In a Street Sweeper to Complete This Mission");
    }
    return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 574)
     {
         SendClientMessage(playerid, COLOR_RED, "To accept the job type /sweeper");
     }
     return 0;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(SweepingJob[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_RED, "You have exited the vehicle you are FIRED");
        SweepingJob[playerid] = 0;
    }
}
HARVESTER JOB
pawn Код:
#include <a_samp>

#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA

new HarvestJob[256];

public OnFilterScriptInit()
{
    AddStaticVehicle(532,-488.9691,-1454.4095,13.6985,176.1319,0,0); // Harvest
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/harvest", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
        {
            HarvestJob[playerid] = 1;
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "* %s is now a Harvester.", name );
            SendClientMessageToAll(COLOR_YELLOW, string);
            SetPlayerCheckpoint(playerid,-484.5330,-1480.2612,13.9457,10);
            SendClientMessage(playerid,COLOR_YELLOW,"* Follow the red markers and you'll recieve money!");
            return 1;
        }
        SendClientMessage(playerid, COLOR_RED,"You have to be in a courier truck to start the job");
    }
    return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
     {
         SendClientMessage(playerid, COLOR_RED, "* You can start the sweepingjob by using /harvest");
     }
     return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 532)
     {
        if(HarvestJob[playerid] == 1){
            HarvestJob[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(HarvestJob[playerid] == 2){
            HarvestJob[playerid] = 3;
            SetPlayerCheckpoint(playerid,-491.1559,-1590.0781,6.0986,10);
            return 1;
         }
        if(HarvestJob[playerid] == 3){
            HarvestJob[playerid] = 4;
            SetPlayerCheckpoint(playerid,-517.1489,-1494.8715,10.6554,10);
            return 1;
         }
        if(HarvestJob[playerid] == 4){
            HarvestJob[playerid] = 5;
            SetPlayerCheckpoint(playerid,-537.1957,-1495.2427,9.5398,10);
            return 1;
         }
        if(HarvestJob[playerid] == 5){
            HarvestJob[playerid] = 6;
            SetPlayerCheckpoint(playerid,-538.4468,-1594.6807,7.9598,10);
            return 1;
         }
        if(HarvestJob[playerid] == 6){
            HarvestJob[playerid] = 7;
            SetPlayerCheckpoint(playerid,-562.2611,-1505.3055,8.7389,10);
            return 1;
         }
        if(HarvestJob[playerid] == 7){
            HarvestJob[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(HarvestJob[playerid] > 0)
    {
        SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
        DisablePlayerCheckpoint(playerid);
        HarvestJob[playerid] = 0;
    }
}
Reply
#2

Just add them both to a single filterscript!
Reply
#3

right but then how to make it so they can select job? make it like a rescue system? but without removing money ?
Reply
#4

First combine the two filterscripts into one, then put the '/manual' command and dialog script in it.

Make sure you return 0; at the end of public OnDialogResponse() in the fs ( i think ).
Reply
#5

Well, just change the OnPlayerEnterVehicle to the Dialog thingy. I mean like, instead of checking if the player is in the vehicle and pressed some key, you just use the dialogs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)