Portal SAMP
[Pedido] Entrar/Sair em interior clicando em ´´F´´ - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Pedido] Entrar/Sair em interior clicando em ´´F´´ (/showthread.php?tid=3734)



Entrar/Sair em interior clicando em ´´F´´ - Usuário Aleatório - 30/06/2023

Olá,estou querondo colocar um sistema no meu servidor de entrar e sair de um interior clicando em ´´F´´,procurei muito aq no fórum mas n encontrei nada,poderiam me indicar algum?Ou poderiam me dizer como q faz esse sistema?


RE: Entrar/Sair em interior clicando em ´´F´´ - White_Blue - 30/06/2023

(30/06/2023 04:07)Usuário Aleatório Escreveu: Olá,estou querondo colocar um sistema no meu servidor de entrar e sair de um interior clicando em ´´F´´,procurei muito aq no fórum mas n encontrei nada,poderiam me indicar algum?Ou poderiam me dizer como q faz esse sistema?

Use a callback OnPlayerKeyStateChange.

Código PHP:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys) {
       if(
newkeys == KEY_SECONDARY_ATTACK) { // KEY_SECONDARY_ATTACK é o macro que representa a tecla 'F'
         // Seu código aqui
       

       return 
1;

Notas:
- Algumas teclas tem o uso diferente se o jogador se encontra dentro de um veículo, por exemplo, a tecla LSHIFT(Representada pelo macro KEY_JUMP) é representada pela tecla 'S' caso o jogador esteja dentro de um veículo
- Algumas teclas não tem seu macro pré-definido, como é o caso da tecla 'H', para defini-la, você pode usar a diretiva #define para definir o valor correspondente a tecla.
- Clique aqui para ir para a lista de teclas existentes no SA-MP.


RE: Entrar/Sair em interior clicando em ´´F´´ - Aranha - 30/06/2023

Código:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
    if(newkeys == KEY_SECONDARY_ATTACK)

    {
        if(IsPlayerInRangeOfPoint(playerid, 1.5, x,y,z))
        {


            SetPlayerPos(playerid, x,y,z);
            SetPlayerFacingAngle(playerid, a);
            SetPlayerInterior(playerid, id interior);
            SetPlayerVirtualWorld(playerid, id VirtualWorld);

        }

    }
    return 1;
}

se o jogador for teleportado para algum mapa modificado use um timer para q o jogador nao caia no limpo

Código:
TogglePlayerControllable(playerid, 0);
SetTimerEx("CarregarInterior", 4000, false, "i", playerid);

forward CarregarInterior(playerid);
public CarregarInterior(playerid)
{

TogglePlayerControllable(playerid, 1);
return 1;
}