SHARE
TWEET

hide_skin_selection.inc

-DeimoS- Mar 20th, 2017 (edited) 193 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. enum
  2. {
  3.     hcs__PLAYER_REQUEST_CLASS,
  4.     hcs__PLAYER_SPAWN,
  5.     hcs__PLAYER_DEATH,
  6. }
  7.  
  8. static
  9.     bool:hcs__buttom_status[MAX_PLAYERS char] = { true, true, ...},
  10.     hcs__player_status[MAX_PLAYERS char];
  11.  
  12. /*
  13. ================================================================================
  14.     ========================================================================
  15. ================================================================================
  16. */
  17.  
  18. stock ToggleSkinSelectionButtons(playerid, bool:toggle)
  19. {
  20.     switch(GetPlayerState(playerid))
  21.     {
  22.         case PLAYER_STATE_NONE, PLAYER_STATE_WASTED, PLAYER_STATE_SPECTATING:
  23.         {
  24.             if(toggle == true)
  25.             {
  26.                 ForceClassSelection(playerid);
  27.                 TogglePlayerSpectating(playerid, true);
  28.                 TogglePlayerSpectating(playerid, false);
  29.             }
  30.             else
  31.                 TogglePlayerSpectating(playerid, true);
  32.         }
  33.     }
  34.     hcs__buttom_status{playerid} = toggle;
  35.     return 1;
  36. }
  37.  
  38. /*
  39. ================================================================================
  40.     ========================================================================
  41. ================================================================================
  42. */
  43.  
  44. stock hidesclass_SpawnPlayer(playerid)
  45. {
  46.     if(hcs__buttom_status{playerid} == false && hcs__player_status{playerid} != hcs__PLAYER_SPAWN)
  47.     {
  48.         switch(GetPlayerState(playerid))
  49.         {
  50.             case PLAYER_STATE_WASTED, PLAYER_STATE_SPECTATING:
  51.             {
  52.                 if(!IsPlayerConnected(playerid))// Для сохранения логики работы функции SpawnPlayer
  53.                     return 0;
  54.                 hcs__player_status{playerid} = hcs__PLAYER_SPAWN;
  55.                 TogglePlayerSpectating(playerid, false);
  56.                 return 1;
  57.             }
  58.         }
  59.     }
  60.     return SpawnPlayer(playerid);
  61. }
  62. #if defined _ALS_SpawnPlayer
  63.     #undef SpawnPlayer
  64. #else
  65.     #define _ALS_SpawnPlayer
  66. #endif
  67. #define SpawnPlayer hidesclass_SpawnPlayer
  68.  
  69. /*
  70. ================================================================================
  71.     ========================================================================
  72. ================================================================================
  73. */
  74.  
  75. public OnPlayerDeath(playerid, killerid, reason)
  76. {
  77.     hcs__player_status{playerid} = hcs__PLAYER_DEATH;
  78.     #if defined hideclass_OnPlayerDeath
  79.         return hideclass_OnPlayerDeath(playerid, killerid, reason);
  80.     #else
  81.         return 1;
  82.     #endif
  83. }
  84. #if defined _ALS_OnPlayerDeath
  85.     #undef OnPlayerDeath
  86. #else
  87.     #define _ALS_OnPlayerDeath
  88. #endif
  89.  
  90. #define OnPlayerDeath hideclass_OnPlayerDeath
  91. #if defined hideclass_OnPlayerDeath
  92.     forward hideclass_OnPlayerDeath(playerid, killerid, reason);
  93. #endif
  94.  
  95. /*
  96. ================================================================================
  97.     ========================================================================
  98. ================================================================================
  99. */
  100.  
  101. public OnPlayerRequestClass(playerid, classid)
  102. {
  103.     switch(hcs__player_status{playerid})
  104.     {
  105.         case hcs__PLAYER_SPAWN:
  106.         {
  107.             SetSpawnInfo(playerid, 1, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
  108.             SpawnPlayer(playerid);
  109.             return 1;
  110.         }
  111.         case hcs__PLAYER_DEATH:
  112.         {
  113.             if(hcs__buttom_status{playerid} == false)
  114.             {
  115.                 SetSpawnInfo(playerid, 1, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
  116.                 TogglePlayerSpectating(playerid, true);
  117.                 SetTimerEx("@_DisablePlayerSpectatingRClass", 500, 0, "i", playerid);
  118.                 return 1;
  119.             }
  120.         }
  121.     }
  122.  
  123.     #if defined hidesclass_OnPlayerRequestClass
  124.         return hidesclass_OnPlayerRequestClass(playerid, classid);
  125.     #else
  126.         return 1;
  127.     #endif
  128. }
  129. #if defined _ALS_OnPlayerRequestClass
  130.     #undef OnPlayerRequestClass
  131. #else
  132.     #define _ALS_OnPlayerRequestClass
  133. #endif
  134.  
  135. #define OnPlayerRequestClass hidesclass_OnPlayerRequestClass
  136. #if defined hidesclass_OnPlayerRequestClass
  137.     forward hidesclass_OnPlayerRequestClass(playerid, classid);
  138. #endif
  139.  
  140. /*
  141. ================================================================================
  142.     ========================================================================
  143. ================================================================================
  144. */
  145.  
  146. public OnPlayerConnect(playerid)
  147. {
  148.     new reason_result = 1;
  149.  
  150.     hcs__buttom_status{playerid} = false;
  151.  
  152.     #if defined hideclass_OnPlayerConnect
  153.         reason_result = hideclass_OnPlayerConnect(playerid);
  154.     #endif
  155.  
  156.     hcs__player_status{playerid} = hcs__PLAYER_REQUEST_CLASS;
  157.  
  158.     return reason_result;
  159. }
  160. #if defined _ALS_OnPlayerConnect
  161.     #undef OnPlayerConnect
  162. #else
  163.     #define _ALS_OnPlayerConnect
  164. #endif
  165.  
  166. #define OnPlayerConnect hideclass_OnPlayerConnect
  167. #if defined hideclass_OnPlayerConnect
  168.     forward hideclass_OnPlayerConnect(playerid);
  169. #endif
  170.  
  171. /*
  172. ================================================================================
  173.     ========================================================================
  174. ================================================================================
  175. */
  176.  
  177. public OnPlayerRequestSpawn(playerid)
  178. {
  179.     #if defined hodesclass_OnPlayerRequestSpawn
  180.         return hodesclass_OnPlayerRequestSpawn(playerid);
  181.     #else
  182.         return 1;
  183.     #endif
  184. }
  185. #if defined _ALS_OnPlayerRequestSpawn
  186.     #undef OnPlayerRequestSpawn
  187. #else
  188.     #define _ALS_OnPlayerRequestSpawn
  189. #endif
  190.  
  191. #define OnPlayerRequestSpawn hodesclass_OnPlayerRequestSpawn
  192. #if defined hodesclass_OnPlayerRequestSpawn
  193.     forward hodesclass_OnPlayerRequestSpawn(playerid);
  194. #endif
  195.  
  196. /*
  197. ================================================================================
  198.     ========================================================================
  199. ================================================================================
  200. */
  201.  
  202. forward SetPlayerCameraPosForReqClass(playerid);
  203. public SetPlayerCameraPosForReqClass(playerid)
  204. {
  205.     SetPlayerCameraPos(playerid, 2026.7704, 1343.6394, 10.8203);
  206.     SetPlayerCameraLookAt(playerid, 2027.7704, 1343.6394, 10.8203);
  207. }
  208.  
  209. /*
  210. ================================================================================
  211.     ========================================================================
  212. ================================================================================
  213. */
  214.  
  215. @_DisablePlayerSpectatingRClass(playerid);
  216. @_DisablePlayerSpectatingRClass(playerid)
  217.     return TogglePlayerSpectating(playerid, false);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top