Cashbox Mission
#1

Hello. I have a problem i want to add when player enters checkpoint on cashbox mission if he is TEAM_COP to not be able to take it and a message to appear like : You must defend this cashbox. Here is my code :

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{   if(pdebug == 1){printf("[DEBUG] OnPlayerEnterCheckpoint(%d)", playerid);}

    new string[128];
    if(cashbox1)
    {
        if(romeo[playerid] == 1) return DisablePlayerCheckpoint(playerid), romeo[playerid]= 0;
        {
            if(MissionActive == 1)
            {
                if(MissionInUse[1] == 1)
                {
                    if(!IsPlayerInAnyVehicle(playerid))
                    {
                        format(string, sizeof(string), "~y~Congratulations!~n~~w~You finished your mission~n~~g~Reward: %d$", RandomCashboxMissionMoney);
                        GameTextForPlayer(playerid, string, 5000, 4);
                        PlaySoundForPlayer(playerid, 1139);
                        GivePlayerMoney(playerid, RandomCashboxMissionMoney);
                        format(string, sizeof(string), "%s Has delivered the cashbox and earned %d$", PlayerName[playerid], RandomCashboxMissionMoney);
                        SendClientMessageToAll(COLOR_YELLOW, string);
                        MissionActive ++;
                        ResetMissions();
                        SendPlayerMissionFinished(playerid, 1, RandomCashboxMissionMoney);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You have to be on foot!");
                    }
                }
                else
                {
                    if(!IsPlayerInAnyVehicle(playerid))
                    {
                        CheckpointBusyX = 0.0;
                        CheckpointBusyY = 0.0;
                        CheckpointBusyZ = 0.0;
                        CheckpointBusyS = 0.0;
                        for(new i=0; i<MAX_SLOTS; i++)
                        {
                            DisablePlayerCheckpoint(i);
                        }
                        new Float:ratio = 8.0;
                        new rcashbox;
                        if(city == 1){rcashbox = random(sizeof(RandomBringCashbox_LS));
                        SetPlayerCheckpoint(playerid, RandomBringCashbox_LS[rcashbox][0], RandomBringCashbox_LS[rcashbox][1], RandomBringCashbox_LS[rcashbox][2], ratio);}
                        SendClientMessage(playerid, COLOR_YELLOW, "Bring this cashbox to the red marker, and earn the money.");
                        format(string, sizeof(string), "%s Has picked up the cashbox, Worth: %d$!", PlayerName[playerid], RandomCashboxMissionMoney);
                        SendClientMessageToAll(COLOR_YELLOW, string);
                        PlayerIsDoingMission = playerid;
                        MissionInUse[1] = 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You have to be on foot!");
                    }
                }
                return 1;
            }

            if(MissionActive == 2)
            {
                if(MissionInUse[2] == 1)
                {
                    if(GetPlayerVehicleID(playerid) == SearchedVehicle)
                    {
                        format(string, sizeof(string), "~y~Congratulations!~n~~w~You finished your mission~n~~g~Reward: %d$", RandomCarMissionMoney);
                        GameTextForPlayer(playerid, string, 5000, 4);
                        PlaySoundForPlayer(playerid, 1139);
                        GivePlayerMoney(playerid, RandomCarMissionMoney);
                        format(string, sizeof(string), "%s Has delivered the %s and earned %d$!", PlayerName[playerid], VehicleName[GetVehicleModel(SearchedVehicle)-400], RandomCarMissionMoney);
                        SendClientMessageToAll(COLOR_YELLOW, string);
                        MissionActive ++;
                        ResetMissions();
                        SendPlayerMissionFinished(playerid, 2, RandomCarMissionMoney);
                    }
                    return 1;
                }
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
Please help me.
Reply
#2

Can someone do it for me ? Please i really need it fast.
Reply
#3

BUMP !!!
Reply
#4

Lol so you just remembered after 5 months about this :O

pawn Код:
//On the top of your gamemode:
new gTeam[MAX_PLAYERS];
#define TEAM_COPS 4 //or whatever number you want, that is not in use by other things such as dialogs
//wherever your code is:
if(gTeam[playerid] == TEAM_COPS) return SendClientMessage(playerid,-1,"You must defend the cashbox!");
Reply
#5

This is the code, can you add it please ?

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{   if(pdebug == 1){printf("[DEBUG] OnPlayerEnterCheckpoint(%d)", playerid);}

    new string[128];
    if(cashbox1)
    {
        if(romeo[playerid] == 1) return DisablePlayerCheckpoint(playerid), romeo[playerid]= 0;
        {
            if(MissionActive == 1)
            {
                if(MissionInUse[1] == 1)
                {
                    if(!IsPlayerInAnyVehicle(playerid))
                    {
                        format(string, sizeof(string), "~y~Congratulations!~n~~w~You finished your mission~n~~g~Reward: %d$", RandomCashboxMissionMoney);
                        GameTextForPlayer(playerid, string, 5000, 4);
                        PlaySoundForPlayer(playerid, 1139);
                        GivePlayerMoney(playerid, RandomCashboxMissionMoney);
                        format(string, sizeof(string), "%s Has delivered the cashbox and earned %d$", PlayerName[playerid], RandomCashboxMissionMoney);
                        SendClientMessageToAll(COLOR_YELLOW, string);
                        MissionActive ++;
                        ResetMissions();
                        SendPlayerMissionFinished(playerid, 1, RandomCashboxMissionMoney);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You have to be on foot!");
                    }
                }
                else
                {
                    if(!IsPlayerInAnyVehicle(playerid))
                    {
                        CheckpointBusyX = 0.0;
                        CheckpointBusyY = 0.0;
                        CheckpointBusyZ = 0.0;
                        CheckpointBusyS = 0.0;
                        for(new i=0; i<MAX_SLOTS; i++)
                        {
                            DisablePlayerCheckpoint(i);
                        }
                        new Float:ratio = 8.0;
                        new rcashbox;
                        if(city == 1){rcashbox = random(sizeof(RandomBringCashbox_LS));
                        SetPlayerCheckpoint(playerid, RandomBringCashbox_LS[rcashbox][0], RandomBringCashbox_LS[rcashbox][1], RandomBringCashbox_LS[rcashbox][2], ratio);}
                        SendClientMessage(playerid, COLOR_YELLOW, "Bring this cashbox to the red marker, and earn the money.");
                        format(string, sizeof(string), "%s Has picked up the cashbox, Worth: %d$!", PlayerName[playerid], RandomCashboxMissionMoney);
                        SendClientMessageToAll(COLOR_YELLOW, string);
                        PlayerIsDoingMission = playerid;
                        MissionInUse[1] = 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You have to be on foot!");
                    }
                }
                return 1;
            }
Oh, and btw I left my country for about 7 months and I quit studying pawno.
Reply
#6

Can someone add that for me please ?
Reply
#7

Quote:
Originally Posted by [Aka]Dragonu
Посмотреть сообщение
This is the code, can you add it please ?

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{   if(pdebug == 1){printf("[DEBUG] OnPlayerEnterCheckpoint(%d)", playerid);}

    new string[128];
    if(cashbox1)
    {
        if(romeo[playerid] == 1) return DisablePlayerCheckpoint(playerid), romeo[playerid]= 0;
        {
            if(MissionActive == 1)
            {
                if(MissionInUse[1] == 1)
                {
                    if(!IsPlayerInAnyVehicle(playerid))
                    {

                       if(gTeam[playerid] == TEAM_COPS) return SendClientMessage(playerid,-1,"You must defend the cashbox!");
                        {
                        format(string, sizeof(string), "~y~Congratulations!~n~~w~You finished your mission~n~~g~Reward: %d$", RandomCashboxMissionMoney);
                        GameTextForPlayer(playerid, string, 5000, 4);
                        PlaySoundForPlayer(playerid, 1139);
                        GivePlayerMoney(playerid, RandomCashboxMissionMoney);
                        format(string, sizeof(string), "%s Has delivered the cashbox and earned %d$", PlayerName[playerid], RandomCashboxMissionMoney);
                        SendClientMessageToAll(COLOR_YELLOW, string);
                        MissionActive ++;
                        ResetMissions();
                        SendPlayerMissionFinished(playerid, 1, RandomCashboxMissionMoney);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You have to be on foot!");
                    }
                }
                else
                {
                    if(!IsPlayerInAnyVehicle(playerid))
                    {
                        CheckpointBusyX = 0.0;
                        CheckpointBusyY = 0.0;
                        CheckpointBusyZ = 0.0;
                        CheckpointBusyS = 0.0;
                        for(new i=0; i<MAX_SLOTS; i++)
                        {
                            DisablePlayerCheckpoint(i);
                        }
                        new Float:ratio = 8.0;
                        new rcashbox;
                        if(city == 1){rcashbox = random(sizeof(RandomBringCashbox_LS));
                        SetPlayerCheckpoint(playerid, RandomBringCashbox_LS[rcashbox][0], RandomBringCashbox_LS[rcashbox][1], RandomBringCashbox_LS[rcashbox][2], ratio);}
                        SendClientMessage(playerid, COLOR_YELLOW, "Bring this cashbox to the red marker, and earn the money.");
                        format(string, sizeof(string), "%s Has picked up the cashbox, Worth: %d$!", PlayerName[playerid], RandomCashboxMissionMoney);
                        SendClientMessageToAll(COLOR_YELLOW, string);
                        PlayerIsDoingMission = playerid;
                        MissionInUse[1] = 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You have to be on foot!");
                       }
                    }
                }
                return 1;
            }
Oh, and btw I left my country for about 7 months and I quit studying pawno.


I added the command slightly, put the rest on top of the script. I think that would work quite well, and please give me a plus rating, I'd appreciate it
Reply
#8

Where did you add the command? And btw I want to make a command to start the cashbox mission, not add it into the script.
Reply
#9

Bump !!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)