Guest User

Untitled

a guest
Jan 15th, 2015
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 39.00 KB | None | 0 0
  1. public OnPlayerStateChange(playerid, newstate, oldstate)
  2. {
  3.     if(newstate != 2) NOPTrigger[playerid] = 0;
  4.     if(IsPlayerNPC(playerid))
  5.     {
  6.         if(newstate == PLAYER_STATE_SPECTATING)
  7.         {
  8.             TogglePlayerSpectating(playerid, false);
  9.         }
  10.         return 1;
  11.     }
  12.     if(GettingSpectated[playerid] != INVALID_PLAYER_ID)
  13.     {
  14.         new spectator = GettingSpectated[playerid];
  15.         if(!IsPlayerConnected(spectator))
  16.         {
  17.             GettingSpectated[playerid] = 999;
  18.             Spectate[spectator] = 999;
  19.         }
  20.  
  21.         if(newstate == PLAYER_STATE_DRIVER && PlayerInfo[spectator][pAdmin] >= 2 || newstate == PLAYER_STATE_PASSENGER && PlayerInfo[spectator][pAdmin] >= 2)
  22.         {
  23.             TogglePlayerSpectating(spectator, true);
  24.             new carid = GetPlayerVehicleID( playerid );
  25.             PlayerSpectateVehicle( spectator, carid );
  26.             SetPVarInt(spectator, "SpecState", newstate);
  27.         }
  28.         else if(newstate == PLAYER_STATE_ONFOOT && PlayerInfo[spectator][pAdmin] >= 2)
  29.         {
  30.             TogglePlayerSpectating(spectator, true);
  31.             PlayerSpectatePlayer( spectator, playerid );
  32.             SetPlayerInterior( spectator, GetPlayerInterior( playerid ) );
  33.             SetPVarInt(spectator, "SpecState", newstate);
  34.         }
  35.     }
  36.     if(newstate == PLAYER_STATE_ONFOOT)
  37.     {
  38.         if(Audio_IsClientConnected(playerid))
  39.         {
  40.             Audio_Stop(playerid, stationidp[playerid]);
  41.             stationidp[playerid] = 0;
  42.         }
  43.  
  44.  
  45.         new spectator = GettingSpectated[playerid];
  46.         if(PlayerInfo[spectator][pAdmin] >= 2) {
  47.             // Preventing possible buffer overflows with the arrays
  48.             TogglePlayerSpectating(spectator, true);
  49.             PlayerSpectatePlayer( spectator, playerid );
  50.             SetPlayerInterior( spectator, GetPlayerInterior( playerid ) );
  51.             SetPVarInt(spectator, "SpecState", newstate);
  52.             SetPlayerInterior( spectator, GetPlayerInterior( playerid ) );
  53.             SetPlayerVirtualWorld( spectator, GetPlayerVirtualWorld( playerid ) );
  54.         }
  55.  
  56.         if(oldstate == PLAYER_STATE_DRIVER)
  57.         {
  58.             SetPlayerWeaponsEx(playerid);
  59.         }
  60.         else if(oldstate == PLAYER_STATE_PASSENGER) SetPlayerWeaponsEx(playerid);
  61.  
  62.         if(ConnectedToPC[playerid] == 1337)//mdc
  63.         {
  64.             SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You are now logged off the MDC.");
  65.             ConnectedToPC[playerid] = 0;
  66.         }
  67.         if(TransportDuty[playerid] > 0)
  68.         {
  69.             if(TransportDuty[playerid] == 1)
  70.             {
  71.                 TaxiDrivers -= 1;
  72.             }
  73.             else if(TransportDuty[playerid] == 2)
  74.             {
  75.                 BusDrivers -= 1;
  76.             }
  77.             TransportDuty[playerid] = 0;
  78.             new string[42];
  79.             format(string, sizeof(string), "* You are now off duty and earned $%d.", TransportMoney[playerid]);
  80.             SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  81.             GivePlayerCash(playerid, TransportMoney[playerid]);
  82.             ConsumingMoney[playerid] = 1; TransportValue[playerid] = 0; TransportMoney[playerid] = 0;
  83.             SetPlayerColor(playerid, TEAM_HIT_COLOR);
  84.             TransportTime[playerid] = 0;
  85.             TransportCost[playerid] = 0;
  86.         }
  87.         if(TransportDriver[playerid] < 999)
  88.         {
  89.             new string[128];
  90.             TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
  91.             format(string, sizeof(string), "~w~The ride cost~n~~r~$%d",TransportCost[playerid]);
  92.             GameTextForPlayer(playerid, string, 5000, 3);
  93.             format(string, sizeof(string), "~w~Passenger left the taxi.~n~~g~Earned $%d",TransportCost[playerid]);
  94.             GameTextForPlayer(TransportDriver[playerid], string, 5000, 3);
  95.             GivePlayerCash(playerid, -TransportCost[playerid]);
  96.  
  97.             new ip[32], ipex[32];
  98.             GetPlayerIp(playerid, ip, sizeof(ip));
  99.             GetPlayerIp(TransportDriver[playerid], ipex, sizeof(ipex));
  100.             TaxiWarn[playerid][TransportDriver[playerid]] += TransportCost[playerid];
  101.             if(TaxiWarn[playerid][TransportDriver[playerid]] >= 10000)
  102.             {
  103.                 format(string, sizeof(string), "%s (IP:%s) has taxied %s (IP:%s) $%d in this session.", GetPlayerNameEx(playerid), ip, GetPlayerNameEx(TransportDriver[playerid]), ipex, TaxiWarn[playerid][TransportDriver[playerid]]);
  104.                 Log("logs/pay.log", string);
  105.                 ABroadCast(COLOR_YELLOW, string, 2);
  106.             }
  107.             TransportTime[TransportDriver[playerid]] = 0;
  108.             TransportCost[TransportDriver[playerid]] = 0;
  109.             TransportCost[playerid] = 0;
  110.             TransportTime[playerid] = 0;
  111.             TransportDriver[playerid] = 999;
  112.         }
  113.         TelePos[playerid][0] = 0.0;
  114.         TelePos[playerid][1] = 0.0;
  115.     }
  116.     if(newstate == PLAYER_STATE_PASSENGER) // TAXI & BUSSES
  117.     {
  118.         if(stationidv[GetPlayerVehicleID(playerid)] != 0)
  119.         {
  120.             new station[64];
  121.             switch(stationidv[GetPlayerVehicleID(playerid)])
  122.             {
  123.                 case 1: format(station, sizeof(station), "http://216.246.109.162:8000");
  124.                 case 2: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1415249");
  125.                 case 3: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1415249");
  126.                 case 4: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628721");
  127.                 case 5: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283687");
  128.                 case 6: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628932");
  129.                 case 7: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1756658");
  130.                 case 8: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200");
  131.                 case 9: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057197");
  132.                 case 10: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=18695");
  133.                 case 11: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
  134.                 case 12: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=181367");
  135.                 case 13: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1275071");
  136.                 case 14: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
  137.                 case 15: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356");
  138.                 case 16: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1279013");
  139.                 case 17: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1281016");
  140.                 case 18: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280855");
  141.                 case 19: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1116397");
  142.                 case 20: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057543");
  143.                 case 21: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=616366");
  144.                 case 22: format(station, sizeof(station), "http://38.107.220.164:8014");
  145.                 case 23: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=847066");
  146.             }
  147.             if(Audio_IsClientConnected(playerid))
  148.             {
  149.                 Audio_Stop(playerid, stationidp[playerid]);
  150.                 stationidp[playerid] = Audio_PlayStreamed(playerid, station, false, true, false);
  151.             }
  152.         }
  153.         new vehicleid = GetPlayerVehicleID(playerid);
  154.         if(vehicleid == NGVehicles[12] ||
  155.         vehicleid == NGVehicles[13] ||
  156.         vehicleid == NGVehicles[14] ||
  157.         vehicleid == NGVehicles[15] ||
  158.         vehicleid == NGVehicles[16] ||
  159.         vehicleid == NGVehicles[17])
  160.         {
  161.             TogglePlayerSpectating(playerid, 1);
  162.             PlayerSpectateVehicle(playerid, vehicleid);
  163.             SetPVarInt(playerid, "NGPassenger", 1);
  164.             SetPVarInt(playerid, "NGPassengerVeh", vehicleid);
  165.             SetPVarInt(playerid, "NGPassengerSkin", GetPlayerSkin(playerid));
  166.             new Float:health, Float:armour;
  167.             GetPlayerHealth(playerid, health);
  168.             GetPlayerArmour(playerid, armour);
  169.             SetPVarFloat(playerid, "NGPassengerHP", health);
  170.             SetPVarFloat(playerid, "NGPassengerArmor", armour);
  171.         }
  172.  
  173.         /*new gun,tmp;
  174.         GetPlayerWeaponData(playerid,4,gun,tmp);
  175.         #pragma unused tmp
  176.         if(gun)SetPlayerArmedWeapon(playerid,gun);
  177.         else SetPlayerArmedWeapon(playerid,0);*/
  178.         if(PlayerInfo[playerid][pGuns][4] > 0)  SetPlayerArmedWeapon(playerid,PlayerInfo[playerid][pGuns][4]);
  179.         else SetPlayerArmedWeapon(playerid,0);
  180.  
  181.         if( GetPVarInt( playerid, "ToBeEjected" ) >= 1 )
  182.         {
  183.             SetPVarInt( playerid, "ToBeEjected", 0 );
  184.             RemovePlayerFromVehicle( playerid );
  185.             new Float:X, Float:Y, Float:Z;
  186.             GetPlayerPos(playerid, X, Y, Z);
  187.             SetPlayerPos(playerid, X, Y, Z+2);
  188.  
  189.             if(GetPVarInt(playerid, "Injured") == 1)
  190.             {
  191.                 Streamer_UpdateEx(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
  192.                 SetPlayerPos(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
  193.                 SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"MedicVW"));
  194.                 SetPlayerInterior(playerid, GetPVarInt(playerid,"MedicInt"));
  195.                 ClearAnimations(playerid);
  196.                 ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.0, 0, 1, 1, 1, 0, 1);
  197.             }
  198.         }
  199.         //SetPVarInt(playerid, "LastWeapon", GetPlayerWeapon(playerid));
  200.         gLastCar[playerid] = vehicleid;
  201.         foreach(Player, i)
  202.         {
  203.             if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == 2 && TransportDuty[i] > 0)
  204.             {
  205.                 if(GetPlayerCash(playerid) < TransportValue[i])
  206.                 {
  207.                     new string[28];
  208.                     format(string, sizeof(string), "* You need $%d to enter.", TransportValue[i]);
  209.                     SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  210.                     RemovePlayerFromVehicle(playerid);
  211.                     new Float:X, Float:Y, Float:Z;
  212.                     GetPlayerPos(playerid, X, Y, Z);
  213.                     SetPlayerPos(playerid, X, Y, Z+2);
  214.                     TogglePlayerControllable(playerid, 1);
  215.                 }
  216.                 else
  217.                 {
  218.                     new string[38];
  219.                     if(TransportDuty[i] == 1)
  220.                     {
  221.                         format(string, sizeof(string), "* You paid $%d to the taxi driver.", TransportValue[i]);
  222.                         SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  223.                         format(string, sizeof(string), "* Passenger %s has entered your taxi.", GetPlayerNameEx(playerid));
  224.                         SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
  225.                         TransportTime[i] = 1;
  226.                         TransportTime[playerid] = 1;
  227.                         TransportCost[playerid] = TransportValue[i];
  228.                         TransportCost[i] = TransportValue[i];
  229.                         TransportDriver[playerid] = i;
  230.                     }
  231.                     else if(TransportDuty[i] == 2)
  232.                     {
  233.                         format(string, sizeof(string), "* You paid $%d to the Taxi Driver.", TransportValue[i]);
  234.                         SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  235.                         format(string, sizeof(string), "* Passenger %s has entered your Taxi.", GetPlayerNameEx(playerid));
  236.                         SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
  237.                     }
  238.                     GivePlayerCash(playerid, - TransportValue[i]);
  239.                     TransportMoney[i] += TransportValue[i];
  240.                 }
  241.             }
  242.         }
  243.     }
  244.     if(newstate == PLAYER_STATE_WASTED)
  245.     {
  246.         if(GetPVarInt(playerid, "EventToken") == 0)
  247.         {
  248.             SetPVarInt(playerid, "MedicBill", 1);
  249.         }
  250.         if(ConnectedToPC[playerid] == 1337)//mdc
  251.         {
  252.             ConnectedToPC[playerid] = 0;
  253.         }
  254.         Seatbelt[playerid] = 0;
  255.     }
  256.     if(newstate == PLAYER_STATE_DRIVER)
  257.     {
  258.         if(stationidv[GetPlayerVehicleID(playerid)] != 0)
  259.         {
  260.             new station[64];
  261.             switch(stationidv[GetPlayerVehicleID(playerid)])
  262.             {
  263.                 case 1: format(station, sizeof(station), "http://216.246.109.162:8000");
  264.                 case 2: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1415249");
  265.                 case 3: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1415249");
  266.                 case 4: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628721");
  267.                 case 5: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283687");
  268.                 case 6: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628932");
  269.                 case 7: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1756658");
  270.                 case 8: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200");
  271.                 case 9: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057197");
  272.                 case 10: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=18695");
  273.                 case 11: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
  274.                 case 12: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=181367");
  275.                 case 13: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1275071");
  276.                 case 14: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
  277.                 case 15: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356");
  278.                 case 16: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1279013");
  279.                 case 17: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1281016");
  280.                 case 18: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280855");
  281.                 case 19: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1116397");
  282.                 case 20: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057543");
  283.                 case 21: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=616366");
  284.                 case 22: format(station, sizeof(station), "http://38.107.220.164:8014");
  285.                 case 23: format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=847066");
  286.             }
  287.             if(Audio_IsClientConnected(playerid))
  288.             {
  289.                 Audio_Stop(playerid, stationidp[playerid]);
  290.                 stationidp[playerid] = Audio_PlayStreamed(playerid, station, false, true, false);
  291.             }
  292.         }
  293.  
  294.         SetPlayerArmedWeapon(playerid, 0);
  295.  
  296.         new
  297.         newcar = GetPlayerVehicleID(playerid),
  298.         engine, lights, alarm, doors, bonnet, boot, objective, v;
  299.  
  300.         gLastCar[playerid] = newcar;
  301.  
  302.         foreach(Player, i) {
  303.             v = GetPlayerVehicle(i, newcar);
  304.             if(v != -1) {
  305.                 if(i == playerid) {
  306.  
  307.                     new
  308.                     string[96];
  309.  
  310.                     format(string, sizeof(string),"You are the owner of this %s.", GetVehicleName(newcar));
  311.                     SendClientMessageEx(playerid, COLOR_GREY, string);
  312.                     if(PlayerVehicleInfo[i][v][pvTicket] != 0)
  313.                     {
  314.                         format(string, sizeof(string),"A $%d parking ticket was left on your vehicle. You must pay the ticket at the DMV in Dilimore.", PlayerVehicleInfo[i][v][pvTicket]);
  315.                         SendClientMessageEx(playerid, COLOR_GREY, string);
  316.                         SendClientMessageEx(playerid, COLOR_GREY, "Failure to pay this ticket as soon as possible will result in a fine, or even an arrest.");
  317.                     }
  318.                 }
  319.                 else if(i == PlayerInfo[playerid][pVehicleKeysFrom]) {
  320.  
  321.                     new
  322.                     string[64 + MAX_PLAYER_NAME];
  323.  
  324.                     format(string, sizeof(string),"You have the keys for this %s from owner %s.", GetVehicleName(newcar), GetPlayerNameEx(i));
  325.                     SendClientMessageEx(playerid, COLOR_GREY, string);
  326.                 }
  327.                 else if(PlayerVehicleInfo[i][v][pvLocked] == 1 && PlayerVehicleInfo[i][v][pvLock] == 1) {
  328.                     GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
  329.                     SetVehicleParamsEx(newcar,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
  330.                     SetTimerEx("DisableVehicleAlarm", 20000, 0, "d",  newcar);
  331.                 }
  332.                 else if(PlayerVehicleInfo[i][v][pvLocked] == 1 && PlayerVehicleInfo[i][v][pvLock] == 2) {
  333.  
  334.                     new
  335.                     string[49 + MAX_PLAYER_NAME];
  336.  
  337.                     if(PlayerInfo[playerid][pAdmin] < 2)
  338.                     {
  339.                         format(string, sizeof(string), "* %s has been stunned by the electric anti-theft.",GetPlayerNameEx(playerid));
  340.                         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  341.                         new Float:X, Float:Y, Float:Z, Float:HP;
  342.                         GetPlayerPos(playerid, X, Y, Z);
  343.                         SendAudioToRange(10300, 100, 0, X, Y, Z, 20.0);
  344.                         SetPlayerPos(playerid, X + 1, Y, Z);
  345.                         RemovePlayerFromVehicle(playerid);
  346.                         SetPVarInt(playerid, "IsFrozen", 1);
  347.                         TogglePlayerControllable(playerid,0);
  348.                         SetTimerEx("ReleasePlayer", 10000, 0, "d", playerid);
  349.                         GameTextForPlayer(playerid,"~r~STUNNED!",11000,3);
  350.                         GetPlayerHealth(playerid,HP);
  351.                         SetPlayerHealth(playerid,HP-15);
  352.                     }
  353.                     else
  354.                     {
  355.                         format(string, sizeof(string), "Warning: This %s is owned by %s.", GetVehicleName(newcar), GetPlayerNameEx(i));
  356.                         SendClientMessageEx(playerid, COLOR_GREY, string);
  357.                     }
  358.                 }
  359.                 return 1;
  360.             }
  361.         }
  362.  
  363.         for(new f = 0; f < MAX_FAMILY; f++) {
  364.             v = GetGangVehicle(f, newcar);
  365.             if(v != -1) {
  366.                 new string[49 + MAX_PLAYER_NAME];
  367.                 if(PlayerInfo[playerid][pFMember] == f)
  368.                 {
  369.                     format(string, sizeof(string), "You are in the family that owns this %s.", GetVehicleName(newcar));
  370.                     SendClientMessageEx(playerid, COLOR_GREY, string);
  371.                 }
  372.                 else if(FamilyVehicleInfo[f][v][fvLocked] == 1 && FamilyVehicleInfo[f][v][fvLock] == 1)
  373.                 {
  374.                     GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
  375.                     SetVehicleParamsEx(newcar,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
  376.                     SetTimerEx("DisableVehicleAlarm", 20000, 0, "d",  newcar);
  377.                 }
  378.                 else if(FamilyVehicleInfo[f][v][fvLocked] == 1 && FamilyVehicleInfo[f][v][fvLock] == 2)
  379.                 {
  380.                     format(string, sizeof(string), "* %s has been stunned by the electric anti-theft.",GetPlayerNameEx(playerid));
  381.                     ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  382.                     new Float:X, Float:Y, Float:Z, Float:HP;
  383.                     GetPlayerPos(playerid, X, Y, Z);
  384.                     SendAudioToRange(10300, 100, 0, X, Y, Z, 20.0);
  385.                     SetPlayerPos(playerid, X + 1, Y, Z);
  386.                     RemovePlayerFromVehicle(playerid);
  387.                     new Float:slx, Float:sly, Float:slz;
  388.                     GetPlayerPos(playerid, slx, sly, slz);
  389.                     SetPlayerPos(playerid, slx, sly, slz);
  390.                     SetPVarInt(playerid, "IsFrozen", 1);
  391.                     TogglePlayerControllable(playerid,0);
  392.                     SetTimerEx("ReleasePlayer", 10000, 0, "d", playerid);
  393.                     GameTextForPlayer(playerid,"~r~STUNNED!",11000,3);
  394.                     GetPlayerHealth(playerid,HP);
  395.                     SetPlayerHealth(playerid,HP-15);
  396.                 }
  397.                 return 1;
  398.             }
  399.         }
  400.         new vehicleid = newcar;
  401.         if(IsVIPcar(vehicleid))
  402.         {
  403.             if(PlayerInfo[playerid][pDonateRank] > 0)
  404.             {
  405.                 SendClientMessageEx(playerid, COLOR_YELLOW, "VIP: This is a VIP vehicle from the VIP garage, therefore it has unlimited fuel.");
  406.             }
  407.             else
  408.             {
  409.                 new Float:slx, Float:sly, Float:slz;
  410.                 GetPlayerPos(playerid, slx, sly, slz);
  411.                 SetPlayerPos(playerid, slx, sly, slz+1.3);
  412.                 PlayerPlaySound(playerid, 1130, slx, sly, slz+1.3);
  413.                 RemovePlayerFromVehicle(playerid);
  414.                 NOPCheck(playerid);
  415.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a VIP, this is a vehicle from the VIP Garage!");
  416.             }
  417.         }
  418.         else if(IsAnAmbulance(vehicleid))
  419.         {
  420.             if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4)
  421.             {
  422.                 if(FDSAVehicles[13] == vehicleid && PlayerInfo[playerid][pRank] < 5)
  423.                 {
  424.                     RemovePlayerFromVehicle(playerid);
  425.                     new Float:slx, Float:sly, Float:slz;
  426.                     GetPlayerPos(playerid, slx, sly, slz);
  427.                     SetPlayerPos(playerid, slx, sly, slz);
  428.                     NOPCheck(playerid);
  429.                     SendClientMessageEx(playerid, COLOR_GRAD2, "Only ranks 5+ can drive this vehicle.");
  430.                 }
  431.             }
  432.             else
  433.             {
  434.                 SendClientMessageEx(playerid,COLOR_GREY,"   You are not in the FDSA!");
  435.                 RemovePlayerFromVehicle(playerid);
  436.                 new Float:slx, Float:sly, Float:slz;
  437.                 GetPlayerPos(playerid, slx, sly, slz);
  438.                 SetPlayerPos(playerid, slx, sly, slz);
  439.                 NOPCheck(playerid);
  440.             }
  441.         }
  442.         else if(IsAnSASDCar(vehicleid))
  443.         {
  444.             if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pLeader] == 7)
  445.             {
  446.             }
  447.             else
  448.             {
  449.                 RemovePlayerFromVehicle(playerid);
  450.                 new Float:slx, Float:sly, Float:slz;
  451.                 GetPlayerPos(playerid, slx, sly, slz);
  452.                 SetPlayerPos(playerid, slx, sly, slz);
  453.                 NOPCheck(playerid);
  454.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SASD!");
  455.             }
  456.         }
  457.         else if(IsAnSFPDCar(vehicleid))
  458.         {
  459.             if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
  460.             {
  461.             }
  462.             else
  463.             {
  464.                 RemovePlayerFromVehicle(playerid);
  465.                 new Float:slx, Float:sly, Float:slz;
  466.                 GetPlayerPos(playerid, slx, sly, slz);
  467.                 SetPlayerPos(playerid, slx, sly, slz);
  468.                 NOPCheck(playerid);
  469.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SFPD!");
  470.             }
  471.         }
  472.         else if(IsAnEPCar(vehicleid))
  473.         {
  474.             if(PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pRank] >= 5)
  475.             {
  476.             }
  477.             else
  478.             {
  479.                 RemovePlayerFromVehicle(playerid);
  480.                 new Float:slx, Float:sly, Float:slz;
  481.                 GetPlayerPos(playerid, slx, sly, slz);
  482.                 SetPlayerPos(playerid, slx, sly, slz);
  483.                 NOPCheck(playerid);
  484.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SFPD Executive Protection Division!");
  485.             }
  486.         }
  487.         else if(IsAnWPCar(vehicleid))
  488.         {
  489.             if(PlayerInfo[playerid][pMember] == 7 || PlayerInfo[playerid][pMember] == 7){
  490.             }
  491.             else
  492.             {
  493.                 RemovePlayerFromVehicle(playerid);
  494.                 new Float:slx, Float:sly, Float:slz;
  495.                 GetPlayerPos(playerid, slx, sly, slz);
  496.                 SetPlayerPos(playerid, slx, sly, slz);
  497.                 NOPCheck(playerid);
  498.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SASD!");
  499.             }
  500.         }
  501.         else if(IsACopCar(vehicleid))
  502.         {
  503.             if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
  504.             {
  505.             }
  506.             else
  507.             {
  508.                 RemovePlayerFromVehicle(playerid);
  509.                 new Float:slx, Float:sly, Float:slz;
  510.                 GetPlayerPos(playerid, slx, sly, slz);
  511.                 SetPlayerPos(playerid, slx, sly, slz);
  512.                 NOPCheck(playerid);
  513.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the LSPD!");
  514.             }
  515.         }
  516.         else if(IsAHouse275Car(vehicleid))
  517.         {
  518.             TogglePlayerControllable(playerid, false);
  519.             ShowPlayerDialog(playerid, House275CAR, DIALOG_STYLE_INPUT, "KeyPad", "Password:", "ENTER", "ENTER");
  520.         }
  521.         else if(IsAFBICar(vehicleid))
  522.         {
  523.             if(PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2)
  524.             {
  525.             }
  526.             else
  527.             {
  528.                 RemovePlayerFromVehicle(playerid);
  529.                 new Float:slx, Float:sly, Float:slz;
  530.                 GetPlayerPos(playerid, slx, sly, slz);
  531.                 SetPlayerPos(playerid, slx, sly, slz);
  532.                 NOPCheck(playerid);
  533.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the FBI!");
  534.             }
  535.         }
  536.         /*  else if(IsAnNGARMCar(vehicleid))
  537.         {
  538.         if((PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pDivision] == 3 || PlayerInfo[playerid][pDivision] == 6 || PlayerInfo[playerid][pDivision] == 7))
  539.         {
  540.         }
  541.         else
  542.         {
  543.         RemovePlayerFromVehicle(playerid);
  544.         new Float:slx, Float:sly, Float:slz;
  545.         GetPlayerPos(playerid, slx, sly, slz);
  546.         SetPlayerPos(playerid, slx, sly, slz);
  547.         NOPCheck(playerid);
  548.         SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the NG ARM Division!");
  549.         }
  550.         } */
  551.         else if(vehicleid == FDSAVehicles[12] || vehicleid == FDSAVehicles[33] || vehicleid == FDSAVehicles[34] || vehicleid == FDSAVehicles[35])
  552.         {
  553.             if(PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 1)
  554.             {
  555.             }
  556.             else
  557.             {
  558.                 RemovePlayerFromVehicle(playerid);
  559.                 new Float:slx, Float:sly, Float:slz;
  560.                 GetPlayerPos(playerid, slx, sly, slz);
  561.                 SetPlayerPos(playerid, slx, sly, slz);
  562.                 NOPCheck(playerid);
  563.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Fire Department Division!");
  564.             }
  565.         }
  566.         else if(vehicleid == FDSAVehicles[37] || vehicleid == FDSAVehicles[36])
  567.         {
  568.             if(PlayerInfo[playerid][pLeader] == 4 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2)
  569.             {
  570.             }
  571.             else
  572.             {
  573.                 RemovePlayerFromVehicle(playerid);
  574.                 new Float:slx, Float:sly, Float:slz;
  575.                 GetPlayerPos(playerid, slx, sly, slz);
  576.                 SetPlayerPos(playerid, slx, sly, slz);
  577.                 NOPCheck(playerid);
  578.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Life Flight Division!");
  579.             }
  580.         }
  581.         else if(IsAnNGAIRCar(vehicleid))
  582.         {
  583.             if((PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == 1 || PlayerInfo[playerid][pDivision] == 4))
  584.             {
  585.             }
  586.             else
  587.             {
  588.                 RemovePlayerFromVehicle(playerid);
  589.                 new Float:slx, Float:sly, Float:slz;
  590.                 GetPlayerPos(playerid, slx, sly, slz);
  591.                 SetPlayerPos(playerid, slx, sly, slz);
  592.                 NOPCheck(playerid);
  593.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the NG AIR Division!");
  594.             }
  595.         }
  596.         else if(IsAnNGCar(vehicleid))
  597.         {
  598.             if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
  599.             {
  600.             }
  601.             else
  602.             {
  603.                 RemovePlayerFromVehicle(playerid);
  604.                 new Float:slx, Float:sly, Float:slz;
  605.                 GetPlayerPos(playerid, slx, sly, slz);
  606.                 SetPlayerPos(playerid, slx, sly, slz);
  607.                 NOPCheck(playerid);
  608.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the National Guard!");
  609.             }
  610.         }
  611.         else if(IsAnDOCCar(vehicleid))
  612.         {
  613.             if(PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
  614.             {
  615.             }
  616.             else
  617.             {
  618.                 NOPCheck(playerid);
  619.                 RemovePlayerFromVehicle(playerid);
  620.                 new Float:slx, Float:sly, Float:slz;
  621.                 GetPlayerPos(playerid, slx, sly, slz);
  622.                 SetPlayerPos(playerid, slx, sly, slz);
  623.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the National Guard!");
  624.             }
  625.         }
  626.         else if(IsAnMPSCar(vehicleid))
  627.         {
  628.             if(IsACop(playerid))
  629.             {
  630.             }
  631.             else
  632.             {
  633.                 RemovePlayerFromVehicle(playerid);
  634.                 new Float:slx, Float:sly, Float:slz;
  635.                 GetPlayerPos(playerid, slx, sly, slz);
  636.                 SetPlayerPos(playerid, slx, sly, slz);
  637.                 NOPCheck(playerid);
  638.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You aren't in a LEO Faction.");
  639.             }
  640.         }
  641.         else if(IsACoastguardCar(vehicleid))
  642.         {
  643.             if( ( PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 ) || ( PlayerInfo[playerid][pMember] == 3 && PlayerInfo[playerid][pDivision] == 3 ))
  644.             {
  645.             }
  646.             else
  647.             {
  648.                 RemovePlayerFromVehicle(playerid);
  649.                 new Float:slx, Float:sly, Float:slz;
  650.                 GetPlayerPos(playerid, slx, sly, slz);
  651.                 SetPlayerPos(playerid, slx, sly, slz);
  652.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the Coastguard division!");
  653.             }
  654.         }
  655.         else if(IsANewsCar(vehicleid))
  656.         {
  657.             if(PlayerInfo[playerid][pMember] == 9 ||PlayerInfo[playerid][pLeader] == 9)
  658.             {
  659.             }
  660.             else
  661.             {
  662.                 RemovePlayerFromVehicle(playerid);
  663.                 new Float:slx, Float:sly, Float:slz;
  664.                 GetPlayerPos(playerid, slx, sly, slz);
  665.                 SetPlayerPos(playerid, slx, sly, slz);
  666.                 NOPCheck(playerid);
  667.                 SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the SANews!");
  668.             }
  669.         }
  670.         else if(IsAPlane(vehicleid))
  671.         {
  672.             if(PlayerInfo[playerid][pFlyLic] != 1)
  673.             {
  674.                 RemovePlayerFromVehicle(playerid);
  675.                 new Float:slx, Float:sly, Float:slz;
  676.                 GetPlayerPos(playerid, slx, sly, slz);
  677.                 SetPlayerPos(playerid, slx, sly, slz);
  678.                 NOPCheck(playerid);
  679.                 SendClientMessageEx(playerid,COLOR_GREY,"You don't have a pilot license!");
  680.             }
  681.         }
  682.         else if(IsAHelicopter(vehicleid))
  683.         {
  684.             PlayerInfo[playerid][pAGuns][GetWeaponSlot(46)] = 46;
  685.             GivePlayerValidWeapon(playerid, 46, 60000);
  686.         }
  687.         else if(IsAnTaxi(vehicleid) || IsAnBus(vehicleid))
  688.         {
  689.             if(PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17 || PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pTaxiLicense] == 1)
  690.             {
  691.             }
  692.             else
  693.             {
  694.                 SendClientMessageEx(playerid,COLOR_GREY,"   You are not a Taxi/Bus Driver!");
  695.                 RemovePlayerFromVehicle(playerid);
  696.                 new Float:slx, Float:sly, Float:slz;
  697.                 GetPlayerPos(playerid, slx, sly, slz);
  698.                 SetPlayerPos(playerid, slx, sly, slz);
  699.             }
  700.         }
  701.         if( GetPVarInt( playerid, "ToBeEjected" ) >= 1 )
  702.         {
  703.             SetPVarInt( playerid, "ToBeEjected", 0 );
  704.             RemovePlayerFromVehicle( playerid );
  705.             new Float:X, Float:Y, Float:Z;
  706.             GetPlayerPos(playerid, X, Y, Z);
  707.             SetPlayerPos(playerid, X, Y, Z+2);
  708.  
  709.             if(GetPVarInt(playerid, "Injured") == 1)
  710.             {
  711.                 Streamer_UpdateEx(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
  712.                 SetPlayerPos(playerid, GetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
  713.                 SetPlayerVirtualWorld(playerid, GetPVarInt(playerid,"MedicVW"));
  714.                 SetPlayerInterior(playerid, GetPVarInt(playerid,"MedicInt"));
  715.                 ClearAnimations(playerid);
  716.                 ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.0, 0, 1, 1, 1, 0, 1);
  717.             }
  718.         }
  719.         //if(lights == VEHICLE_PARAMS_UNSET) SetVehicleParamsEx(newcar,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
  720.         TelePos[playerid][0] = 0.0;
  721.         TelePos[playerid][1] = 0.0;
  722.         //SetPVarInt(playerid, "LastWeapon", GetPlayerWeapon(playerid));
  723.         if(IsARental(newcar) && gBike[playerid] == 0 && gBikeRenting[playerid] == 0)
  724.         {
  725.             TogglePlayerControllable(playerid,0);
  726.             ShowPlayerDialog(playerid, RENTMENU, DIALOG_STYLE_LIST, "Bike Shed BMX Rentals","15 Minutes - 1000$\n30 Minutes - 2000$\n1 Hour - 4000$", "Rent", "Cancel");
  727.         }
  728.         if(GetCarDealershipVehicleId(newcar) != -1 && GetCarDealershipVehicleId(newcar) == GetPVarInt(playerid, "editingcdveh")) return 1;
  729.         if(GetCarDealershipVehicleId(newcar) != -1)
  730.         {
  731.             new string[57 + 20 + 4];
  732.             format(string, sizeof(string),"Would you like to buy this %s?\n\nThis vehicle costs $%d.", GetVehicleName(newcar), CarDealershipInfo[GetCarDealershipId(newcar)][cdVehicleCost][GetCarDealershipVehicleId(newcar)]);
  733.             ShowPlayerDialog(playerid,DIALOG_CDBUY,DIALOG_STYLE_MSGBOX,"Warning:",string,"Buy","Cancel");
  734.             TogglePlayerControllable(playerid, false);
  735.             return 1;
  736.         }
  737.         GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
  738.         if((engine == VEHICLE_PARAMS_UNSET || engine == VEHICLE_PARAMS_OFF) && GetVehicleModel(newcar) != 509 && GetVehicleModel(newcar) != 481 && GetVehicleModel(newcar) != 510) {
  739.             SendClientMessageEx(playerid, COLOR_WHITE, "This vehicle's engine is not running - if you wish to start it, type /car engine.");
  740.         }
  741.         else
  742.         {
  743.             if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 481 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 509 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 510)
  744.             {
  745.                 SetPVarInt(playerid, "fuelonoff", 1);
  746.                 FuelBar[playerid] = CreateProgressBar(548.00, 26.00, 57.50, 3.20, 866792447, 100.0);
  747.                 textdrawscount++;
  748.                 SetProgressBarValue(FuelBar[playerid], VehicleFuel[GetPlayerVehicleID(playerid)]);
  749.                 ShowProgressBarForPlayer(playerid, FuelBar[playerid]);
  750.             }
  751.         }
  752.     }
  753.     if((newstate == 2 || newstate == 3 || newstate == 7 || newstate == 9) && pTazer[playerid] == 1)
  754.     {
  755.         GivePlayerValidWeapon(playerid, pTazerReplace[playerid], 60000);
  756.         pTazer[playerid] = 0;
  757.     }
  758.     if(newstate == PLAYER_STATE_SPAWNED)
  759.     {
  760.         if(ConnectedToPC[playerid] == 1337)//mdc
  761.         {
  762.             ConnectedToPC[playerid] = 0;
  763.         }
  764.         TelePos[playerid][0] = 0.0;
  765.         TelePos[playerid][1] = 0.0;
  766.         gPlayerSpawned[playerid] = 1;
  767.         SafeTime[playerid] = 60;
  768.     }
  769.     if(newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
  770.     {
  771.         new vehicleid = GetPlayerVehicleID(playerid);
  772.         if(VehicleStatus{vehicleid} == 1) return SendClientMessageEx(playerid, COLOR_WHITE, "You are not allowed to enter this Shamal as it's been damaged!");
  773.         new string[47 + MAX_PLAYER_NAME];
  774.         format(string, sizeof(string), "* %s enters the Shamal airplane as a passenger.", GetPlayerNameEx(playerid));
  775.         ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  776.         SetPlayerPos(playerid, 2.509036, 23.118730, 1199.593750);
  777.         SetPlayerFacingAngle(playerid, 82.14);
  778.         SetCameraBehindPlayer(playerid);
  779.         PlayerInfo[playerid][pVW] = vehicleid;
  780.         SetPlayerVirtualWorld(playerid, vehicleid);
  781.         PlayerInfo[playerid][pInt] = 1;
  782.         SetPlayerInterior(playerid, 1);
  783.         InsideShamal[playerid] = vehicleid;
  784.         SendClientMessageEx(playerid, COLOR_WHITE, "Type /exit near the door to exit the vehicle, or /window to look outside.");
  785.     }
  786.     IsPlayerSteppingInVehicle[playerid] = -1;
  787.     return 1;
  788. }
Advertisement
Add Comment
Please, Sign In to add comment