[Ajuda] Radar
#1

Iai,bom vim aqui pedir ajuda pois estou com um problema,tenho o comando de criarradar mas eu quero que ele venha jб mostrando a velocidade de cada radar,mas nгo sei como fazer isso,nгo quero fazer Create3DTextLabel,um por um,alguйm tem ideia de como criar ?

Se precisar do comando...

Код:
CMD:criarradar(playerid, params[])
{
    if (APlayerData[playerid][LoggedIn] != true) return SendClientMessage(playerid, -1, "{FFFF00}[ERRO] {009D4F}Vocк nгo estб logado!");
	// Setup local variables
	new Float:x, Float:y, Float:z, Float:Angle, MaxSpeed, file[100], File:PFile, LineForFile[100], Msg[128];
    if (APlayerData[playerid][PlayerJailed] != 0) return SendClientMessage(playerid, COR_ERRO, "[ERRO] Vocк nгo pode usar esse comando na cadeia!");
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 5
        if(CallRemoteFunction("PegarLevelNovo","i",playerid) < 5) return SendClientMessage(playerid, -1, "{FF0000}[ERRO]: Vocк nгo tem permissгo para isso!");
		if (sscanf(params, "i", MaxSpeed)) SendClientMessage(playerid, 0xFF0000AA, "Use: \"/criarradar <Velocidade>\"");
		else
		{

			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, "{FFFF00}[INFO] {009D4F}Vocк criou a camera ID: %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, "{FFFF00}[ERRO] {009D4F}Vocк nгo pode criar mais de %i cameras", MAX_CAMERAS);
			SendClientMessage(playerid, 0xFFFFFFFF, Msg);
		}
	}
	else
	    return 0;
	return 1;
}
Код:
CMD:delradar(playerid, params[])
{
	if (APlayerData[playerid][LoggedIn] != true) return SendClientMessage(playerid, -1, "{FFFF00}[ERRO] {009D4F}Vocк nгo estб logado!");
	new file[100], Msg[128];
    if (APlayerData[playerid][PlayerJailed] != 0) return SendClientMessage(playerid, COR_ERRO, "[ERRO] Vocк nгo pode usar esse comando na cadeia!");
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 5
        if(CallRemoteFunction("PegarLevelNovo","i",playerid) < 2) return SendClientMessage(playerid, -1, "{FF0000}[ERRO]: Vocк nгo tem permissгo para isso!");
	    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
				    DestroyDynamicObject(ACameras[CamID][CamObj1]);
				    DestroyDynamicObject(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, "{FFFF00}[INFO] {009D4F}Vocк deletou a camera ID %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, "{FFFF00}[ERRO] {009D4F}Vocк precisa estб perto da camera");
	}
	else
	    return 0;

	return 1;
}
Reply
#2

PPC_Defines:
pawn Код:
//Ponha a Virgula "," no Code de Cima que Com Certeza deve ser "CamObj2,'' Ponha uma Virgula
Text3D:CamObj4 // Deixe sem Virgula para nгo dar Erros
PPC_Common Procure por "SetupSpeedCamera" e Dentro ponha isso:
pawn Код:
new String[128];
    format(String, sizeof(String), "{FF0000}Radar\n {00F5FF} Velocidade Maxima{FFFFFF} %i Km/h\n\n\n\n\n\n\n\n\n{FF0000}",     MaxSpeed);
    ACameras[CamID][CamObj4] = Create3DTextLabel(String, -1, x, y, z +     4.2,        50.0, 0, 0);
PPC_PlayersCommands no CMD delradar Procure aonde Deleta os Objetos "DestroyObject"
e Ponha isso:
pawn Код:
Delete3DTextLabel(ACameras[CamID][CamObj4]);
Pronto. Caso de algum Erro post abaixo.
Reply
#3

Tudo funcionando perfeitamente sу que quando eu deleto o Radar o 3DLabel ainda fica...
Reply
#4

Quote:
Originally Posted by Canema
Посмотреть сообщение
Onde eu coloco essa define ?

#define Text3D:CamObj4 ?
coloque no PPC_Defines:
pawn Код:
Text3D:CamObj4
@Edit! Funcionou se funcionou Posta ai por favor!!
Reply
#5

http://imgur.com/YGKZfYq
Reply
#6

Ta criando sу as label?
Reply
#7

Sim,mas nгo estб deletando,se tiver skype passa ai
Reply
#8

O seu deve ta assim:
pawn Код:
DestroyObject(ACameras[CamID][CamObj1]);
                        DestroyObject(ACameras[CamID][CamObj2]);
                        Delete3DTextLabel(ACameras[CamID][CamObj4]);//Coloque isso <<<<

                        // 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;
Reply
#9

@RESOLVIDO

Muito obrigado mesmo jб dei REP+
Reply
#10

Quote:
Originally Posted by Canema
Посмотреть сообщение
@RESOLVIDO

Muito obrigado mesmo jб dei REP+
Dnada.. nois ta aki pra ajudar. add la no SKYPE
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)