Guest User

Untitled

a guest
Jan 4th, 2019
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.09 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new pCurrentAnimIndex[MAX_PLAYERS];
  4. new pPrevAnimIndex[MAX_PLAYERS];
  5.  
  6. new bool:pEnterVUseCell[MAX_PLAYERS];
  7.  
  8. public OnPlayerConnect(playerid)
  9. {
  10.     pCurrentAnimIndex[playerid] = 0;
  11.     pPrevAnimIndex[playerid] = 0;
  12.  
  13.     pEnterVUseCell[playerid] = false;
  14.     return 1;
  15. }
  16.  
  17. public OnPlayerUpdate(playerid)
  18. {
  19.     new playerstate = GetPlayerState(playerid);
  20.     if (playerstate != PLAYER_STATE_NONE)
  21.     {
  22.         pPrevAnimIndex[playerid] = pCurrentAnimIndex[playerid];
  23.         pCurrentAnimIndex[playerid] = GetPlayerAnimationIndex(playerid);
  24.  
  25.         if (GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE)
  26.         {
  27.             if (playerstate == PLAYER_STATE_ONFOOT)
  28.             {
  29.                 if (pCurrentAnimIndex[playerid] != pPrevAnimIndex[playerid])
  30.                 {
  31.                     if (pPrevAnimIndex[playerid] == 1214) pEnterVUseCell[playerid] = true;
  32.                     else if ((pPrevAnimIndex[playerid] == 1224 || pPrevAnimIndex[playerid] == 1226 || pPrevAnimIndex[playerid] == 1227 || pPrevAnimIndex[playerid] == 1228 || pPrevAnimIndex[playerid] == 1230 || pPrevAnimIndex[playerid] == 1231 || pPrevAnimIndex[playerid] == 1276 || pPrevAnimIndex[playerid] == 1278 || pPrevAnimIndex[playerid] == 1280 || pPrevAnimIndex[playerid] == 1458) && pCurrentAnimIndex[playerid] != 1009 && pCurrentAnimIndex[playerid] != 1010 && pCurrentAnimIndex[playerid] != 1627)
  33.                     {
  34.                         if (pEnterVUseCell[playerid])
  35.                         {
  36.                             SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
  37.                             pEnterVUseCell[playerid] = false;
  38.                         }
  39.                     }
  40.                 }
  41.             }
  42.         }
  43.         else if (pEnterVUseCell[playerid]) pEnterVUseCell[playerid] = false;
  44.     }
  45.     return 1;
  46. }
  47.  
  48. public OnPlayerStateChange(playerid, newstate, oldstate)
  49. {
  50.     if (newstate == PLAYER_STATE_ONFOOT && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
  51.     return 1;
  52. }
Add Comment
Please, Sign In to add comment