Overload Truck
#1

When the player types /work but IsLoaded is false. You cannot load your truck . How can i send a message saying. You cannot over load your truck inside this command? called /overload

Код:
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;
}
Reply
#2

You should make "IsLoaded" per vehicle/truck variable, to check if a truck loaded already.
Reply
#3

Quote:
Originally Posted by X337
Посмотреть сообщение
You should make "IsLoaded" per vehicle/truck variable, to check if a truck loaded already.
can you post a code, how you do it?>
Reply
#4

Код:
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;
}
Also, don't forget to set "g_isLoaded" to false, right after a player finish/cancel the truck job.
Reply
#5

Quote:
Originally Posted by X337
Посмотреть сообщение
Код:
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;
}
Also, don't forget to set "g_isLoaded" to false, right after a player finish/cancel the truck job.
I mean like You can't not over-load your truck cause the mission is false
Reply
#6

bump
Reply
#7

PHP код:
new bool:g_isLoaded[MAX_VEHICLES]; 
PHP код:
CMD:overload(playeridparams[])
{
    
SendMessageToAdmins(playerid"/overload"params);
    if (
GetPlayerTeam(playerid) == 1)
    {
        new 
vid GetPlayerVehicleID(playerid), GetVehicleModel(vid);
        if(
== 514 || == 515 || == 403 || == 455)
        {
            new 
GetVehicleModel(GetVehicleTrailer(vid));
            if (
== 435 || == 450 || == 584 || == 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(Messagesizeof(Message), "Your truck is already loaded!");
                        
SendClientMessage(playerid, -1Message);
                    
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_LIGHTGREEN"You are not the driver of this vehicle");
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOUR_LIGHTGREEN"You do not have a trailer, please go and attach one!");
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOUR_LIGHTGREEN"You are not in a truck, please go and get one!");
        }
    }
    return 
1;

Reply
#8

Quote:
Originally Posted by AndreiWow
Посмотреть сообщение
PHP код:
new bool:g_isLoaded[MAX_VEHICLES]; 
PHP код:
CMD:overload(playeridparams[])
{
    
SendMessageToAdmins(playerid"/overload"params);
    if (
GetPlayerTeam(playerid) == 1)
    {
        new 
vid GetPlayerVehicleID(playerid), GetVehicleModel(vid);
        if(
== 514 || == 515 || == 403 || == 455)
        {
            new 
GetVehicleModel(GetVehicleTrailer(vid));
            if (
== 435 || == 450 || == 584 || == 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(Messagesizeof(Message), "Your truck is already loaded!");
                        
SendClientMessage(playerid, -1Message);
                    
                    }
                }
                else
                {
                    
SendClientMessage(playeridCOLOUR_LIGHTGREEN"You are not the driver of this vehicle");
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOUR_LIGHTGREEN"You do not have a trailer, please go and attach one!");
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOUR_LIGHTGREEN"You are not in a truck, please go and get one!");
        }
    }
    return 
1;

i want to said. You cannot overload. from the mission enum. let's say i can't overload on this mission


Код:
{1, 2420.6235,-2464.2495,13.6250, "Los Santos Warehouse", "Weapons", 1538.4180,-1674.5314,13.5469, "Los Santos Police Station", 3000, false},
if the player types /overload on that mission. it will said you cannot overload your trailer with this mission



False = Cannot overload on this mission
True = Can overload on this mission
Reply
#9

bump
Reply
#10

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)