Help on Trucker mission
#1

It's not showing dis:
Код:
{FFFF00}from {FFFF00}%s{FFFF00} to {FFFF00}%s{FFFF00
Here Define code:
Код:
#define TXT_PlayerCompletedTruckJob "{FFFF00}Trucker {FFFF00}%s{FFFF00} succesfully transported {FFFF00}%s{FFFF00} {FFFF00}from {FFFF00}%s{FFFF00} to {FFFF00}%s{FFFF00} {FFFF00}from {FFFF00}%s{FFFF00} to {FFFF00}%s{FFFF00}"
i wanana it show like dis:
Код:
{FFFF00}Trucker {FFFF00}%s{FFFF00} succesfully transported {FFFF00}%s{FFFF00} {FFFF00}from {FFFF00}%s{FFFF00} to {FFFF00}%s{FFFF00} {FFFF00}from {FFFF00}%s{FFFF00} to {FFFF00}%s{FFFF00}
Код:
// After a truckdriver entered a checkpoint, a timer is created. This function is called when the timer runs out
public Trucker_LoadUnload(playerid)
{
	// Check if the player is inside a convoy
	if (APlayerData[playerid][InConvoy] == true)
	{
		// If the player just loaded his goods at the loading-point
	    if (APlayerData[playerid][JobStep] == 1)
		{
	        APlayerData[playerid][JobStep] = 2; // Set the next step of the convoy-job (wait until all members have loaded their cargo)
			TextDrawSetString(APlayerData[playerid][MissionText], TXT_WaitingMembersToLoadCargo);
		}

		// If the player just delivered his goods at the unloading-point
		if (APlayerData[playerid][JobStep] == 3)
		{
	        APlayerData[playerid][JobStep] = 4; // Set the next step of the convoy-job (wait until all members have unloaded their cargo)
	    	TextDrawSetString(APlayerData[playerid][MissionText], TXT_WaitingMembersToUnLoadCargo);
		}

		DisablePlayerCheckpoint(playerid); // Delete the loading/unloading-checkpoint
		TogglePlayerControllable(playerid, 1); // Enable the player again (he can move again)

		return 1; // Don't allow the rest of the function to be executed
	}

	// If the player isn't inside a convoy, this part is executed

	// Check the JobStep
	switch (APlayerData[playerid][JobStep])
	{
		case 1: // Player must load his goods
		{
		    // Setup local variables
			new StartLoc[50], EndLoc[50], Load[50], RouteText[255], Float:x, Float:y, Float:z, UnloadMsg[100];
			// Set JobStep to 2 (unloading goods)
			APlayerData[playerid][JobStep] = 2;
			// Delete the loading-checkpoint
			DisablePlayerCheckpoint(playerid);
			// Get the startlocation, endlocation and the load texts
			format(StartLoc, 50, ALocations[APlayerData[playerid][JobLoc1]][LocationName]);
			format(EndLoc, 50, ALocations[APlayerData[playerid][JobLoc2]][LocationName]);
			format(Load, 50, ALoads[APlayerData[playerid][LoadID]][LoadName]);

			// Randomly set the load as overloaded (15% chance the load is overloaded)
			Trucker_SetRandomOverloaded(playerid);

			// Pre-format the missiontext (there may be some parts appended when overloaded/mafiaload
			format(RouteText, 255, TXT_HaulingCargoFromToDeliver, Load, StartLoc, EndLoc);
			// Check if the player is overloaded
			if (APlayerData[playerid][Overloaded] == true)
			{
			    // Add "(OL)" to the missiontext to let the player know he's been overloaded
				format(RouteText, 255, "%s%s", RouteText, " ~r~(OL)~w~");
				// Send a message to the player to let him know he's been overloaded
				SendClientMessage(playerid, 0xFFFFFFFF, TXT_TruckerOverloaded);
			}
			// Check if the player is carrying a mafia-load
			if (ALoads[APlayerData[playerid][LoadID]][Mafia] == true)
			{
			    // Add "(ML)" to the missiontext to let the player know his load is wanted by the mafia
				format(RouteText, 255, "%s%s", RouteText, " ~r~(ML)~w~");
			    // If the player is carrying a mafia-load, inform him about it
				GameTextForPlayer(playerid, TXT_TruckerMafiaInterested, 5000, 4);
				// Also set the data for the player to indicate he's carrying a mafiaload
				APlayerData[playerid][MafiaLoad] = true;
				// Also set the player's trailer ID (or the vehicle itself) as Mafia-load in the array "AVehicleMafiaLoad"
				if (APlayerData[playerid][TrailerID] == 0)
				    AVehicleData[APlayerData[playerid][VehicleID]][MafiaLoad] = true; // The player has no trailer, so set his main vehicle as wanted by the mafia
				else
                    AVehicleData[APlayerData[playerid][TrailerID]][MafiaLoad] = true; // The player has a trailer, so set his trailer as wanted by the mafia
			}

			// Set the TextDraw so the player can see it
			TextDrawSetString(APlayerData[playerid][MissionText], RouteText);

			// Grab the x, y, z positions for the second location (to unload the goods)
			x = ALocations[APlayerData[playerid][JobLoc2]][LocX];
			y = ALocations[APlayerData[playerid][JobLoc2]][LocY];
			z = ALocations[APlayerData[playerid][JobLoc2]][LocZ];
			// Create a checkpoint where the player should unload the goods
			SetPlayerCheckpoint(playerid, x, y, z, 7);
			// Inform the player that he must unload his goods
			format(UnloadMsg, 100, TXT_DeliverCargoTo, Load, EndLoc);
			SendClientMessage(playerid, 0xFFFFFFFF, UnloadMsg);
		}
		case 2: // Player is delivering his goods
		{
		    // Setup local variables
			new StartLoc[50], EndLoc[50], Load[50], Msg1[128], Name[24], BonusMsg[128];

			// Get the player name
			GetPlayerName(playerid, Name, sizeof(Name));
			// Get the startlocation, endlocation and the load texts
			format(StartLoc, 50, ALocations[APlayerData[playerid][JobLoc1]][LocationName]);
			format(EndLoc, 50, ALocations[APlayerData[playerid][JobLoc2]][LocationName]);
			format(Load, 50, ALoads[APlayerData[playerid][LoadID]][LoadName]);

			// Construct the message sent to all players that this player completed a trucking mission
			format(Msg1, 128, TXT_PlayerCompletedTruckJob, Name, Load, StartLoc, EndLoc);
			SendClientMessageToAll(0xFFFFFFFF, Msg1);



		    // Setup local variables
			new Float:x1, Float:y1, Float:x2, Float:y2, Float:Distance, Message[128], Payment, Bonus;
			// Grab the x, y, z positions for the first location (to load the goods)
			x1 = ALocations[APlayerData[playerid][JobLoc1]][LocX];
			y1 = ALocations[APlayerData[playerid][JobLoc1]][LocY];
			// Grab the x, y, z positions for the second location (to unload the goods)
			x2 = ALocations[APlayerData[playerid][JobLoc2]][LocX];
			y2 = ALocations[APlayerData[playerid][JobLoc2]][LocY];
			// Calculate the distance between both points
			Distance = floatsqroot(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));

			// Calculate the payment for the player
			Payment = floatround((Distance * ALoads[APlayerData[playerid][LoadID]][PayPerUnit]), floatround_floor);

			// Check if the player has done the bonus mission
			if (RandomBonusMission[MissionFinished] == false)
			{
				// Check all paramters (load, startlocation and end-location)
				if (RandomBonusMission[RandomLoad] == APlayerData[playerid][LoadID])
					if (RandomBonusMission[RandomStartLoc] == APlayerData[playerid][JobLoc1])
						if (RandomBonusMission[RandomEndLoc] == APlayerData[playerid][JobLoc2])
						{
						    Payment = Payment * 2; // Double the payment is the player was the first to do the bonus mission
                            RandomBonusMission[MissionFinished] = true; // Only one player can do the bonus mission, a new one is chosen next
							format(BonusMsg, 128, "{00BBFF}Player {FFBB00}%s{00BBFF} has finished the bonus mission", Name);
							SendClientMessageToAll(0xFFFFFFFF, BonusMsg);
						}
			}

			// Pay the player based on the distance between the loading-point and unloading-point
			RewardPlayer(playerid, Payment, 0);
			// Send a message to let the player know he finished his mission and got paid
			format(Message, 128, TXT_RewardJob, Payment);
			SendClientMessage(playerid, 0xFFFFFFFF, Message);

			// Add 25% bonus if the player has been overloaded
			if (APlayerData[playerid][Overloaded] == true)
			{
			    // Calculate the bonus
			    Bonus = (Payment * 25) / 100;
				// Pay the bonus to the player
				RewardPlayer(playerid, Bonus, 0);
				// Send a message to let the player know he was overloaded and got paid
				format(Message, 128, TXT_TruckerBonusOverloaded, Bonus);
				SendClientMessage(playerid, 0xFFFFFFFF, Message);
			}

			// Add 50% bonus if the player has delivered a mafia load (mafia couldn't steal his load)
			if (APlayerData[playerid][MafiaLoad] == true)
			{
			    // Calculate the bonus
			    Bonus = (Payment * 50) / 100;
				// Pay the bonus to the player
				RewardPlayer(playerid, Bonus, 0);
				// Send a message to let the player know he was overloaded and got paid
				format(Message, 128, TXT_TruckerBonusMafiaLoad, Bonus);
				SendClientMessage(playerid, 0xFFFFFFFF, Message);
			}

			// Add 10% bonus if the player has delivered the load with his own truck
			if (AVehicleData[APlayerData[playerid][VehicleID]][Owned] == true)
			{
			    // Calculate the bonus
			    Bonus = (Payment * 10) / 100;
				// Pay the bonus to the player
				RewardPlayer(playerid, Bonus, 0);
				// Send a message to let the player know he was overloaded and got paid
				format(Message, 128, TXT_TruckerBonusOwnVehicle, Bonus);
				SendClientMessage(playerid, 0xFFFFFFFF, Message);
			}

			// Also add score-points to the score of the player based on the distance between the loading and unloading points
			if (Distance > 3000.0)
				RewardPlayer(playerid, 0, 2); // Distance is larger than 3000 units, so add 2 points
			else
				RewardPlayer(playerid, 0, 1); // Distance is less than 3000 units, so add 1 point

			// Increase the stats for completing a trucking job
			APlayerData[playerid][StatsTruckerJobs]++;
			// Also save the data (in case the server crashes, progress would be lost)
			PlayerFile_Save(playerid);

			// End the current trucker job (clear mission-data)
			Trucker_EndJob(playerid);
		}
	}

    // Enable the player again (he can move again)
	TogglePlayerControllable(playerid, 1);

	return 1;
}
It say: Truck Test Succesfully transported Cement from quarry t.
Not showing the full word.
Reply
#2

Msg1 is only 128 cells large, and that message is over 180.
Reply
#3

Can you fix my code?
Plz post the code
Don't get but can you ? post the code
Reply
#4

i don't get it.
Reply
#5

how i make the all words show?
Reply
#6

Msg1[128]

Change that too a bigger size.
Reply
#7

can give code
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)