ZiGGi

Untitled

Mar 3rd, 2016
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.65 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define IsPlayerAuthorized(%0)                player_is_authorized{%0}
  4. #define SetPlayerAuthorized(%0,%1)            player_is_authorized{%0} = %1
  5. #define PLAYER_OFFLINE                        0
  6. #define PLAYER_ONLINE                         1
  7.  
  8. new player_is_authorized[MAX_PLAYERS char];
  9.  
  10. main()
  11. {}
  12.  
  13. /*
  14.  * FIXES_SpawnPlayer(playerid)
  15.  *
  16.  * FIXES:
  17.  *     SpawnPlayer
  18.  */
  19.  
  20. stock FIXES_SpawnPlayer(playerid)
  21. {
  22.     // Valid "playerid" check inside "GetPlayerVehicleID".
  23.     new
  24.         vid = GetPlayerVehicleID(playerid);
  25.     if (vid)
  26.     {
  27.         new
  28.             Float:x,
  29.             Float:y,
  30.             Float:z;
  31.         // Remove them without the animation.
  32.         GetVehiclePos(vid, x, y, z),
  33.         SetPlayerPos(playerid, x, y, z);
  34.     }
  35.     return SpawnPlayer(playerid);
  36. }
  37. #if defined _ALS_SpawnPlayer
  38.     #undef SpawnPlayer
  39. #else
  40.     #define _ALS_SpawnPlayer
  41. #endif
  42.  
  43. #define SpawnPlayer FIXES_SpawnPlayer
  44.  
  45.  
  46.  
  47. public OnPlayerConnect(playerid)
  48. {
  49.     SetPlayerAuthorized(playerid, PLAYER_OFFLINE);
  50.     return 1;
  51. }
  52.  
  53. public OnPlayerCommandText(playerid, cmdtext[])
  54. {
  55.     if (strcmp("/v", cmdtext, true, 10) == 0)
  56.     {
  57.         new
  58.             Float:x,
  59.             Float:y,
  60.             Float:z;
  61.  
  62.         GetPlayerPos(playerid, x, y, z);
  63.         new vehicleid = CreateVehicle(411, x, y, z, 0, -1, -1, 0);
  64.         PutPlayerInVehicle(playerid, vehicleid, 0);
  65.         return 1;
  66.     }
  67.     if (strcmp("/kill", cmdtext, true, 10) == 0)
  68.     {
  69.         SetPlayerHealth(playerid, 0.0 );
  70.         return 1;
  71.     }
  72.    
  73.     if (strcmp("/login", cmdtext, true, 10) == 0)
  74.     {
  75.         SetPlayerAuthorized(playerid, PLAYER_ONLINE);
  76.         TogglePlayerSpectating(playerid, 0);
  77.         return 1;
  78.     }
  79.    
  80.     if (strcmp("/spawn", cmdtext, true, 10) == 0)
  81.     {
  82.         SpawnPlayer(playerid);
  83.         return 1;
  84.     }
  85.  
  86.     SendClientMessage(playerid,0xFFFFFFFF, "Неверная команда.");
  87.     return 1;
  88. }
  89.  
  90. public OnPlayerRequestSpawn(playerid)
  91. {
  92.     if (IsPlayerAuthorized(playerid)) {
  93.         return 1;
  94.     }
  95.     return 0;
  96. }
  97.  
  98. public OnPlayerRequestClass(playerid, classid)
  99. {
  100.     new
  101.         Float:x,
  102.         Float:y,
  103.         Float:z;
  104.  
  105.     GetPlayerPos(playerid, x, y, z);
  106.    
  107.     RemoveBuildingForPlayer(playerid, 1484, x, y, z, 10.0);
  108.     RemoveBuildingForPlayer(playerid, 1485, x, y, z, 10.0);
  109.     RemoveBuildingForPlayer(playerid, 1486, x, y, z, 10.0);
  110.  
  111.     SetSpawnInfo(playerid, 0, 124, 2499.8, -2129.6001, 23.5, 92.0, 10, 1, 38, 999999, 34, 999999);
  112.  
  113.     if (IsPlayerAuthorized(playerid)) {
  114.         SpawnPlayer(playerid);
  115.     } else {
  116.         TogglePlayerSpectating(playerid, 1);
  117.         SetTimerEx("SetClassCameraPos", 200, 0, "i", playerid);
  118.     }
  119.  
  120.     return 1;
  121. }
  122.  
  123. forward SetClassCameraPos(playerid);
  124. public SetClassCameraPos(playerid)
  125. {
  126.     SetPlayerCameraPos(playerid, 1879.984252, -2908.610107, 1.996365);
  127.     SetPlayerCameraLookAt(playerid, 1879.666870, -2913.487304, 0.941269);
  128. }
Advertisement
Add Comment
Please, Sign In to add comment