[Ajuda] Usar item player 100% parado...
#1

Para todos que sabem tem um sistema de inventario pra servidores RPG's, so que igual alguns itens eu gostaria que o player fica-se parado 100% pra poder usar, vou colocar como exemplo um comando, pra o player usar tal comando ele precisa ta 100% parado, se ele estiver pulando, caindo, andando, em cima de veiculos ou correndo nгo conseguir usar alguem pode me ajudar ?
Reply
#2

Ao abrir o inventбrio, na lуgica, ele vai ficar parado, visto que abre um dialog/textdraw e ele nгo tem como se mover, nй.
Reply
#3

Entгo, pela logica sim mais as vezes a pessoa estб caindo ou estб em cima de um veiculo e pode utilizar. Poderia me ajudar ?
Reply
#4

Use GetPlayerSpeed para checar se a velocidade й maior que 0.

PHP Code:
stock GetPlayerSpeed(playerid,bool:kmh) // by misco edit by gamer_z
{
    new 
Float:Vx,Float:Vy,Float:Vz,Float:rtn;
    if(
IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
    
rtn = floatsqroot(Vx*Vx + Vy*Vy + Vz*Vz);
    return 
kmh?floatround(rtn * 100 * 1.63):floatround(rtn * 100);
} 
PHP Code:
GetPlayerSpeed(playerid, true) 
Reply
#5

Eu uso isso em meu sv para dropar arma parado, enfim.

PHP Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
    if(
newkeys & KEY_NO){ // Botгo pra abrir o inventбrio.
        
if(Get_Player_Animation(playerid, "IDLE_STANCE") || Get_Player_Animation(playerid, "IDLE_CSAW") || Get_Player_Animation(playerid, "IDLE_ARMED")){
            
// code, se a animaзгo for essa, eu nгo me lembro qual й essa, se nгo me engano elas й parada tals.    
        
} // da pra usar ao contrario tmb, se as animaзхes nгo forem essas tals.
    
}
    return 
1;
}
 
Get_Player_Animation(playerid, animation[]){ // funзгo simples.
    
new animname[32], animlib[32];
    
GetAnimationName(GetPlayerAnimationIndex(playerid), animlib, 32, animname, 32);
    if(!
strcmp(animname, animation))
        return 
true;
    return 
false;
}
// use para ver a animaзгo do player caindo, e sу coloque la na funзгo no if
public OnPlayerUpdate(playerid)
{
    new 
animname[32], animlib[32], string[65];
    
GetAnimationName(GetPlayerAnimationIndex(playerid), animlib, 32, animname, 32);
    
format(string, sizeof(string), "%s - %s", animlib, animname);
    
SendClientMessage(playerid, -1, string);
    return 
1;
} 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)