Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.97 KB | None | 0 0
  1. gm pradzioj
  2.  
  3. new Spectate[MAX_PLAYERS];
  4.  
  5. /pzu komandoj kai baigia spectate
  6.  
  7. Spectate[playerid]= 255;
  8.  
  9. kai pradeda spectatint
  10.  
  11. Spectate[playerid] = id;
  12.  
  13. public clear
  14.  
  15. Spectate[playerid] = 255;
  16.  
  17.  
  18. OnPlayerDisconnect
  19.  
  20.     for(new i=0;i<MAX_PLAYERS;i++)
  21.     {
  22.         if(Spectate[i] == playerid)
  23.         {
  24.             SpawnPlayer(i);
  25.             Spectate[i] = 255;
  26.             TogglePlayerControllable(i, 1);
  27.             TogglePlayerSpectating(i,false);
  28.             for(new slot=0; slot<12; slot++) GivePlayerWeapon(i,playerDB[i][spdata][slot],playerDB[i][spdata][12+slot]);
  29.             SetPlayerSkin(i,playerDB[playerid][spdata][24]);
  30.             SetPlayerPos(i,playerDB[i][spos][0],playerDB[i][spos][1],playerDB[i][spos][2]);
  31.             SetPlayerWantedLevel(i,playerDB[i][spdata][25]);
  32.             SetPlayerInterior(i,playerDB[i][spdata][26]);
  33.             SetPlayerVirtualWorld(i,playerDB[i][spdata][27]);
  34.             SendClientMessage(i, 0xff9900ff, "• {ff6600}Žaidėjas kurį stebėjote atsijungė!");
  35.         }
  36.     }
  37.  
  38. public OnPlayerStateChange
  39.  
  40.         if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
  41.         {
  42.             for(new i = 0; i < MAX_PLAYERS; i++)
  43.             {
  44.                 if(Spectate[i] == playerid)
  45.                 {
  46.                     if(IsPlayerInAnyVehicle(playerid))
  47.                     {
  48.                         new carid = GetPlayerVehicleID(playerid);
  49.                         PlayerSpectateVehicle(i, carid);
  50.                     }
  51.                     else PlayerSpectatePlayer(i, playerid);
  52.                 }
  53.             }
  54.         }
  55.         for(new i = 0; i < MAX_PLAYERS; i++)
  56.         {
  57.             if(Spectate[i] == playerid)
  58.             {
  59.                 TogglePlayerSpectating(i, 1);
  60.                 if(IsPlayerInAnyVehicle(playerid))
  61.                 {
  62.                     new carid = GetPlayerVehicleID(playerid);
  63.                     PlayerSpectateVehicle(i, carid);
  64.                 }
  65.                 else
  66.                 {
  67.                     PlayerSpectatePlayer(i, playerid);
  68.                 }
  69.             }
  70.         }
  71.         if(newstate == PLAYER_STATE_DRIVER)
  72.         {
  73.             for(new i = 0; i < MAX_PLAYERS; i++)
  74.             {
  75.                 if(Spectate[i] == playerid)
  76.                 {
  77.                     TogglePlayerSpectating(i, 1);
  78.                     if(IsPlayerInAnyVehicle(playerid)) PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
  79.                     else PlayerSpectatePlayer(i, playerid);
  80.                 }
  81.             }
  82.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement