їSe puede hacer?
#1

Hola, me preguntaba si se puede hacer que un usuario para usar un comando tenga que estar agachado, si esta parado le salga un mensaje como "nesesitas estar agachado para usar este comando"

el comando es:

Quote:

CMD:rarma(playerid, params[])
{
new f = MAX_OBJ+1;
for(new a = 0; a < sizeof(PosObjeto); a++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, PosObjeto[a][0], PosObjeto[a][1], PosObjeto[a][2]))
{
f = a;
break;
}
}
if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "No estбs cerca de ningъn arma.");
else
{
new NombreArma[25];
new string[150];

PosObjeto[f][0] = 0.0;
PosObjeto[f][1] = 0.0;
PosObjeto[f][2] = 0.0;

DestroyObject(Objeto[f]);
//GivePlayerWeapon(playerid, IDObjeto[f][0], IDObjeto[f][1]);
DarArma(playerid, IDObjeto[f][0]);
GetWeaponNameEx(IDObjeto[f][0], NombreArma, sizeof(NombreArma));
format(string, sizeof(string), "* %s recoge %s del suelo.", NombreJugador(playerid), NombreArma);
ProxDetector(30.0, playerid, string, COLOR_ROL,COLOR_ROL,COLOR_ROL,COLOR_ROL,COLOR_ROL) ;
}
return 1;
}

Reply
#2

Код:
CMD:rarma(playerid, params[])
{
if(PlayerCrouching(playerid) == 1) return SendClientMessage(playerid, -1, "nesesitas estar agachado para usar este comando");
new f = MAX_OBJ+1;
for(new a = 0; a < sizeof(PosObjeto); a++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, PosObjeto[a][0], PosObjeto[a][1], PosObjeto[a][2]))
{
f = a;
break;
}
}
if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "No estбs cerca de ningъn arma.");
else
{
new NombreArma[25];
new string[150];

PosObjeto[f][0] = 0.0;
PosObjeto[f][1] = 0.0;
PosObjeto[f][2] = 0.0;

DestroyObject(Objeto[f]);
//GivePlayerWeapon(playerid, IDObjeto[f][0], IDObjeto[f][1]);
DarArma(playerid, IDObjeto[f][0]);
GetWeaponNameEx(IDObjeto[f][0], NombreArma, sizeof(NombreArma));
format(string, sizeof(string), "* %s recoge %s del suelo.", NombreJugador(playerid), NombreArma);
ProxDetector(30.0, playerid, string, COLOR_ROL,COLOR_ROL,COLOR_ROL,COLOR_ROL,COLOR_ROL) ;
}
return 1;
}

PlayerCrouching(playerid)
{
    new anim_lib[32];
    new anim_name[32];
    GetAnimationName(GetPlayerAnimationIndex(playerid), anim_lib, 32, anim_name, 32);
    if(strcmp(anim_lib, "PED") == 0 && strcmp(anim_name, "WEAPON_CROUCH") == 0) return 1;
    return 0;
}
Reply
#3

ya con el PlayerCrouching puedo usarlo en otros comandos?
Reply
#4

Quote:
Originally Posted by Bearminator
Посмотреть сообщение
Код:
CMD:rarma(playerid, params[])
{
if(PlayerCrouching(playerid) == 1) return SendClientMessage(playerid, -1, "nesesitas estar agachado para usar este comando");
new f = MAX_OBJ+1;
for(new a = 0; a < sizeof(PosObjeto); a++)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, PosObjeto[a][0], PosObjeto[a][1], PosObjeto[a][2]))
{
f = a;
break;
}
}
if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "No estбs cerca de ningъn arma.");
else
{
new NombreArma[25];
new string[150];

PosObjeto[f][0] = 0.0;
PosObjeto[f][1] = 0.0;
PosObjeto[f][2] = 0.0;

DestroyObject(Objeto[f]);
//GivePlayerWeapon(playerid, IDObjeto[f][0], IDObjeto[f][1]);
DarArma(playerid, IDObjeto[f][0]);
GetWeaponNameEx(IDObjeto[f][0], NombreArma, sizeof(NombreArma));
format(string, sizeof(string), "* %s recoge %s del suelo.", NombreJugador(playerid), NombreArma);
ProxDetector(30.0, playerid, string, COLOR_ROL,COLOR_ROL,COLOR_ROL,COLOR_ROL,COLOR_ROL) ;
}
return 1;
}

PlayerCrouching(playerid)
{
    new anim_lib[32];
    new anim_name[32];
    GetAnimationName(GetPlayerAnimationIndex(playerid), anim_lib, 32, anim_name, 32);
    if(strcmp(anim_lib, "PED") == 0 && strcmp(anim_name, "WEAPON_CROUCH") == 0) return 1;
    return 0;
}
Quote:
Originally Posted by Kaskade
Посмотреть сообщение
Si jeje
Gracias
Reply
#5

Quote:
Originally Posted by Pluslegendary
Посмотреть сообщение
ya con el PlayerCrouching puedo usarlo en otros comandos?
Si, para detectar otras animaciones, colocas esto en OnPlayerUpdate:

Код:
    if(GetPlayerAnimationIndex(playerid))
    {
        new animlib[32];
        new animname[32];
        new msg[128];
        GetAnimationName(GetPlayerAnimationIndex(playerid),animlib,32,animname,32);
        format(msg, 128, "Running anim: %s %s", animlib, animname);
        SendClientMessage(playerid, 0xFFFFFFFF, msg);
    }
luego entras al servidor y haces la animaciуn que quieres detectar, por ejemplo, para detectar cuando corres te saldrнa algo asн "Running anim: PED RUN_CIVI", copias la funciуn que te di y cambias WEAPON_CROUCH por RUN_CIVI, algo asн

Код:
PlayerRun(playerid)
{
    new anim_lib[32];
    new anim_name[32];
    GetAnimationName(GetPlayerAnimationIndex(playerid), anim_lib, 32, anim_name, 32);
    if(strcmp(anim_lib, "PED") == 0 && strcmp(anim_name, "RUN_CIVI") == 0) return 1;
    return 0;
}
Uso:

Код:
public OnPlayerUpdate(playerid)
{
    if(GetPlayerInterior(playerid) == 12 && PlayerRun(playerid) == 1)
    {
        ClearAnimations(playerid);
        SendClientMessage(playerid, -1, "No corras en una casa.");
    }
    return 1;
}

PlayerRun(playerid)
{
    new anim_lib[32];
    new anim_name[32];
    GetAnimationName(GetPlayerAnimationIndex(playerid), anim_lib, 32, anim_name, 32);
    if(strcmp(anim_lib, "PED") == 0 && strcmp(anim_name, "RUN_CIVI") == 0) return 1;
    return 0;
}
Reply
#6

otra opciуn:

PHP код:
if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) return SendClientMessage(playeridCOLOR_GREY"Usted debe estar agachado para poder recoger el arma del piso."); 
agregas esto en tu comando.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)