Jump to content
  • 0

Comanda /assist la server de Trucking


Dan_13

Question

Salut am vazut recent pe un server de trucking cv care nush cum sa fac adica stiu dar mie imi ese alt fel uitativa cum are el:(e msg_box) http://postimg.org/image/rdrzbedh9/

[pawn]COMMAND:assist(playerid, params[])

{

// Setup local variables

new bool:AssistOnline = false, Msg[128], Name[24];

// Send the command to all admins so they can see it

SendAdminText(playerid, "/assist", params);

// Check if the player has logged in

if (APlayerData[playerid][LoggedIn] == true)

{

// Get the player's name

GetPlayerName(playerid, Name, sizeof(Name));

// Preset the message that needs to be sent to assistance players

format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} needs assistance, go help him", Name);

// Check if there is at least one assistance player online

for (new i; i < MAX_PLAYERS; i++)

{

// Check if this player is connected

if (IsPlayerConnected(i))

{

// Check if this player is assistance class

if (APlayerData[PlayerClass] == ClassAssistance)

{

// Set the flag to indicate that at least one assistance player is online

    AssistOnline = true;

    // Send the assistance player a message to inform him who needs assistance

    SendClientMessage(i, 0xFFFFFFFF, Msg);

}

}

}

// Check if there is at least one assistance player online

if (AssistOnline == true)

{

// Set yourself as "AssistanceNeeded"

APlayerData[playerid][AssistanceNeeded] = true;

// Let the player know he called for assistance

SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}You've called for assistance");

}

else // No assistance is online

{

// Check if the player is the driver of a vehicle

if (GetPlayerVehicleSeat(playerid) == 0)

{

// Fully repair the vehicle (damage value and bodywork)

RepairVehicle(GetPlayerVehicleID(playerid));

// Also re-fuel the vehicle

AVehicleData[GetPlayerVehicleID(playerid)][Fuel] = MaxFuel;

// Let the player pay for the repairs and refuel (default $2000)

RewardPlayer(playerid, -2000, 0);

// Let the player know he spent $2000 for auto-repair because there were no assistance players online

    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Tiau fost luat $2000 pt ca nu e nimeni la assist ");

 

}

}

}

else

    return 0;[/pawn]

rdrzbedh9

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Buna Ziua, :D

incercati asta:

COMMAND:assist(playerid, params[])
{
	// Setup local variables
	new bool:AssistOnline = false, Msg[128], Name[24];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/assist", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Get the player's name
		GetPlayerName(playerid, Name, sizeof(Name));
		// Preset the message that needs to be sent to assistance players
		  SendClientMessageToAll(-1, "{00FF00}Jucatorul {FFFF00}%s{00FF00} are nevoie de ajutor, ajutati-l!", Name);

		// Check if there is at least one assistance player online
		for (new i; i < MAX_PLAYERS; i++)
		{
			// Check if this player is connected
			if (IsPlayerConnected(i))
			{
				// Check if this player is assistance class
				if (APlayerData[i][PlayerClass] == ClassAssistance)
				{
					// Set the flag to indicate that at least one assistance player is online
				    AssistOnline = true;
				    // Send the assistance player a message to inform him who needs assistance
				    SendClientMessage(i, 0xFFFFFFFF, Msg);
				}
			}
		}

		// Check if there is at least one assistance player online
		if (AssistOnline == true)
		{
			// Set yourself as "AssistanceNeeded"
			APlayerData[playerid][AssistanceNeeded] = true;
			// Let the player know he called for assistance
			SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}You've called for assistance");
		}
		else // No assistance is online
		{
			// Check if the player is the driver of a vehicle
			if (GetPlayerVehicleSeat(playerid) == 0)
			{
				// Fully repair the vehicle (damage value and bodywork)
				RepairVehicle(GetPlayerVehicleID(playerid));
				// Also re-fuel the vehicle
				AVehicleData[GetPlayerVehicleID(playerid)][Fuel] = MaxFuel;
				// Let the player pay for the repairs and refuel (default $2000)
				RewardPlayer(playerid, -2000, 0);
				// Let the player know he spent $2000 for auto-repair because there were no assistance players online
				ShowPlayerDialog(playerid, DIALOG_REPAIR, DIALOG_STYLE_MSGBOX, "Repair", "{FF0000}Tiau fost luat $2000 pt ca nu e nimeni la assist", "OK", "");

			}
		}
	}
	else
	    return 0;

Imi puteti explica detaliat mesajul?

M-am lasat de comunitatea sa-mp.ro

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.