Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new pCurrentAnimIndex[MAX_PLAYERS];
- new pPrevAnimIndex[MAX_PLAYERS];
- new bool:pEnterVUseCell[MAX_PLAYERS];
- public OnPlayerConnect(playerid)
- {
- pCurrentAnimIndex[playerid] = 0;
- pPrevAnimIndex[playerid] = 0;
- pEnterVUseCell[playerid] = false;
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- new playerstate = GetPlayerState(playerid);
- if (playerstate != PLAYER_STATE_NONE)
- {
- pPrevAnimIndex[playerid] = pCurrentAnimIndex[playerid];
- pCurrentAnimIndex[playerid] = GetPlayerAnimationIndex(playerid);
- if (GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE)
- {
- if (playerstate == PLAYER_STATE_ONFOOT)
- {
- if (pCurrentAnimIndex[playerid] != pPrevAnimIndex[playerid])
- {
- if (pPrevAnimIndex[playerid] == 1214) pEnterVUseCell[playerid] = true;
- 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)
- {
- if (pEnterVUseCell[playerid])
- {
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
- pEnterVUseCell[playerid] = false;
- }
- }
- }
- }
- }
- else if (pEnterVUseCell[playerid]) pEnterVUseCell[playerid] = false;
- }
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if (newstate == PLAYER_STATE_ONFOOT && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE) SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
- return 1;
- }
Add Comment
Please, Sign In to add comment