SA-MP Forums Archive
[DUDA] sobre OnPlayerKeyStateChange - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: [DUDA] sobre OnPlayerKeyStateChange (/showthread.php?tid=273506)



[DUDA] sobre OnPlayerKeyStateChange - Braz_y - 02.08.2011

Hola estoy creando un comando de animaciуn /sentarse pero para pararse hay que poner /pararse y no me gusta por eso estoy asiendo un key para cuando uno ponga /sentarse y despues aprete key fire y separe sin que poner pararse.

ejemplo no funciona como quiero yo

pawn Код:
if (strcmp("/sentarse", cmdtext, true) == 0) {
ApplyAnimation(playerid, "SUNBATHE", "ParkSit_M_in", 4.000000, 0, 1, 1, 1, 0);
return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
    {
       if (ApplyAnimation(playerid, "SUNBATHE", "ParkSit_M_in", 4.000000, 0, 1, 1, 1, 0);))
        {
            ApplyAnimation(playerid, "ped", "SEAT_up", 4.000000, 0, 1, 1, 1, 0);
        }
   
    }
    return 1;
}



Respuesta: [DUDA] sobre OnPlayerKeyStateChange - [J]ulian - 02.08.2011

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
    {
        if(GetPlayerAnimationIndex(playerid))
        {
            new libreria[32], nombre[32];
            GetAnimationName(GetPlayerAnimationIndex(playerid), libreria, 32, nombre, 32);
            if(!strcmp(libreria, "SUNBATHE", true) && !strcmp(nombre, "ParkSit_M_in", true))
            {
                ApplyAnimation(playerid, "ped", "SEAT_up", 4.000000, 0, 1, 1, 1, 0);
            }
        }
    }
    return 1;
}
Probб asн.


Respuesta: [DUDA] sobre OnPlayerKeyStateChange - Braz_y - 02.08.2011

julian gracias era lo que queria, pero tambien quiero poner otras ejemplo poner SPECIAL_ACTION_USECELLPHONE pero no me funciona


Respuesta: [DUDA] sobre OnPlayerKeyStateChange - [J]ulian - 02.08.2011

Esa no es una animaciуn, por lo tanto tendrнas que usar:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
    {
        if(GetPlayerAnimationIndex(playerid))
        {
            new libreria[32], nombre[32];
            GetAnimationName(GetPlayerAnimationIndex(playerid), libreria, 32, nombre, 32);
            if(!strcmp(libreria, "SUNBATHE", true) && !strcmp(nombre, "ParkSit_M_in", true))
            {
                ApplyAnimation(playerid, "ped", "SEAT_up", 4.000000, 0, 1, 1, 1, 0);
            }
            if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE)
            {
                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_STOPUSECELLPHONE);
            }
        }
    }
    return 1;
}
Son acciones especiales esas.


Respuesta: [DUDA] sobre OnPlayerKeyStateChange - D3IMON - 02.08.2011

Me ganaste [J]ulian,solo tienes que buscar amigo todo esta en wiki https://sampwiki.blast.hk/wiki/GetPlayerSpecialAction


Respuesta: [DUDA] sobre OnPlayerKeyStateChange - [J]ulian - 02.08.2011

Quote:
Originally Posted by D3IMON
Посмотреть сообщение
Me ganaste [J]ulian,solo tienes que buscar amigo todo esta en wiki https://sampwiki.blast.hk/wiki/GetPlayerSpecialAction
xD, no se trata de quien lo postea antes. Si no mientras que le sirva al pibe que lo postee cualquiera xD


Respuesta: [DUDA] sobre OnPlayerKeyStateChange - D3IMON - 02.08.2011

[J]ulian es una broma yo lo iva a postiar y antes refresque el navegador y vi tu post y me paresio gracioso por que era lo mismo,hay que tener un poco de humor


Respuesta: [DUDA] sobre OnPlayerKeyStateChange - Braz_y - 02.08.2011

Gracias julian,d3imon gracias por la pagina la estaba buscando.


Respuesta: [DUDA] sobre OnPlayerKeyStateChange - [J]ulian - 02.08.2011

De nada, cualquier cosa postea y te ayudamos.


Respuesta: [DUDA] sobre OnPlayerKeyStateChange - Braz_y - 02.08.2011

otra duda sobre lo mismo, como no permitir que una persona active un comando cuando ya ha activado un comando ejemplo me refiero es que cuando un jugador ponga /fumar y no aya apretado enter ponga /orinar le )(salga debes terminar de fumar para usar este comando).