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


Messages In This Thread
Cashbox Mission - by [Aka]Dragonu - 06.03.2011, 09:12
Re: Cashbox Mission - by [Aka]Dragonu - 06.03.2011, 11:43
Re: Cashbox Mission - by [Aka]Dragonu - 29.08.2011, 06:58
Re: Cashbox Mission - by [MWR]Blood - 29.08.2011, 07:21
Re: Cashbox Mission - by [Aka]Dragonu - 29.08.2011, 07:35
Re: Cashbox Mission - by [Aka]Dragonu - 29.08.2011, 18:40
Re: Cashbox Mission - by Andregood - 29.08.2011, 19:55
Re: Cashbox Mission - by [Aka]Dragonu - 29.08.2011, 20:39
Re: Cashbox Mission - by [Aka]Dragonu - 30.08.2011, 07:27

Forum Jump:


Users browsing this thread: 1 Guest(s)