06.03.2011, 09:12
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 :
Please help me.
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;
}