Advertisement
Jujuv

[SA:MP | POC] jAnim

Aug 19th, 2012
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.13 KB | None | 0 0
  1. /*
  2. Mini-Script réalisé pour l'exercice 19/08/2012 sur le forum Sa:Mp.
  3. Mini-script réalisé par Jujuv.
  4. */
  5.  
  6. #include <a_samp>
  7. #define SPECIAL_ACTION_PISSING 68//Se référer au Wiki officiel e Sa:Mp
  8. #define ResetPlayerAnim(%0) SetPlayerSpecialAction(%0, SPECIAL_ACTION_NONE)//C'est plus pour montrer la puissance des macros qu'autre chose ^^'
  9.  
  10. enum//Enumeration des IDs de dialogues
  11. {
  12.         dAnim
  13. }
  14.  
  15. stock ApplyPlayerAnimation(playerid, animID)//Parceque la programmation modulaire, ça gére
  16. {
  17.     if(!IsPlayerConnected(playerid))
  18.         return 1;
  19.    
  20.     if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_NONE)
  21.         SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  22.        
  23.     SetPlayerSpecialAction(playerid, animID);
  24.    
  25.        
  26.     return 0;
  27. }
  28.  
  29. public OnPlayerCommandText(playerid, cmdtext[])
  30. {
  31.     if(!(strcmp("/anim", cmdtext, true) || strcmp("/animation", cmdtext, true)))//La commande
  32.     {  
  33.         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");
  34.         return 1;
  35.     }
  36.    
  37.     return 0;
  38. }
  39.  
  40. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  41. {
  42.     if(!response)//Permet de quitter le menu
  43.         return 0;
  44.    
  45.     switch(dialogid)
  46.     {
  47.             case dAnim:
  48.             {
  49.                 switch(listitem)
  50.                 {
  51.                     case 0:
  52.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DANCE1);
  53.                     case 1:
  54.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DANCE2);
  55.                     case 2:
  56.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DANCE3);
  57.                     case 3:
  58.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DANCE4);
  59.                     case 4:
  60.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_HANDSUP);
  61.                     case 5:
  62.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_USECELLPHONE);
  63.                     case 6:
  64.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_SITTING);
  65.                     case 7:
  66.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  67.                     case 8:
  68.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DRINK_BEER);
  69.                     case 9:
  70.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
  71.                     case 10:
  72.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DRINK_WINE);
  73.                     case 11:
  74.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
  75.                     case 12:
  76.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_PISSING);
  77.                     case 13:
  78.                         ApplyPlayerAnimation(playerid, SPECIAL_ACTION_CUFFED);
  79.                     default:
  80.                     {
  81.                         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);
  82.                     }
  83.                    
  84.                 }
  85.             }
  86.             default:
  87.             {
  88.                     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);
  89.             }
  90.     }
  91.     return 1;
  92. }
  93.  
  94. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  95. {
  96.         if(newkeys & KEY_ACTION)
  97.         {
  98.             ResetPlayerAnim(playerid);
  99.         }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement