11.02.2017, 01:41
If he types /convoy (id). he won't got the same as the person who typed the id
Код:
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; } } }