[AJUDA] SetPlayerCameraPos
#1

Como eu pega as Cordenada do SetPlayerCamera Pos Jб tentei pelo /save, to criando um sistema de camera que mostre a garagem e os corredores da DP e nгo to Conseguindo pegar as cordenada certinhas, meu code tб assim.


Код:
if(strcmp(cmd, "/camera", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
            if(IsACop(playerid))
            {
                if(!PlayerToPoint(8.0,playerid,238.3515,80.0124,1005.0391))
				{
				    SendClientMessage(playerid, COLOR_GREY, "   Vocк nгo estб no painel de seguranзa da DP !");
				    return 1;
				}
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_WHITE, "USE: /camera [numero 1 - 6]  (6 = Desligar)");
					return 1;
				}
				new number = strval(tmp);
				if(number < 1 || number > 6) { SendClientMessage(playerid, COLOR_GREY, "   Nъmero da cвmera mнnimo 1 mбximo 6 !"); return 1; }
				TogglePlayerControllable(playerid, 0);
				GetPlayerPos(playerid, Unspec[playerid][Coords][0],Unspec[playerid][Coords][1],Unspec[playerid][Coords][2]);
				if(number == 1) { SetPlayerCameraPos(playerid, 1533.3328,-1699.4635,6.2188); SetPlayerCameraLookAt(playerid, ,1533.3328,-1699.4635,6.2188,288.5559); }
				else if(number == 2) { SetPlayerCameraPos(playerid, 1540.4902,-1602.5297,23.1490); SetPlayerCameraLookAt(playerid, 1540.4902,-1602.5297,23.1490,231.5282); }
				else if(number == 3) { SetPlayerCameraPos(playerid, 242.7928,70.8676,1003.6406); SetPlayerCameraLookAt(playerid, 242.7928,70.8676,1003.6406,206.6764); }
				else if(number == 4) { SetPlayerCameraPos(playerid, 268.5110,92.1204,1001.0391); SetPlayerCameraLookAt(playerid, 268.5110,92.1204,1001.0391,179.5845); }
				else if(number == 5) { SetPlayerCameraPos(playerid, 242.7928,70.8676,1003.6406,260.6764); SetPlayerCameraLookAt(playerid, 123.6176,1846.4792,17.6549); }
				else if(number == 6)
				{
				    MedicBill[playerid] = 0;
					TogglePlayerControllable(playerid, 1);
					SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pSkin], Unspec[playerid][Coords][0], Unspec[playerid][Coords][1], Unspec[playerid][Coords][2], 10.0, -1, -1, -1, -1, -1, -1);
					SpawnPlayer(playerid);
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   Vocк nгo й um policial !");
			    return 1;
			}
		}
		return 1;
	}
Reply
#2

SetPlayerCameraPos(playerid, x, y, z); //Essa funзгo irб colocar a cвmera em um determinado lugar.
SetPlayerCameraLookAt(playerid, x, y, z); //Essa funзгo irб 'mirar' para onde a cвmera estб olhando.
SetCameraBehindPlayer(playerid); //Essa funзгo irб colocar a cвmera de volta pro player.

@ Edit -

Код:
if(strcmp(cmd, "/camera", true) == 0)
	{
	    tmp = strtok(cmdtext, idx);
		if(!IsACop(playerid))
		    return SendClientMessage(playerid, COLOR_GREY, "Vocк nгo й um policial!");
		if(!PlayerToPoint(8.0,playerid,238.3515,80.0124,1005.0391))
		    return SendClientMessage(playerid, COLOR_GREY, "Vocк nгo estб no painel de seguranзa da DP!");
		if(!strlen(tmp))
			return SendClientMessage(playerid, COLOR_WHITE, "USE: /camera [numero 1 - 6]  (6 = Desligar)");
		new number = strval(tmp);
		if(number < 1 || number > 6)
		    return SendClientMessage(playerid, COLOR_GREY, "Nъmero da cвmera mнnimo 1 mбximo 6!");
		TogglePlayerControllable(playerid, 0);
		GetPlayerPos(playerid, Unspec[playerid][Coords][0], Unspec[playerid][Coords][1], Unspec[playerid][Coords][2]);
		if(number == 1) { SetPlayerCameraPos(playerid, 1533.3328,-1699.4635,6.2188); SetPlayerCameraLookAt(playerid, ,1533.3328,-1699.4635,6.2188,288.5559); }
		else if(number == 2) { SetPlayerCameraPos(playerid, 1540.4902,-1602.5297,23.1490); SetPlayerCameraLookAt(playerid, 1540.4902,-1602.5297,23.1490,231.5282); }
		else if(number == 3) { SetPlayerCameraPos(playerid, 242.7928,70.8676,1003.6406); SetPlayerCameraLookAt(playerid, 242.7928,70.8676,1003.6406,206.6764); }
		else if(number == 4) { SetPlayerCameraPos(playerid, 268.5110,92.1204,1001.0391); SetPlayerCameraLookAt(playerid, 268.5110,92.1204,1001.0391,179.5845); }
		else if(number == 5) { SetPlayerCameraPos(playerid, 242.7928,70.8676,1003.6406,260.6764); SetPlayerCameraLookAt(playerid, 123.6176,1846.4792,17.6549); }
		else if(number == 6) {
			MedicBill[playerid] = 0;
			TogglePlayerControllable(playerid, 1);
			SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pSkin], Unspec[playerid][Coords][0], Unspec[playerid][Coords][1], Unspec[playerid][Coords][2], 10.0, -1, -1, -1, -1, -1, -1);
			SpawnPlayer(playerid);
		}
		return 1;
	}

Vocк pode otimizar seus cуdigos, sгo pequenos detalhes que irгo acrescentando vбrios pontinhos, por um exemplo.
if(IsPlayerConnecTed(playerid)) nгo й necessбrio, porque ninguйm consegue executar um comando nгo estando connectado, e mesmo que seja para a prevenзгo isso й inъtil, porque se alguйm nгo efetuar o login ele estarб como 'connected' entгo poderб usar o comando, a maneira de vocк se proteger contra isso seria colocando uma nova variбvel do tipo

//Quando ele loga
SetPVarInt(playerid, "Logado", 1);

//Para chegar se ele estб logado.
if(GetPVarInt(playerid, "Logado") == 0)
     return SendClientMessage(playerid, COR, "Vocк precisa estar logado!");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)