12.02.2017, 02:30
Quote:
|
Yes, you need a variable to track what mission the player is doing, but it only needs to be the number of the mission. right now you only have 0, 1, and 2 as options for the IDs of the missions.
|
Код:
forward Trucker1(playerid);
public Trucker1(playerid)
{
new rand = random(sizeof(trucker));
new newtext2[MAX_PLAYERS];
PlayerInfo[playerid][StartingPoint] = rand;
PlayerInfo[playerid][MissionID] = trucker[rand][mission_id];
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, trucker[rand][lx], trucker[rand][ly], trucker[rand][lz], 10);
format(newtext2,sizeof(newtext2), "~w~Head to ~r~%s ~w~to load your trailer with ~y~%s", trucker[rand][lpname], trucker[rand][loadname]);
PlayerTextDrawSetString(playerid, work[playerid],newtext2);
}
Код:
CMD:convoy(playerid, params[])
{
new targetid;
new missionid = PlayerInfo[targetid][MissionID];
SendMessageToAdmins(playerid, "/convoy", params);
if(sscanf(params, "u",targetid)) return SendClientMessage(playerid, -1, "{FF0000}USAGE: {FFFFFF}/convoy [playerid]");
if(GetPlayerTeam(playerid) == 1)
{
new m = GetVehicleModel(GetPlayerVehicleID(playerid));
if(m == 455 || m == 515 || m == 403 || m == 514)
{
new t = GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid)));
if( m == 455 || t == 435 || t == 450 || t == 584 )
{
if (GetPlayerVehicleSeat(playerid) == 0)
{
new string[128];
format(string,sizeof(string),"%s has joined your convoy", ReturnName(playerid));
SendClientMessage(targetid,-1,string);
format(string,sizeof(string),"You joined %s convoy", ReturnName(targetid));
SendClientMessage(playerid,-1,string);
new ConvoyDisplay[MAX_PLAYERS];
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, trucker[missionid][lx], trucker[missionid][ly], trucker[missionid][lz], 10);
format(ConvoyDisplay,sizeof(ConvoyDisplay), "~w~Head to ~r~%s ~w~to load your trailer with ~y~%s", trucker[missionid][lpname], trucker[missionid][loadname]);
PlayerTextDrawSetString(playerid, work[playerid], ConvoyDisplay);
truck_PlayerJob[playerid] = 1;
}
else
{
SendClientMessage(playerid, WORK, "You are not the driver of this vehicle");
}
}
else
{
SendClientMessage(playerid, WORK, "You do not have the correct trailer, please go and attach one!");
}
}
else
{
SendClientMessage(playerid, WORK, "You are not in a truck, please go and get one!");
}
}
return 1;
}


