Jujuv icon

[SA:MP | POC] jAnim

Jujuv | PRO | 08/19/12 04:22:52 PM UTC | 0 ⭐ | 287 👁️ | Never ⏰ | []
Pawn |

3.13 KB

|

None

|

0 👍

/

0 👎

/*
Mini-Script réalisé pour l'exercice 19/08/2012 sur le forum Sa:Mp.
Mini-script réalisé par Jujuv.
*/
 
#include <a_samp>
#define SPECIAL_ACTION_PISSING 68//Se référer au Wiki officiel e Sa:Mp
#define ResetPlayerAnim(%0) SetPlayerSpecialAction(%0, SPECIAL_ACTION_NONE)//C'est plus pour montrer la puissance des macros qu'autre chose ^^'
 
enum//Enumeration des IDs de dialogues
{
        dAnim
}
 
stock ApplyPlayerAnimation(playerid, animID)//Parceque la programmation modulaire, ça gére
{
    if(!IsPlayerConnected(playerid))
        return 1;
    
    if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_NONE)
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
        
    SetPlayerSpecialAction(playerid, animID);
    
        
    return 0;
}
 
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!(strcmp("/anim", cmdtext, true) || strcmp("/animation", cmdtext, true)))//La commande
    {   
        ShowPlayerDialog(playerid, dAnim, DIALOG_STYLE_LIST, "Choix de l'animation", "Dance 1\nDance 2\nDance 3\nDance 4\nMains en l'air\nUtilisation d'un telephone\nS'asseoir\nRaccrocher un telephone\nBoire une biére\nFumer un cigare\nBoire du vin\nBoire un soda\nUriner\nMennoté(e)", "Ok", "Annuler");
        return 1;
    }
    
    return 0;
}
 
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(!response)//Permet de quitter le menu
        return 0;
    
    switch(dialogid)
    {
            case dAnim:
            {
                switch(listitem)
                {
                    case 0:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DANCE1);
                    case 1:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DANCE2);
                    case 2:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DANCE3);
                    case 3:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DANCE4);
                    case 4:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_HANDSUP);
                    case 5:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_USECELLPHONE);
                    case 6:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_SITTING);
                    case 7:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
                    case 8:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DRINK_BEER);
                    case 9:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
                    case 10:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DRINK_WINE);
                    case 11:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
                    case 12:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_PISSING);
                    case 13:
                        ApplyPlayerAnimation(playerid, SPECIAL_ACTION_CUFFED);
                    default:
                    {
                        printf("[ERREUR] Type: Action innatendue - Importance: élevé - Detailles: La callback OnDialogResponse() a été appelé depuis le dialogue dAnim avec une valeur innatendue pour listitem - Valeur reçu: %i", listitem);
                    }
                    
                }
            }
            default:
            {
                    printf("[ERREUR] Type: Action innatendue - Importance: élevé - Detailles: La callback OnDialogResponse() a été appelé avec un ID de dialogue innatendue - Valeur reçu: %i", dialogid);
            }
    }
    return 1;
}
 
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if(newkeys & KEY_ACTION)
        {
            ResetPlayerAnim(playerid);
        }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎