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] = { //{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} };
CMD:overload(playerid, params[]) { SendMessageToAdmins(playerid, "/overload", params); if (GetPlayerTeam(playerid) == 1) { new m = GetVehicleModel(GetPlayerVehicleID(playerid)); if(m == 514 || m == 515 || m == 403 || m == 455) { new t = GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))); if (t == 435 || t == 450 || t == 584 || m == 455) { if (GetPlayerVehicleSeat(playerid) == 0) { new Message[180]; format(Message, sizeof(Message), "Your truck is over loaded! Watch Out for the police!"); SendClientMessage(playerid, -1, Message); TruckLoad[playerid] = 1; } else { SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You are not the driver of this vehicle"); } } else { SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You do not have a trailer, please go and attach one!"); } } else { SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You are not in a truck, please go and get one!"); } } return 1; }
You should make "IsLoaded" per vehicle/truck variable, to check if a truck loaded already.
|
new bool:g_isLoaded[MAX_VEHICLES]; // Put this somewhere in your script CMD:overload(playerid, params[]) { SendMessageToAdmins(playerid, "/overload", params); if (GetPlayerTeam(playerid) == 1) { new vid = GetPlayerVehicleID(playerid), m = GetVehicleModel(vid); if(m == 514 || m == 515 || m == 403 || m == 455) { new t = GetVehicleModel(GetVehicleTrailer(vid)); if (t == 435 || t == 450 || t == 584 || m == 455) { if (GetPlayerVehicleSeat(playerid) == 0) { if(g_isLoaded[vid]) // If truck is already loaded { SendClientMessage(playerid, -1, "Your truck is fully loaded."); } else { new Message[180]; format(Message, sizeof(Message), "Your truck is over loaded! Watch Out for the police!"); SendClientMessage(playerid, -1, Message); g_isLoaded[vid] = true; TruckLoad[playerid] = 1; } } else { SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You are not the driver of this vehicle"); } } else { SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You do not have a trailer, please go and attach one!"); } } else { SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You are not in a truck, please go and get one!"); } } return 1; }
Код:
new bool:g_isLoaded[MAX_VEHICLES]; // Put this somewhere in your script CMD:overload(playerid, params[]) { SendMessageToAdmins(playerid, "/overload", params); if (GetPlayerTeam(playerid) == 1) { new vid = GetPlayerVehicleID(playerid), m = GetVehicleModel(vid); if(m == 514 || m == 515 || m == 403 || m == 455) { new t = GetVehicleModel(GetVehicleTrailer(vid)); if (t == 435 || t == 450 || t == 584 || m == 455) { if (GetPlayerVehicleSeat(playerid) == 0) { if(g_isLoaded[vid]) // If truck is already loaded { SendClientMessage(playerid, -1, "Your truck is fully loaded."); } else { new Message[180]; format(Message, sizeof(Message), "Your truck is over loaded! Watch Out for the police!"); SendClientMessage(playerid, -1, Message); g_isLoaded[vid] = true; TruckLoad[playerid] = 1; } } else { SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You are not the driver of this vehicle"); } } else { SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You do not have a trailer, please go and attach one!"); } } else { SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You are not in a truck, please go and get one!"); } } return 1; } |
new bool:g_isLoaded[MAX_VEHICLES];
CMD:overload(playerid, params[])
{
SendMessageToAdmins(playerid, "/overload", params);
if (GetPlayerTeam(playerid) == 1)
{
new vid = GetPlayerVehicleID(playerid), m = GetVehicleModel(vid);
if(m == 514 || m == 515 || m == 403 || m == 455)
{
new t = GetVehicleModel(GetVehicleTrailer(vid));
if (t == 435 || t == 450 || t == 584 || m == 455)
{
if (GetPlayerVehicleSeat(playerid) == 0)
{
if(g_isLoaded[vid] == false) // If truck is already loaded
{
SendClientMessage(playerid, -1, "Your truck is fully loaded.");
g_isLoaded[vid] = true;
}
else
{
new Message[180];
format(Message, sizeof(Message), "Your truck is already loaded!");
SendClientMessage(playerid, -1, Message);
}
}
else
{
SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You are not the driver of this vehicle");
}
}
else
{
SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You do not have a trailer, please go and attach one!");
}
}
else
{
SendClientMessage(playerid, COLOUR_LIGHTGREEN, "You are not in a truck, please go and get one!");
}
}
return 1;
}
PHP код:
PHP код:
|
{1, 2420.6235,-2464.2495,13.6250, "Los Santos Warehouse", "Weapons", 1538.4180,-1674.5314,13.5469, "Los Santos Police Station", 3000, false},