[AJUDA] Colocar 'R' no comando /criarradar
#1

Ola galera do forum, eu queria colocar um R debaixo do radar no mapa
Tipo Quando eu digitar /criarradar [velocidade] criava o RADAR e o R que vai aparecer no mapa pra avisar que tem radar ali
Uma imagem do 'R'
o comando de criar radar
Код:
// This command allows you to create a speedcamera
COMMAND:criarradar(playerid, params[])
{
	// Setup local variables
	new Float:x, Float:y, Float:z, Float:Angle, MaxSpeed, file[100], File:PFile, LineForFile[100], Msg[128];

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

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 5
		if (APlayerData[playerid][PlayerLevel] >= 5)
		{
			if (sscanf(params, "i", MaxSpeed)) SendClientMessage(playerid, 0xFF0000AA, "Use: \"/criarradar <max_speed>\"");
			else
			{
				// Get player's position and facing angle
				GetPlayerPos(playerid, x, y, z);
				GetPlayerFacingAngle(playerid, Angle);
				z = z - 1.0; // Adjust camera Z-coordinate 1m lower than normal (otherwise the camera floats in the air)

				// Move the player a bit, otherwise he could get stuck inside the camera-object
				SetPlayerPos(playerid, x, y + 1.0, z + 1.0);

				// Save the camera to a file
				for (new CamID; CamID < MAX_CAMERAS; CamID++)
				{
					// Check if this index is free
					if (ACameras[CamID][CamSpeed] == 0)
					{
					    // Setup this camera (create the objects and store the data)
                        SetupSpeedCamera(CamID, x, y, z, Angle, MaxSpeed);

					    // Save the file
						format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file

						PFile = fopen(file, io_write); // Open the camera-file for writing

						format(LineForFile, 100, "CamX %f\r\n", x);
						fwrite(PFile, LineForFile); // And save it to the file
						format(LineForFile, 100, "CamY %f\r\n", y);
						fwrite(PFile, LineForFile); // And save it to the file
						format(LineForFile, 100, "CamZ %f\r\n", z);
						fwrite(PFile, LineForFile); // And save it to the file
						format(LineForFile, 100, "CamAngle %f\r\n", Angle);
						fwrite(PFile, LineForFile); // And save it to the file
						format(LineForFile, 100, "CamSpeed %i\r\n", MaxSpeed);
						fwrite(PFile, LineForFile); // And save it to the file

						fclose(PFile); // Close the file

						// Let the player know he created a new camera
						format(Msg, 128, "Voce criou um radar com id: {FFFF00}%i", CamID);
						SendClientMessage(playerid, 0x00FF00FF, Msg);

						// Exit the function
						return 1;
					}
				}

				// In case all camera-slots are occupied (100 camera's have been created already), let the player know about it
				format(Msg, 128, "{FF0000}Vocк nгo pode criar mais de %i radares's", MAX_CAMERAS);
				SendClientMessage(playerid, 0xFFFFFFFF, Msg);
			}
		}
		else
		    return 0;
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}
Espero que alguem me ajude
Reply
#2

pawn Код:
// This command allows you to create a speedcamera
COMMAND:criarradar(playerid, params[])
{
    // Setup local variables
    new Float:x, Float:y, Float:z, Float:Angle, MaxSpeed, file[100], File:PFile, LineForFile[100], Msg[128];

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

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player's admin-level is at least 5
        if (APlayerData[playerid][PlayerLevel] >= 5)
        {
            if (sscanf(params, "i", MaxSpeed)) SendClientMessage(playerid, 0xFF0000AA, "Use: \"/criarradar <max_speed>\"");
            else
            {
                // Get player's position and facing angle
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, Angle);
                z = z - 1.0; // Adjust camera Z-coordinate 1m lower than normal (otherwise the camera floats in the air)

                // Move the player a bit, otherwise he could get stuck inside the camera-object
                SetPlayerPos(playerid, x, y + 1.0, z + 1.0);

                // Save the camera to a file
                for (new CamID; CamID < MAX_CAMERAS; CamID++)
                {
                    // Check if this index is free
                    if (ACameras[CamID][CamSpeed] == 0)
                    {
                        // Setup this camera (create the objects and store the data)
                        SetupSpeedCamera(CamID, x, y, z, Angle, MaxSpeed);

                        // Save the file
                        format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file

                        PFile = fopen(file, io_write); // Open the camera-file for writing

                        format(LineForFile, 100, "CamX %f\r\n", x);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamY %f\r\n", y);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamZ %f\r\n", z);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamAngle %f\r\n", Angle);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamSpeed %i\r\n", MaxSpeed);
                        fwrite(PFile, LineForFile); // And save it to the file

                        fclose(PFile); // Close the file
                        SetPlayerMapIcon ( playerid, 1 , x , y , y , 34 , 0 , MAPICON_LOCAL ) ;
                        // Let the player know he created a new camera
                        format(Msg, 128, "Voce criou um radar com id: {FFFF00}%i", CamID);
                        SendClientMessage(playerid, 0x00FF00FF, Msg);

                        // Exit the function
                        return 1;
                    }
                }

                // In case all camera-slots are occupied (100 camera's have been created already), let the player know about it
                format(Msg, 128, "{FF0000}Vocк nгo pode criar mais de %i radares's", MAX_CAMERAS);
                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
            }
        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
Nгo testei ... c nao der avisa *--*
Reply
#3

oks Vo testar
Reply
#4

Funciono Sim
mais quando eu vo deletar ele nao some
pode me ajudar denovo
Reply
#5

qual й o comando para deletar o radar??
post ai
Reply
#6

Код:
// This command allows you to delete a speedcamera
COMMAND:deletarradar(playerid, params[])
{
	// Setup local variables
	new file[100], Msg[128];

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

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 5
		if (APlayerData[playerid][PlayerLevel] >= 5)
		{
				// Loop through all camera's
			for (new CamID; CamID < MAX_CAMERAS; CamID++)
			{
				// Check if this index is used
				if (ACameras[CamID][CamSpeed] != 0)
				{
					// Check if the player is in range of the camera
					if (IsPlayerInRangeOfPoint(playerid, 5.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
					{
					    // Delete the file
						format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file
						if (fexist(file)) // Make sure the file exists
							fremove(file); // Delete the file

						// Delete both camera objects
					    DestroyObject(ACameras[CamID][CamObj1]);
					    DestroyObject(ACameras[CamID][CamObj2]);
						// Also clear the data from memory
					    ACameras[CamID][CamX] = 0.0;
					    ACameras[CamID][CamY] = 0.0;
					    ACameras[CamID][CamZ] = 0.0;
					    ACameras[CamID][CamAngle] = 0.0;
					    ACameras[CamID][CamSpeed] = 0;
                        ACameras[CamID][CamObj1] = 0;
                        ACameras[CamID][CamObj2] = 0;

						// Let the player know he deleted a camera
						format(Msg, 128, "Voce deletou o radar com id: {FFFF00}%i", CamID);
						SendClientMessage(playerid, 0x00FF00FF, Msg);

						// Exit the function
						return 1;
					}
				}
			}

			// In case the player wasn't near a speedcamera, inform him about it
			SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Voce nao esta perto de um radar");
		}
		else
		    return 0;
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}
Reply
#7

Usa

RemovePlayerMapIcon
Reply
#8

Use esse para criar o radar
pawn Код:
// This command allows you to create a speedcamera
COMMAND:criarradar(playerid, params[])
{
    // Setup local variables
    new Float:x, Float:y, Float:z, Float:Angle, MaxSpeed, file[100], File:PFile, LineForFile[100], Msg[128];

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

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player's admin-level is at least 5
        if (APlayerData[playerid][PlayerLevel] >= 5)
        {
            if (sscanf(params, "i", MaxSpeed)) SendClientMessage(playerid, 0xFF0000AA, "Use: \"/criarradar <max_speed>\"");
            else
            {
                // Get player's position and facing angle
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, Angle);
                z = z - 1.0; // Adjust camera Z-coordinate 1m lower than normal (otherwise the camera floats in the air)

                // Move the player a bit, otherwise he could get stuck inside the camera-object
                SetPlayerPos(playerid, x, y + 1.0, z + 1.0);

                // Save the camera to a file
                for (new CamID; CamID < MAX_CAMERAS; CamID++)
                {
                    // Check if this index is free
                    if (ACameras[CamID][CamSpeed] == 0)
                    {
                        // Setup this camera (create the objects and store the data)
                        SetupSpeedCamera(CamID, x, y, z, Angle, MaxSpeed);

                        // Save the file
                        format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file

                        PFile = fopen(file, io_write); // Open the camera-file for writing

                        format(LineForFile, 100, "CamX %f\r\n", x);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamY %f\r\n", y);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamZ %f\r\n", z);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamAngle %f\r\n", Angle);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamSpeed %i\r\n", MaxSpeed);
                        fwrite(PFile, LineForFile); // And save it to the file

                        fclose(PFile); // Close the file
                        SetPlayerMapIcon ( playerid, CamID , x , y , y , 34 , 0 , MAPICON_LOCAL ) ;
                        // Let the player know he created a new camera
                        format(Msg, 128, "Voce criou um radar com id: {FFFF00}%i", CamID);
                        SendClientMessage(playerid, 0x00FF00FF, Msg);

                        // Exit the function
                        return 1;
                    }
                }

                // In case all camera-slots are occupied (100 camera's have been created already), let the player know about it
                format(Msg, 128, "{FF0000}Vocк nгo pode criar mais de %i radares's", MAX_CAMERAS);
                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
            }
        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
e use esse pra deletar
pawn Код:
// This command allows you to delete a speedcamera
COMMAND:deletarradar(playerid, params[])
{
// Setup local variables
new file[100], Msg[128];

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

// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 5
if (APlayerData[playerid][PlayerLevel] >= 5)
{
// Loop through all camera's
for (new CamID; CamID < MAX_CAMERAS; CamID++)
{
// Check if this index is used
if (ACameras[CamID][CamSpeed] != 0)
{
// Check if the player is in range of the camera
if (IsPlayerInRangeOfPoint(playerid, 5.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
{
// Delete the file
format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file
if (fexist(file)) // Make sure the file exists
fremove(file); // Delete the file

// Delete both camera objects
DestroyObject(ACameras[CamID][CamObj1]);
DestroyObject(ACameras[CamID][CamObj2]);
// Also clear the data from memory
ACameras[CamID][CamX] = 0.0;
ACameras[CamID][CamY] = 0.0;
ACameras[CamID][CamZ] = 0.0;
ACameras[CamID][CamAngle] = 0.0;
ACameras[CamID][CamSpeed] = 0;
ACameras[CamID][CamObj1] = 0;
ACameras[CamID][CamObj2] = 0;
RemovePlayerMapIcon(playerid,CamID);
// Let the player know he deleted a camera
format(Msg, 128, "Voce deletou o radar com id: {FFFF00}%i", CamID);
SendClientMessage(playerid, 0x00FF00FF, Msg);

// Exit the function
return 1;
}
}
}

// In case the player wasn't near a speedcamera, inform him about it
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Voce nao esta perto de um radar");
}
else
return 0;
}
else
return 0;

// Let the server know that this was a valid command
return 1;
}
ve c funfa?? *--*
Reply
#9

criando o icone no cmd /criarradar
Quote:
Originally Posted by Trigo
Посмотреть сообщение
pawn Код:
// This command allows you to create a speedcamera
COMMAND:criarradar(playerid, params[])
{
    // Setup local variables
    new Float:x, Float:y, Float:z, Float:Angle, MaxSpeed, file[100], File:PFile, LineForFile[100], Msg[128];

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

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player's admin-level is at least 5
        if (APlayerData[playerid][PlayerLevel] >= 5)
        {
            if (sscanf(params, "i", MaxSpeed)) SendClientMessage(playerid, 0xFF0000AA, "Use: \"/criarradar <max_speed>\"");
            else
            {
                // Get player's position and facing angle
                GetPlayerPos(playerid, x, y, z);
                GetPlayerFacingAngle(playerid, Angle);
                z = z - 1.0; // Adjust camera Z-coordinate 1m lower than normal (otherwise the camera floats in the air)

                // Move the player a bit, otherwise he could get stuck inside the camera-object
                SetPlayerPos(playerid, x, y + 1.0, z + 1.0);

                // Save the camera to a file
                for (new CamID; CamID < MAX_CAMERAS; CamID++)
                {
                    // Check if this index is free
                    if (ACameras[CamID][CamSpeed] == 0)
                    {
                        // Setup this camera (create the objects and store the data)
                        SetupSpeedCamera(CamID, x, y, z, Angle, MaxSpeed);

                        // Save the file
                        format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file

                        PFile = fopen(file, io_write); // Open the camera-file for writing

                        format(LineForFile, 100, "CamX %f\r\n", x);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamY %f\r\n", y);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamZ %f\r\n", z);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamAngle %f\r\n", Angle);
                        fwrite(PFile, LineForFile); // And save it to the file
                        format(LineForFile, 100, "CamSpeed %i\r\n", MaxSpeed);
                        fwrite(PFile, LineForFile); // And save it to the file

                        fclose(PFile); // Close the file
                        SetPlayerMapIcon ( playerid, 34 , x , y , y , 34 , 0 , MAPICON_LOCAL ) ;
                        // Let the player know he created a new camera
                        format(Msg, 128, "Voce criou um radar com id: {FFFF00}%i", CamID);
                        SendClientMessage(playerid, 0x00FF00FF, Msg);

                        // Exit the function
                        return 1;
                    }
                }

                // In case all camera-slots are occupied (100 camera's have been created already), let the player know about it
                format(Msg, 128, "{FF0000}Vocк nгo pode criar mais de %i radares's", MAX_CAMERAS);
                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
            }
        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
Testado ... Mesmo se nao funfar .. Entre em contato comigo Nill_p14@hotmail.com
Reply
#10

deletando o icone com o cmd /deletarradar
Quote:
Originally Posted by RodrigoGirolamo
Посмотреть сообщение
Код:
// This command allows you to delete a speedcamera
COMMAND:deletarradar(playerid, params[])
{
// Setup local variables
new file[100], Msg[128];

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

// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 5
if (APlayerData[playerid][PlayerLevel] >= 5)
{
// Loop through all camera's
for (new CamID; CamID < MAX_CAMERAS; CamID++)
{
// Check if this index is used
if (ACameras[CamID][CamSpeed] != 0)
{
// Check if the player is in range of the camera
if (IsPlayerInRangeOfPoint(playerid, 5.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
{
// Delete the file
format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file
if (fexist(file)) // Make sure the file exists
fremove(file); // Delete the file

// Delete both camera objects
DestroyObject(ACameras[CamID][CamObj1]);
DestroyObject(ACameras[CamID][CamObj2]);
// Also clear the data from memory
ACameras[CamID][CamX] = 0.0;
ACameras[CamID][CamY] = 0.0;
ACameras[CamID][CamZ] = 0.0;
ACameras[CamID][CamAngle] = 0.0;
ACameras[CamID][CamSpeed] = 0;
ACameras[CamID][CamObj1] = 0;
ACameras[CamID][CamObj2] = 0;
RemovePlayerMapIcon( playerid, 34 );
// Let the player know he deleted a camera
format(Msg, 128, "Voce deletou o radar com id: {FFFF00}%i", CamID);
SendClientMessage(playerid, 0x00FF00FF, Msg);

// Exit the function
return 1;
}
}
}

// In case the player wasn't near a speedcamera, inform him about it
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Voce nao esta perto de um radar");
}
else
return 0;
}
else
return 0;

// Let the server know that this was a valid command
return 1;
}
Testado .. Mesmo se nao funcionar.. Contate pelo Msn Nill_p14@hotmail.com
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)