enum MissionData { mission_id, Float:lx, Float:ly, Float:lz, lpname[64], loadname[256], Float:ux, Float:uy, Float:uz, ulpname[256], cost, bool:IsLoaded } static const trucker[][MissionData] = { // Template: {lx, ly, lz, lpname, loadname, ux, uy, uz, upname, cost}, // Dont include comma on last!!!! //{1, 2054.6843,1928.2374,12.1540, "(LV) Book Store", "Books", 2492.5366,2773.2190,10.80422, "K.A.C", 1500}, //{2, 2492.5366,2773.2190,10.80422, "K.A.C", "Books", 2054.6843,1928.2374,12.1540, "(LV) Book Store", 2500}, {1, 2420.6235,-2464.2495,13.6250, "Los Santos Warehouse", "Weapons", 1538.4180,-1674.5314,13.5469, "Los Santos Police Station", 3000, false}, {2, 2244.0317,47.0715,26.4844, "General Store", "Food", 1931.9788,-1776.5302,13.3828, "Los Santos Gas Station", 3000}, {3, -2029.1902,-2403.2869,30.6250 , "Angel Pine Place", "Logs", 2208.2058,-2243.5767,13.5469, "Los Santos Warehouse", 3000, false} };
public Trucker1(playerid) { new rand = random(sizeof(trucker)); new newtext2[MAX_PLAYERS]; PlayerInfo[playerid][StartingPoint] = rand; 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); } forward Trucker2(playerid); public Trucker2(playerid) { DisablePlayerCheckpoint(playerid); new end = PlayerInfo[playerid][StartingPoint]; new End = PlayerInfo[playerid][StartingPoint]; PlayerInfo[playerid][EndingPoint] = end; // you dont need this array ? TogglePlayerControllable(playerid, 1); SetPlayerCheckpoint(playerid, trucker[end][ux], trucker[end][uy], trucker[end][uz], 10); truck_PlayerJob[playerid] = 2; new workmission2[250]; format(workmission2,sizeof(workmission2), "~w~Now Head To ~r~%s ~w~To Unload The ~y~%s", trucker[End][ulpname], trucker[end][loadname]); PlayerTextDrawSetString(playerid, work[playerid], workmission2); } forward Trucker3(playerid); public Trucker3(playerid) { new End = PlayerInfo[playerid][StartingPoint]; new string[144]; format(string,sizeof(string),"%s has delivered %s from %s to %s", ReturnName(playerid), trucker[End][loadname], trucker[End][lpname], trucker[End][ulpname]); SendClientMessageToAll(-1, string); print(string); DisablePlayerCheckpoint(playerid); new Message[90]; if(TruckLoad[playerid] == 0) { SetPlayerScore(playerid, GetPlayerScore(playerid) + 1); format(Message, sizeof(Message), "You completed the mission and earned $%i and 1 points in a Roadtrain", trucker[End][cost]); SendClientMessage(playerid, -1, Message); GivePlayerMoney(playerid, trucker[End][cost]); } else if(TruckLoad[playerid] == 1) { SetPlayerScore(playerid, GetPlayerScore(playerid) + 2); format(Message, sizeof(Message), "You completed the mission and earned $%i and 2 points in a Roadtrain", trucker[End][cost]*2); SendClientMessage(playerid, -1, Message); GivePlayerMoney(playerid, trucker[End][cost]*2); print(Message); } TruckLoad[playerid] = 0; TogglePlayerControllable(playerid, 1); truck_PlayerJob[playerid] = 0; new workmission[250]; format(workmission,sizeof(workmission), "~w~You Are Not On a Mission - Type ~r~/Work ~w~To Begin"); PlayerTextDrawSetString(playerid, work[playerid], workmission); } CMD:work(playerid, params[]) { SendMessageToAdmins(playerid, "/work", params); 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) { Trucker1(playerid); truck_PlayerJob[playerid] = 1; //truckchecktime = SetTimerEx("TruckCheck", 1000, true, "i", giveplayerid); } else { SendClientMessage(playerid, WORK, "You are not the driver of this vehicle"); } } else { SendClientMessage(playerid, WORK, "You do not have a trailer, please go and ATTACH one!"); } } else { SendClientMessage(playerid, WORK, "You are not in a TRUCK, please go and get one!"); } } return 1; } CMD:stopwork(playerid, params[]) { SendMessageToAdmins(playerid, "/stopwork", params); TruckLoad[playerid] = 0; DisablePlayerCheckpoint(playerid); truck_PlayerJob[playerid] = 0; new workmission[250]; format(workmission,sizeof(workmission), "~w~You Are Not On a Mission - Type ~r~/Work ~w~To Begin"); PlayerTextDrawSetString(playerid, work[playerid], workmission); return 1; } CMD:convoy(playerid, params[]) { new targetid; 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[targetid][lx], trucker[targetid][ly], trucker[targetid][lz], 10); format(ConvoyDisplay,sizeof(ConvoyDisplay), "~w~Head to ~r~%s ~w~to load your trailer with ~y~%s", trucker[targetid][lpname], trucker[targetid][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; }
public OnPlayerEnterCheckpoint(playerid) { new loading[MAX_PLAYERS]; if(GetPlayerTeam(playerid) == 1) { if(IsPlayerInAnyVehicle(playerid)) { switch(truck_PlayerJob[playerid]) { case 1: { truck_PlayerJob[playerid] = -1; TogglePlayerControllable(playerid, 0); SetTimerEx("Trucker2", 30000, false, "i", playerid); format(loading,sizeof(loading), "~y~Loading... ~g~Please wait..."); PlayerTextDrawSetString(playerid, work[playerid], loading); new Message[100]; format(Message,sizeof(Message), "Loading..."); SendClientMessage(playerid, WORK, Message); format(Message,sizeof(Message), "Please wait"); SendClientMessage(playerid, WORK, Message); } case 2, 3: { truck_PlayerJob[playerid] = 3; TogglePlayerControllable(playerid, 0); SetTimerEx("Trucker3", 30000, false, "i", playerid); format(loading,sizeof(loading), "~y~Unloading... ~g~Please wait..."); PlayerTextDrawSetString(playerid, work[playerid], loading); new Message[100]; format(Message,sizeof(Message), "Unloading..."); SendClientMessage(playerid, WORK, Message); format(Message,sizeof(Message), "Please wait"); SendClientMessage(playerid, WORK, Message); } } return 1; } } }
SetPlayerCheckpoint(playerid, trucker[targetid][lx], trucker[targetid][ly], trucker[targetid][lz], 10);
Why'd you even post that up, it's irrelevant to what I even said before which was "24 hour bumps only"... Now I've edited my reply in the time you took to reply, and pointed out where your issue is...
|
Rather than basing the mission it gets off the playerid, as I said, when you select to be part of the convoy in playerid 1, you will _ONLY_ get mission 2, you need to track the initial players mission via a variable and use that.
Function is irrelevant in this case, it's all about tracking what the first player got as a random mission, and giving that to the second player. They will need to load though, so they will be using Trucker1, but that's simply to load up, it's not to do with the destination. |
one of my trucking friends said.
i need to store the mission |
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; }