Advertisement
Guest User

onplayerdisconnect

a guest
Jan 16th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.55 KB | None | 0 0
  1. public OnPlayerDisconnect(playerid, reason)
  2. {
  3.     new str[128];
  4.     gActivePlayers[playerid]--;
  5.     numplayers--;
  6.     OnPlayerUpdateEx(playerid);
  7.  
  8.  
  9.  
  10.     }
  11.  
  12.     TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date);
  13.     RemoveRoadblock(playerid);
  14.    
  15.     if ( IsBEJoined [ playerid ] )
  16.     {
  17.         IsBEJoined [ playerid ] = false;
  18.         BigEventPlayers -= 1;
  19.         if ( !BigEventPlayers && BigEventStarted ) BigEventForceStop ( -2 );
  20.     }
  21.  
  22.     TransferOffer[playerid] = INVALID_PLAYER_ID;
  23.     PlayerRacing[playerid] = 0;         InHuntGame[playerid] = 0;
  24.     PlayerInfo[playerid][pAdjustable] = 1; WantedStatics[playerid] = false;
  25.     PlayerInfo[playerid][pInGG] = 0;    PlayerInfo[playerid][pInMDM] = 0;
  26.     PlayerPaintballing[playerid] = 0;   PlayerPaintballScore[playerid] = 0;
  27.     PlayerInfo[playerid][pInTec9] = 0;  PlayerInDmKills[playerid] = 0;
  28.     PlayerInTec9Kills[playerid] = 0;    Event7[playerid] = 0;
  29.  
  30.     if(playerid == HuntedPlayer)
  31.     {
  32.         SendClientMessageToAll(0x0DABFAA9,"{FFFFFF}==================={0DABFA} Hunting Event{FFFFFF} ======================");
  33.         format(str, sizeof(str), "{FFFFFF}[{0DABFA}Hunting Event{FFFFFF}]{00B366} %s{FFFFFF} a iesit de pe server!", PlayerName(playerid));
  34.         SendClientMessageToAll(0x0DABFAA9,str);
  35.         format(str, sizeof(str), "{FFFFFF}[{0DABFA}Hunting Event{FFFFFF}] Un nou event va incepe in{009999} 10-15 minute!");
  36.         SendClientMessageToAll(0x0DABFAA9,str);
  37.         SendClientMessageToAll(0x0DABFAA9,"{0DABFA}==================={0DABFA} Hunting Event{FFFFFF} ======================");
  38.         IsHunted[playerid] = 0;
  39.         HuntedPlayer = INVALID_PLAYER_ID;
  40.  
  41.         StartHunt = SetTimer("StartNewHuntGame", 720000, 0);
  42.         KillTimer(EndHunt);
  43.  
  44.         foreach(Player, i)
  45.         {
  46.             InHuntGame[i] = 0;
  47.         }
  48.     }
  49.     if(JoinedGunGame[playerid] > 0)
  50.     {
  51.         if(JoinedGunGame[playerid] ==  2)
  52.         {
  53.             if(Echipa2 > 0)
  54.             {
  55.                 Echipa2 -= 1;
  56.             }
  57.         }
  58.         else if(JoinedGunGame[playerid] ==  1)
  59.         {
  60.             if(Echipa1 > 0)
  61.             {
  62.                 Echipa1 -= 1;
  63.             }
  64.         }
  65.     }
  66.     if(playerid == CashboxOwner)
  67.     {
  68.         new pName[MAX_PLAYER_NAME];
  69.         GetPlayerPos(playerid, CashboxX, CashboxY, CashboxZ);
  70.         GetPlayerName(playerid, pName, sizeof(pName));
  71.         SendClientMessageToAll(0xFFD700FF, "================[Servieta]==============");
  72.         format(str, 128, "» {FFFF00}%s (ID: %d) {FFD700}a iesit de pe server si a scapat servieta!", pName, playerid);
  73.         SendClientMessageToAll(0xFFD700FF, str);
  74.         SendClientMessageToAll(0xFFD700FF, "»  {FFD700}Poti afla locatia servietei tastand {00A9E7}/servieta");
  75.         SendClientMessageToAll(0xFFD700FF, "================[Servieta]==============");
  76.         CashboxPickup = CreatePickup(1210, 3, CashboxX, CashboxY, CashboxZ);
  77.         CashboxOwner = INVALID_PLAYER_ID;
  78.     }
  79.     foreach(Player, i)
  80.     {
  81.         if(TaxiAccepted[i] < 999)
  82.         {
  83.             if(TaxiAccepted[i] == playerid)
  84.             {
  85.                 TaxiAccepted[i] = 999;
  86.                 //GameTextForPlayer(i, "~w~Taxi Caller~n~~r~Left the game", 5000, 1);
  87.                 SendClientMessage(i, COLOR_LIGHTRED, "» Taxi Caller has left the game .");
  88.                 TaxiCallTime[i] = 0;
  89.                 DisablePlayerCheckpoint(i);
  90.             }
  91.         }
  92.         if(PlayerToFind[i] < 999 && FindTime[i] > 0)
  93.         {
  94.             if(PlayerToFind[i] == playerid)
  95.             {
  96.                 PlayerToFind[i] = 999;
  97.                 //GameTextForPlayer(i, "~w~Tinta~n~~r~A iesit din joc", 5000, 1);
  98.                 SendClientMessage(i, COLOR_LIGHTRED, "» Tinta a parasit jocul !");
  99.                 FindTime[i] = 0;
  100.                 DisablePlayerCheckpoint(i);
  101.             }
  102.         }
  103.     }
  104.     if(WantedLevel[playerid] >= 1)
  105.     {
  106.         new string[128];
  107.         new wanted = WantedLevel[playerid];
  108.         new sendername[MAX_PLAYER_NAME];
  109.         GetPlayerName(playerid, sendername, sizeof(sendername));
  110.         if(wanted > 0)
  111.         {
  112.             switch(reason)
  113.             {
  114.                 case 0:
  115.                 {
  116.                     format(string,128, "%s has exit the game and he had %d wanted level. ( Crash )",sendername,wanted);
  117.                 }
  118.                 case 1:
  119.                 {
  120.                     format(string,128, "%s has exit the game and he had %d wanted level. ( Quit )",sendername,wanted);
  121.                 }
  122.             }
  123.             SendTeamMessage(2, 0x00ACB2AA, string);
  124.         }
  125.     }
  126.     if(PlayerTied[playerid])
  127.     {
  128.         new string[128];
  129.         new name[MAX_PLAYER_NAME];
  130.         GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  131.         switch(reason)
  132.         {
  133.             case 0: format(string,128, "Player %s who was tied, has left the server. (Crash)",name);
  134.             case 1: format(string,128, "Player %s who was tied, has left the server. (Quit)",name);
  135.             case 2: format(string,128, "Player %s who was tied, has left the server. (Kicked/Banned)",name);
  136.         }
  137.         SendClientMessage(TiedBy[playerid], COLOR_LIGHTRED, string);
  138.     }
  139.     if(GettingCK[playerid] < 999)
  140.     {
  141.         if(IsPlayerConnected(GettingCK[playerid]))
  142.         {
  143.             SendClientMessage(GettingCK[playerid], COLOR_YELLOW, "Your Character Kill has left the server, try again later.");
  144.             OnCK[GettingCK[playerid]] = 999;
  145.         }
  146.     }
  147.     if(TransportDriver[playerid] < 999)
  148.     {
  149.         if(IsPlayerConnected(TransportDriver[playerid]))
  150.         {
  151.             GameTextForPlayer(TransportDriver[playerid], "~w~The client left", 5000, 1);
  152.             new moneys = 0;
  153.             foreach ( Player, i )
  154.             {
  155.                 if ( TransportDriver [ i ] == TransportDriver [ playerid ] && i != playerid )
  156.                 {
  157.                     if ( IsPlayerInVehicle ( i, GetPlayerVehicleID ( TransportDriver [ playerid ] ) ) )
  158.                     {
  159.                         moneys = 1;
  160.                         break;
  161.                     }
  162.                 }
  163.             }
  164.             if ( !moneys ) TransportTaxi[TransportDriver[playerid]] = 0;
  165.             TransportDriver[playerid] = 999;
  166.         }
  167.     }
  168.     if( TransportTaxi[playerid] )
  169.     {
  170.         TransportTaxi[playerid] = 0;
  171.         foreach ( Player, i )
  172.         {
  173.             if ( TransportDriver [ i ] == playerid )
  174.             {
  175.                 TransportDriver[i] = 999;
  176.                 GameTextForPlayer(i, "~w~Passenger left", 5000, 1);
  177.             }
  178.         }
  179.     }
  180.     if(GotHit[playerid] > 0)
  181.     {
  182.         if(GetChased[playerid] < 999)
  183.         {
  184.             if(IsPlayerConnected(GetChased[playerid]))
  185.             {
  186.                 SendClientMessage(GetChased[playerid], COLOR_YELLOW, "Your Hit has left the server.");
  187.                 GoChase[GetChased[playerid]] = 999;
  188.             }
  189.         }
  190.     }
  191.     if(PlayerPaintballing[playerid] != 0)
  192.     {
  193.         PaintballPlayers --;
  194.     }
  195.     if(PlayerKarting[playerid] > 0 && PlayerInKart[playerid] > 0)
  196.     {
  197.         KartingPlayers --;
  198.     }
  199.     if(PlayersChannel[playerid] < 999)
  200.     {
  201.         IRCInfo[PlayersChannel[playerid]][iPlayers] -= 1;
  202.     }
  203.     if(HireCar[playerid] != 299)
  204.     {
  205.         gCarLock[HireCar[playerid]] = 0;
  206.     }
  207.     if (gLastCar[playerid] > 0)
  208.     {
  209.         gLastDriver[gLastCar[playerid]] = 300;
  210.         if(PlayerInfo[playerid][pPhousekey] != gLastCar[playerid]-1)
  211.         {
  212.             gCarLock[gLastCar[playerid]] = 0;
  213.         }
  214.     }
  215.     if(PlayerBoxing[playerid] > 0)
  216.     {
  217.         if(Boxer1 == playerid)
  218.         {
  219.             if(IsPlayerConnected(Boxer2))
  220.             {
  221.                 PlayerBoxing[Boxer2] = 0;
  222.                 SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
  223.                 SetPlayerInterior(Boxer2, 5);
  224.                 GameTextForPlayer(Boxer2, "~r~Match interupted", 5000, 1);
  225.             }
  226.         }
  227.         else if(Boxer2 == playerid)
  228.         {
  229.             if(IsPlayerConnected(Boxer1))
  230.             {
  231.                 PlayerBoxing[Boxer1] = 0;
  232.                 SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
  233.                 SetPlayerInterior(Boxer1, 5);
  234.                 GameTextForPlayer(Boxer1, "~r~Match interupted", 5000, 1);
  235.             }
  236.         }
  237.         InRing = 0;
  238.         RoundStarted = 0;
  239.         Boxer1 = 255;
  240.         Boxer2 = 255;
  241.         TBoxer = 255;
  242.     }
  243.     if(TransportDuty[playerid] == 1)
  244.     {
  245.         TaxiDrivers -= 1;
  246.         TransportDuty[playerid] = 0;
  247.     }
  248.     if(PlayerInfo[playerid][pJob] == 11)
  249.     {
  250.         if(JobDuty[playerid] == 1) { Medics -= 1; }
  251.     }
  252.     else if(PlayerInfo[playerid][pJob] == 7)
  253.     {
  254.         if(JobDuty[playerid] == 1) { Mechanics -= 1; }
  255.     }
  256.     return 1;
  257. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement