Portal SAMP
[Ajuda] Anti slide bug - 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: [Ajuda] Anti slide bug (/showthread.php?tid=293)



Anti slide bug - annety - 07/11/2020

Sabe aquele bug de apertar c+espaço pra ativar o modo slide e correr mais rapido mirando?

Tentei detectar e parar isso assim:

Código:
// HOLDING(keys)
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))

Código:
if(HOLDING(KEY_SPRINT) && HOLDING(KEY_HANDBRAKE))
{
    if(GetPlayerWeapon(playerid) > 0 && GetPlayerWeapon(playerid) != 43 && GetPlayerWeapon(playerid) != 34) OnPlayerSlide(playerid);
}

Código:
forward OnPlayerSlide(playerid);
public OnPlayerSlide(playerid)
{
    ApplyAnimation(playerid, "GYMNASIUM", "gym_jog_falloff", 4.1, 0, 1, 1, 0, 0);
    return 1;
}

Tá detectando quando faz normal, mas os players descobriram um jeito de burlar isso Sad


- vc precisa ficar agaixado
- dar 1 toque só no espaço e ja começar a mirar
- n pode segurar o espaço

Alguém sabe uma forma melhor do que a que eu tenho pra detectar esse slide bug?


RE: Anti slide bug - ForT - 08/11/2020

Funcionou muito bem em localhost, agora precisa testar com ping maior:

Código PHP:
new
    
Float:player_x,
    
Float:player_y,
    
Float:player_z;

GetPlayerVelocity(playeridplayer_xplayer_yplayer_z);

if ((
1160 GetPlayerAnimationIndex(playerid) < 1163) && floatsqroot(floatpower(player_x2) + floatpower(player_y2) + floatpower(player_z2)) > 0.15)
{
    
GetPlayerPos(playeridplayer_xplayer_yplayer_z);
     
SetPlayerPos(playeridplayer_xplayer_yplayer_z);


OBS: coloque este código em algum timer ou em OnPlayerUpdate.


RE: Anti slide bug - xbruno1000x - 08/11/2020

Citar:SPECIAL_ACTION_DUCK - Detect if the player is crouching.
fonte: wiki.open.mp

Basicamente, você pode usar o GetPlayerSpecialAction e detectar se ele está abaixado.


RE: Anti slide bug - annety - 14/11/2020

(08/11/2020 11:47)xbruno1000x Escreveu:
Citar:SPECIAL_ACTION_DUCK - Detect if the player is crouching.
fonte: wiki.open.mp

Basicamente, você pode usar o GetPlayerSpecialAction e detectar se ele está abaixado.

Como?


(08/11/2020 02:12)ForT Escreveu: Funcionou muito bem em localhost, agora precisa testar com ping maior:

Código PHP:
new
    
Float:player_x,
    
Float:player_y,
    
Float:player_z;

GetPlayerVelocity(playeridplayer_xplayer_yplayer_z);

if ((
1160 GetPlayerAnimationIndex(playerid) < 1163) && floatsqroot(floatpower(player_x2) + floatpower(player_y2) + floatpower(player_z2)) > 0.15)
{
    
GetPlayerPos(playeridplayer_xplayer_yplayer_z);
     
SetPlayerPos(playeridplayer_xplayer_yplayer_z);


OBS: coloque este código em algum timer ou em OnPlayerUpdate.

Ah esse aqui funcionou!
Mt obg! Detectou xD
+rep