I want to give a mission for each trailer but I do not know how.
Код:
public OnPlayerUpdate(playerid)
{
new vID = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vID)== 403 || GetVehicleModel(vID)== 515 || GetVehicleModel(vID) == 514)
{
if(IsTrailerAttachedToVehicle(vID))
{
ShowPlayerDialog(playerid, DIALOG_MISSIONS_1, DIALOG_STYLE_MSGBOX, "INFO", "Point: Los Santos Hospital\nStatus: Legal\nPrize: 5000 $", "Yes", "No");
ShowPlayerDialog(playerid, DIALOG_MISSIONS_2, DIALOG_STYLE_MSGBOX, "INFO", "Point: San Fierro Shop\nStatus: Legal\nPrize: 7500 $", "Yes", "No");
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_MISSIONS_1)
{
if(response == 1)
{
SetPlayerCheckpoint(playerid, Unloading_LS, 5);
SendClientMessage(playerid, COLOR_GREY, "Drive to the place marked on the map.");
cp_missions1[playerid]++;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{999999}Canceled");
}
return 1;
}
if(dialogid == DIALOG_MISSIONS_2)
{
if(response == 1)
{
SetPlayerCheckpoint(playerid, Unloading_SF, 5);
SendClientMessage(playerid, COLOR_GREY, "Drive to the place marked on the map.");
cp_missions2[playerid]++;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{999999}Canceled");
}
return 1;
}
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
DisablePlayerCheckpoint(playerid);
switch(cp_missions1[playerid])
{
case 1:
{
DisablePlayerCheckpoint(playerid);
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Unloading...");
SetTimerEx("unloading", 10000, 0, "i", playerid);
cp_missions1[playerid] = 0;
GivePlayerMoney(playerid, 5000);
SendClientMessage(playerid, COLOR_WHITE, "You get $ 5,000 for unloading!");
}
}
switch(cp_missions2[playerid])
{
case 1:
{
DisablePlayerCheckpoint(playerid);
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Unloading...");
SetTimerEx("unloading", 10000, 0, "i", playerid);
cp_missions2[playerid] = 0;
GivePlayerMoney(playerid, 7500);
SendClientMessage(playerid, COLOR_WHITE, "You get $ 7,500 for unloading!");
}
}
return 1;
}