Server keep crashing
#1

Server keeps crashing after playing 5 minutes.
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3z, ©2005-2014 SA-MP Team

[09:24:15] 
[09:24:15] Server Plugins
[09:24:15] --------------
[09:24:15]  Loading plugin: audio.so
[09:24:15] 

*** Audio Plugin v0.5 R2 by Incognito loaded ***

[09:24:15]   Loaded.
[09:24:15]  Loading plugin: streamer.so
[09:24:15] 

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[09:24:15]   Loaded.
[09:24:15]  Loading plugin: crashdetect.so
[09:24:15]   CrashDetect v4.15.1 is OK.
[09:24:15]   Loaded.
[09:24:15]  Loaded 3 plugins.

[09:24:15] 
[09:24:15] Filterscripts
[09:24:15] ---------------
[09:24:15]   Loading filterscript 'ls_elevator.amx'...
[09:24:15]   Loaded 1 filterscripts.

[09:24:16] foreach called
[09:24:16]  
[09:24:16]  ======================================= 
[09:24:16]  |                                     | 
[09:24:16]  |        YSI version 1.04.0000        | 
[09:24:16]  |        By Alex "******" Cole        | 
[09:24:16]  |                                     | 
[09:24:16]  ======================================= 
[09:24:16]  
[09:24:16] *** Audio Plugin: Started TCP server on port 7777
[09:24:16] *** Audio_SetPack: Error opening "audiopacks/default_pack/file.mp3" for CRC check
[09:24:16] *** Audio_SetPack: Error opening "audiopacks/default_pack/file.ogg" for CRC check
[09:24:16] *** Audio_SetPack: Error opening "audiopacks/default_pack/file.wav" for CRC check
[09:24:16] *** Audio_SetPack: Audio pack set to "default_pack" (transferable and automated)
[09:24:16] gCamera has succesfully loaded 0 camera(s).
[09:24:16] Default Weather: 11
[09:24:16] 
---------------------------------------
[09:24:16] Red County Roleplay was successfully loaded!

[09:24:16] ---------------------------------------

[09:24:16] Number of vehicle models: 44
[09:24:16]  
[09:24:16]  ========================================== 
[09:24:16]  |                                        | 
[09:24:16]  |  A new version (v3.09.0684) of YSI is  | 
[09:24:16]  |            available from:             | 
[09:24:16]  |                                        | 
[09:24:16]  |     www.y-less.com/YSI/YSI_1.0.zip     | 
[09:24:16]  |                                        | 
[09:24:16]  | Changelog:                             | 
[09:24:16]  |                                        | 
[09:24:16]  |   3.00.0000:                           | 
[09:24:16]  |                                        | 
[09:24:16]  |   YSI 3.0 released!  Now includes the  | 
[09:24:16]  | "y_text" library for better messages,  | 
[09:24:16]  | and a reworked "y_classes" library.    | 
[09:24:16]  | Largely documented here                | 
[09:24:16]  | "http://forum.sa-mp.com/showthread.php | 
[09:24:16]  | ?t=321092".                            | 
[09:24:16]  |                                        | 
[09:24:16]  |   3.01.0002:                           | 
[09:24:16]  |                                        | 
[09:24:16]  |   Small fixes to "y_text" and          | 
[09:24:16]  | "y_classes".                           | 
[09:24:16]  |                                        | 
[09:24:16]  |   3.09.0684:                           | 
[09:24:16]  |                                        | 
[09:24:16]  |   Reverted to old download location.   | 
[09:24:16]  | Improved (and fixed) version checks;   | 
[09:24:16]  | added y_bitmap, y_areas, y_races,      | 
[09:24:16]  | y_zonenames, better documentation;     | 
[09:24:16]  | MANY other bug fixes - see the github  | 
[09:24:16]  | repository for more details:           | 
[09:24:16]  |                                        | 
[09:24:16]  ========================================== 
[09:24:16]  
[09:30:50] Incoming connection: 178.249.49.202:62075
[09:34:31] Incoming connection: 178.249.49.202:52222
[09:34:32] [join] Javier_Acosta has joined the server (0:178.249.49.202)
[09:41:47] [chat] [Javier_Acosta]: j
[09:41:49] [chat] [Javier_Acosta]: k
[09:42:23] [debug] Run time error 4: "Array index out of bounds"
[09:42:23] [debug]  Accessing element at index 2001 past array upper bound 1999
[09:42:23] [debug] AMX backtrace:
[09:42:23] [debug] #0 000535c4 in public OnPlayerStateChange (0, 2, 1) from enrp.amx
[09:42:33] [debug] Server crashed while executing enrp.amx
[09:42:33] [debug] AMX backtrace:
[09:42:33] [debug] #0 0000000c in public OnPlayerKeyStateChange (0, 4, 0) from enrp.amx
Reply
#2

Can you post your OnPlayerStateChange and OnPlayerKeyStateChange?
Reply
#3

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	SetTimerEx("CarRadios",1000,false,"i",playerid);
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
      new engine,lights,alarm,doors,bonnet,boot,objective,panels,tires;
     // 	cOnPlayerStateChange(playerid, newstate, oldstate);
    //new name[MAX_PLAYER_NAME];
    //GetPlayerName(playerid, name, sizeof(name));
    new string[128];
	new vehi = GetPlayerVehicleID(playerid);




    if(newstate == PLAYER_STATE_ONFOOT) {
        TelePos[playerid][0] = 0.0;
        TelePos[playerid][1] = 0.0;
        if(DriverTest[playerid] > 0) {
            DisablePlayerCheckpoint(playerid);
            gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
            DriverTest[playerid] = 0;
            SendClientMessage(playerid,COLOR_LIGHTRED,"[INFO]: You left Your car, so you failed the test.");

        }
        else if(VehAsk[playerid] == 1) {
            VehAsk[playerid] = 0;
            TogglePlayerControllable(playerid,true);

        }
        else if(SeatBelt[playerid] == 1) {
            SeatBelt[playerid] = 0;

        }

    }




 	else if(newstate == PLAYER_STATE_ONFOOT)
	{
		if(PayForTaxi[playerid] > 0 && Driver[playerid] < 9999)
		{


		    format(string,sizeof(string),"You left the taxi,you paid %d $ to the driver!",PayForTaxi[playerid]);
		    SendClientMessage(playerid,COLOR_WHITE,string);
		    GivePlayerMoney(Driver[playerid],PayForTaxi[playerid]);
		    GivePlayerMoney(playerid,-PayForTaxi[playerid]);
		    PayForTaxi[playerid] = 0;
		    GetFromTaxi[Driver[playerid]] = 0;
		    Accepted[playerid] = 9999;
		    TrTime[playerid] = 0;
		    TrTime[Driver[playerid]] = 0;
		}
	}
	    new newcar = GetPlayerVehicleID(playerid);



     if(newstate == PLAYER_STATE_DRIVER) {
//SetTimerEx("CarRadios", 1000, false, "i", playerid);

        if(AdminDuty[playerid] == 1) {

            new name[MAX_PLAYER_NAME];
            strcpy(name,CarInfo[VehicleOwned[newcar]][cOwner],MAX_PLAYER_NAME);
            //GiveNameSpace(name);
            //format(string,sizeof(string),"[INFO]: Vehicle registered to %s",name);
            return 1;

        }
   // SetTimerEx("CarRadios", 1000, false, "i", playerid);
        if(VehicleEngine[newcar] == 0) {

            if(!IsNotAEngineCar(newcar)) {
            //new engine,lights,alarm,doors,bonnet,boot,objective,panels,tires;
                GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
                SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                GetVehicleDamageStatus(newcar,panels,doors,lights,tires);
		        UpdateVehicleDamageStatus(newcar, panels, doors, 5, tires);
                VehAsk[playerid] = 1;
                SendClientMessage(playerid, COLOR_GREEN, "Engine is not started (/engine)");
                SendClientMessage(playerid, COLOR_GREEN, "If it is a faction vehicle (/fengine)");
            }

        }



        if(newstate == PLAYER_STATE_DRIVER) {
       // SetTimerEx("CarRadios", 1000, false, "i", playerid);

            new carid = GetPlayerVehicleID(playerid);
            GetVehicleDamageStatus(carid, panels, doors, lights, tires);
            lights = encode_lights(1, 1, 1, 1);
            SetPVarInt(playerid, "vMainOn", 0);
            UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);

        }

       else if(newstate == PLAYER_STATE_ONFOOT) {

            KillTimer(BlinkTime[playerid]);
            SetPVarInt(playerid, "CopFlash", 0);

        }
        if(PlayerInfo[playerid][pDrivLic] == 0) {

            SendClientMessage(playerid,COLOR_LIGHTRED,"You don't have a driving license! Pass a driving test to get one");
        }


            // new newcar = GetPlayerVehicleID(playerid);
        CarEnter[playerid] = 1;
        //SetTimerEx("CarRadios", 1000, false, "i", playerid);
        if(IsAnOwnableCar(newcar)) {
          //  new name[MAX_PLAYER_NAME];
        //    strcpy(name,CarInfo[VehicleOwned[newcar]][cOwner],MAX_PLAYER_NAME);
          //  GiveNameSpace(name);
            //format(string,sizeof(string),"[INFO]: Vehicle registered to %s",name);
            //SendClientMessage(playerid, 0x8080FF96, string);
            if (!IsNotAEngineCar(newcar)) {
                if(VehicleEngine[newcar] == 0) {
                    if(PlayerInfo[playerid][pCarkey] == VehicleOwned[newcar]) {
                        format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        return 1;
                    }
                    else if(PlayerInfo[playerid][pCarkey2] == VehicleOwned[newcar]) {
                        format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        return 1;
                    }
                    else if(PlayerInfo[playerid][pCarkey3] == VehicleOwned[newcar]) {
                        format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        return 1;
                    }
                    else {
                        TogglePlayerControllable(playerid,false);
                        VehAsk[playerid] = 2;
                      //  SendClientMessage(playerid,COLOR_GRAD3,"[INFO]: You can hotwire this vehicle using /engine if you have a toolkit, Or you can /exit.");

                    }

                }

            }
            if(VehicleEngine[newcar] == 1) {
                if(PlayerInfo[playerid][pCarkey] == VehicleOwned[newcar]) {
                    format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    return 1;
                }
                else if(PlayerInfo[playerid][pCarkey2] == VehicleOwned[newcar]) {
                    format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    return 1;
                }
                else if(PlayerInfo[playerid][pCarkey3] == VehicleOwned[newcar]) {
                    format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    return 1;
                }
                else {
                    SendClientMessage(playerid,COLOR_GREEN,"Engine is on");

                }

            }

        }



                if(CarAlarm[vehi][caalarm] <= 2 && VehAsk[playerid] == 2 && IsAnOwnableCar(vehi)) {


                    //format(string,sizeof(string),"5-STAR:Vehicle %s alarm is activated",VehicleNames[GetVehicleModel(vehi)-400]);
                   // SendClientMessage(playerid, 0xE7D5ADFF, string);
                    //SetVehicleParamsForPlayer(vehi, playerid, 1, 0);
                    format(string, sizeof(string), "*[Vehicle alarm]:BEEP! BEEP! BEEP! BEEP!");
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    SetPVarInt(playerid, "VehON", 0);
                    AlarmTime[playerid] = SetTimerEx("Alarm", FLASH_TIME, 1, "i", playerid);
                    Stop[playerid] = SetTimerEx("Chill",SHUTDOWN,false,"i",playerid);





                }
                if(CarAlarm[vehi][caalarm] >= 4 &&  VehAsk[playerid] == 2 && IsAnOwnableCar(vehi)) {


                    new name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, name, sizeof(name));
                    new st[256];
              		//new Float:VPosX,Float:VPosY,Float:VPosZ;
				    //GetVehiclePos(key1[playerid],VPosX,VPosY,VPosZ);
				  //  SetVehicleParamsForPlayer(vehi, i, 1, 0);
                  //  SetVehicleParamsForPlayer(vehi, playerid, 1, 0);
                    SetTimerEx("VehicleA",1000, false, "i", playerid);
                    format(string, sizeof(string), "*[Vehicle alarm]:BEEP! BEEP! BEEP! BEEP!");
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    format(string,sizeof(string),"SMS:Vehicle %s alarm is activated,Sender: MOLE (555)",VehicleNames[GetVehicleModel(vehi)-400]);
                    SendClientMessage(playerid, 0xE7D5ADFF, string);
					//iVehicleObjective[vehi][0] = 1; //Marker
					//iVehicleObjective[vehi][1] = 0; //Door Lock
                    //CarLabel5 = Create3DTextLabel("Vehicle Alarm is on!" ,COLOR_YELLOW,VPosX,VPosY,VPosY+3,15.0,0);
                    //Attach3DTextLabelToVehicle(CarLabel5,key1[playerid],0.0, 0.0, 0.0);
                     new vZone[MAX_ZONE_NAME], pZone[MAX_ZONE_NAME];
                    GetVehicleZone(vehi, vZone, MAX_ZONE_NAME); GetPlayer2DZone(playerid, pZone, MAX_ZONE_NAME);
                    format(st, sizeof(st), "[Vehicle Alarm] %s located in %s.",VehicleNames[GetVehicleModel(vehi)-400]);
                    SendFamilyMessage(1,COLOR_LIGHTBLUE, st);
                    SetPVarInt(playerid, "VehON", 0);
                    AlarmTime[playerid] = SetTimerEx("Alarm", FLASH_TIME, 1, "i", playerid);
                    Stop[playerid] = SetTimerEx("Chill",SHUTDOWN,false,"i",playerid);

                    return 1;




                }
	            new Float:x,Float:y,Float:z;
				GetPlayerPos(playerid, x, y, z);
				if(IsAGasVeh(newcar))
				{
		    	if(PlayerInfo[playerid][pJob] != 3)
		    	{
			    SendClientMessage(playerid,COLOR_WHITE,"[Gas Vehicle]Your not a Gas Deliver!");
			    RemovePlayerFromVehicle(playerid);
			    return 1;
			}
			SendClientMessage(playerid,COLOR_GREEN,"Welcome to the Gas Deliver Van,use /gas to buy some gas.");
			format(string,sizeof(string),"Currently Vehicle Gas: %d",VGas[newcar]);
			SendClientMessage(playerid,COLOR_GREEN,string);
			PlayerPlaySound(playerid, 1055, x,y,z);
		}


else if(IsACopCar(newcar) && !(IsAnFbiCar(newcar)&&PlayerInfo[playerid][pMember]==2))
{
    if(PlayerInfo[playerid][pMember] != 1) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(IsASheriffCar(newcar))
{
    if(PlayerInfo[playerid][pMember] != 14) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(IsAnFbiCar(newcar))
{
    if(PlayerInfo[playerid][pMember] != 2) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(IsAGovCar(newcar))
{
    if(PlayerInfo[playerid][pMember] != 3) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(IsAnAmbulance(newcar))
{
    if(PlayerInfo[playerid][pMember] != 4) {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(IsAPizzabike(newcar))
{
    if(PlayerInfo[playerid][pJob] != 17) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this bike.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else {
        SendClientMessage(playerid, COLOR_GRAD3, "Type /startpizza to begin a pizza mission.");

    }

}


if(IsABus(newcar))
{
    if(PlayerInfo[playerid][pJob] != 14) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this bus.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else {
        if(JobDelay[playerid] > 0) {
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid,true);
            VehAsk[playerid] = 0;
            SendClientMessage(playerid, COLOR_GREY," You need to wait for Your last route time to reduce !");

        }
        else if(BusRoute[playerid] == 0) {
            ShowMenuForPlayer(BusRoutesM, playerid);
            BusRoute[playerid] = 1;
            gPlayerCheckpointStatus[playerid] = CHECKPOINT_BUSROUTE;
            BusRouteS[playerid] = 0;

        }

    }

}


else if(IsATowcar(newcar))
{
    if(PlayerInfo[playerid][pJob] != 7) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(newcar >= 135 && newcar <= 154)
{
    if (HireCar[playerid] != newcar) {
       new strins[256];
		format(strins, sizeof(strins), "You can rent this vehicle for $%d\nPlease Remember to /unrentvehicle when finished\nIf you rent this vehicle you will be able to /engine",SBizzInfo[0][sbEntranceCost]);
		ShowPlayerDialog(playerid,DACCT30,DIALOG_STYLE_MSGBOX,"Enterprise Rent",strins,"Rent","Exit");
        GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        VehAsk[playerid] = 1;

    }

}


else if(newcar >= 203 && newcar <= 205)
{
    if (HireCar[playerid] != newcar) {
        new strins[256];
		format(strins, sizeof(strins), "You can rent this vehicle for $%d\nPlease Remember to /unrentvehicle when finished\nIf you rent this vehicle you will be able to /engine",SBizzInfo[0][sbEntranceCost]);
		ShowPlayerDialog(playerid,DACCT30,DIALOG_STYLE_MSGBOX,"Enterprise Rent",strins,"Rent","Exit");
        GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        VehAsk[playerid] = 1;

    }

}


else if(newcar >= 194 && newcar <= 196)
{
   // format(string, sizeof(string), "Vehicle rental:Rent a vehicle for $%d /rentvehicle",SBizzInfo[1][sbEntranceCost]);
   // SendClientMessage(playerid, COLOR_WHITE,string);
   // SendClientMessage(playerid, COLOR_GREEN,"Rent a vehicle and you will be able to /rlock vehice.");
     new strins[256];
    format(strins, sizeof(strins), "You can rent this vehicle for $%d\nPlease Remember to /unrentvehicle when finished\nIf you rent this vehicle you will be able to /engine",SBizzInfo[0][sbEntranceCost]);
    ShowPlayerDialog(playerid,DACCT30,DIALOG_STYLE_MSGBOX,"Enterprise Rent",strins,"Rent","Exit");
    GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    VehAsk[playerid] = 1;

}


else if(newcar >= 1 && newcar <= 9)
{
    if (HireCar[playerid] != newcar) {
      //  format(string, sizeof(string), "Vehicle rental:Rent a vehicle for $%d /rentvehicle",SBizzInfo[1][sbEntranceCost]);
       // SendClientMessage(playerid, COLOR_WHITE,string);
      //  SendClientMessage(playerid, COLOR_GREEN,"Rent a vehicle and you will be able to /rlock vehice.");
        new strins[256];
        format(strins, sizeof(strins), "You can rent this vehicle for $%d\nPlease Remember to /unrentvehicle when finished\nIf you rent this vehicle you will be able to /engine",SBizzInfo[0][sbEntranceCost]);
        ShowPlayerDialog(playerid,DACCT30,DIALOG_STYLE_MSGBOX,"Enterprise Rent",strins,"Rent","Exit");
        GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        VehAsk[playerid] = 1;

    }

}


else if(newcar >= 112 && newcar <= 130)
{
    if (HireCar[playerid] != newcar) {

      //  format(string, sizeof(string), "Vehicle rental:Rent a vehicle for $%d /rentcar",SBizzInfo[0][sbEntranceCost]);
      //  SendClientMessage(playerid, COLOR_WHITE,string);
       // SendClientMessage(playerid, COLOR_GREEN,"Rent a vehicle and you will be able to /rlock vehice.");
        new strins[256];
        format(strins, sizeof(strins), "You can rent this vehicle for $%d\nPlease Remember to /unrentcar when finished\nIf you rent this vehicle you will be able to /engine",SBizzInfo[0][sbEntranceCost]);
        ShowPlayerDialog(playerid,DACCT29,DIALOG_STYLE_MSGBOX,"Enterprise Rent",strins,"Rent","Exit");
        VehAsk[playerid] = 1;
        GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);

    }

}


else if(newcar >= 84 && newcar <= 87)
{
// Race Cars
    if(GetPlayerInterior(playerid) != 7) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(newcar == 131 || newcar == 132 || newcar == 133 || newcar == 134)
{
    if(DriverTest[playerid] == 0) {
        SendClientMessage(playerid,COLOR_WHITE,"License exam: Try to pass license exam /licenseexam,if you succeed license cost 5000$");
        SendClientMessage(playerid,COLOR_WHITE,"If you don't want to take exam type /exit");
        TogglePlayerControllable(playerid,false);
        VehAsk[playerid] = 1;

    }
}


else if(newcar >= 61 && newcar <= 70)
{
// Taxi lock
    if(PlayerInfo[playerid][pMember] != 7) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(newcar >= 71 && newcar <= 73)
{
// News Van
    if(PlayerInfo[playerid][pMember] != 5) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(newcar >= 78 && newcar <= 95)
{
// Unused
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
    TogglePlayerControllable(playerid,true);
    VehAsk[playerid] = 0;

}


else if(newcar >= 159 && newcar <= 161)
{
// Unused
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
    TogglePlayerControllable(playerid,true);
    VehAsk[playerid] = 0;

}


else if(IsASweep(newcar))
{
  CheckP[playerid] = 0;
// Street Sweeper
    if(PlayerInfo[playerid][pJob] != 21) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else {
        if(JobDelay[playerid] > 0) {
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid,true);
            VehAsk[playerid] = 0;
            SendClientMessage(playerid, COLOR_GREY," You need to wait for Your last route time to reduce !");

        }
        else if(StreetSweep[playerid] == 0) {
          CheckP[playerid] = 0;
            ShowMenuForPlayer(StartSweepM, playerid);
            StreetSweep[playerid] = 1;
            gPlayerCheckpointStatus[playerid] = CHECKPOINT_SWEEP;

        }

    }

}


else if(newcar >= 155 && newcar <= 158)
{
// Harvester
   CheckP[playerid] = 0;
    if(PlayerInfo[playerid][pJob] != 18) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else {
        if(JobDelay[playerid] > 0) {
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid,true);
            VehAsk[playerid] = 0;
            SendClientMessage(playerid, COLOR_GREY," You need to wait for your last route time to reduce !");

        }
        else if(Harvesting[playerid] == 0) {
            SendClientMessage(playerid,COLOR_GRAD3,"[INFO]: Head to the checkpoint to begin.");
            Harvesting[playerid] = 1;
            gPlayerCheckpointStatus[playerid] = CHECKPOINT_HARVEST;
            SetPlayerCheckpoint(playerid,-376.6393,-1433.9570,25.7266,5.0);

        }

    }

}


else if(newcar >= 96 && newcar <= 101)
{
// Garbage Truck
    if(PlayerInfo[playerid][pJob] != 16) {
      CheckP[playerid] = 0;
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else {
        if(JobDelay[playerid] > 0) {
          CheckP[playerid] = 0;
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid,true);
            VehAsk[playerid] = 0;
            SendClientMessage(playerid, COLOR_GREY," You need to wait for your last route time to reduce !");

        }
        else if(GarbageRoute[playerid] == 0) {
          CheckP[playerid] = 0;
            SendClientMessage(playerid,COLOR_GRAD3,"[INFO]: Head to the checkpoint to begin.");
            GarbageRoute[playerid] = 1;
            SetPlayerTrash(playerid,2382.4307,-1937.4563,14.0951,187.187,5.0);
            gPlayerCheckpointStatus[playerid] = CHECKPOINT_GARBAGE;

        }

    }

}


else if(newcar >= 108 && newcar <= 111)
{
  CheckP[playerid] = 0;
// Trucker
    if(PlayerInfo[playerid][pJob] != 24) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else if(ProdMission[playerid] == 0) {
        SendClientMessage(playerid,COLOR_GRAD3,"[INFO]: Head to the checkpoint to begin.");
        gPlayerCheckpointStatus[playerid] = CHECKPOINT_PROD1;
        ProdMission[playerid] = 1;
        new RandomWeth;
        RandomWeth = random(3);
        switch(RandomWeth) {
            case 0:

                {
                    SetPlayerCheckpoint(playerid,2852.5193,-1532.5118,11.0938,5.0);
                      CheckP[playerid] = 0;

                }
            case 1:

                {
                    SetPlayerCheckpoint(playerid,1360.8496,-1643.5159,13.3828,5.0);
                      CheckP[playerid] = 0;

                }
            case 2:

                {
                    SetPlayerCheckpoint(playerid,2164.8250,-2271.3850,13.3368,5.0);
                      CheckP[playerid] = 0;

                }

        }

    }

}


}
else if(newstate == PLAYER_STATE_SPAWNED)
{
    TelePos[playerid][0] = 0.0;
    TelePos[playerid][1] = 0.0;

}

}
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	new string[128];
	new sendername[MAX_PLAYER_NAME];
    new giveplayer[MAX_PLAYER_NAME];
	if (IsAtPGarbage(playerid))
        {
		if(newkeys == KEY_CROUCH)
		{
			GetPlayerName(playerid, sendername, sizeof(sendername));
			GiveNameSpace(sendername);
			if(PlayerInfo[playerid][pMaskUse] == 1)
			{
				format(sendername, sizeof(sendername), "[Mask_%d_38]", RandMask[playerid]);
			}
			new dice = random(15)+1;
			ClearAnimations(playerid);
			if(dice == 1)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a dirty Burger Shot Hamburger.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a dirty old half eaten hamburger, Throw it away!");

			}
			else if(dice == 2)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a used condom.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found s used condom!");

			}
			else if(dice == 3)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a hotdog.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a hotdog!");
				new Float:PlayersArmour;
				GetPlayerHealth(playerid, PlayersArmour);
				SetPlayerHealthExs(playerid, PlayersArmour + 5.0);

			}
			else if(dice == 4)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a Banana Peal.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a Banana Peal");

			}
			else if(dice == 5)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a dead rat.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a dead rat!");

			}
			else if(dice == 6)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a used dildo.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a dildo!");
				GivePlayerWeaponEx(playerid,10,1);

			}
			else if(dice == 7)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a broken pool cue.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a pool cue!");
				GivePlayerWeaponEx(playerid,7,1);

			}
			else
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds nothing of value.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found nothing!");

			}
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			// Place Bomb
			ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
			return 1;

		}

	}

      if(((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE)) || ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE)) ||  (newkeys & KEY_FIRE)) {
   	    for(new i = 0; i < GetMaxPlayers(); i++)
    	{
            if(IsPlayerConnected(i) && playerid != i && !IsPlayerNPC(i)) {
                if(IsPlayerAiming(playerid, i)) {
                    if(PlayerInfo[playerid][pMember] == 1 && GetPlayerWeapon(playerid) == 23 || PlayerInfo[playerid][pMember] == 2 && GetPlayerWeapon(playerid) == 23  || PlayerInfo[playerid][pMember] == 14 && GetPlayerWeapon(playerid) == 23 ||  PlayerInfo[playerid][pGuard] == 1 && GetPlayerWeapon(playerid) == 23) {

                            if(IsPlayerInAnyVehicle(i) || IsPlayerInAnyVehicle(i)) {
                                return 0;
                            }
//SetPlayerHealth(i, 0);             GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
		                    GetPlayerName(playerid, sendername, sizeof(sendername));
                            GetPlayerName(i, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s shoots with there Tazer which hooks onto %s and tazes him to the ground.", sendername ,giveplayer);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            TogglePlayerControllable(i, 0);
							GameTextForPlayer(i, "~p~(Tazed)", 3000, 3);
                            GameTextForPlayer(playerid, "~r~(Tazed) Complete", 3000, 3);
                            SetTimerEx("FallPlayer", 1000, 0, "d", i);
                            SetTimerEx("UnTaze",20000, 0, "d",i);
                            SetPlayerDrunkLevel(i, 3000);
                           // SetPlayerHealth(i,100);
                            Usinganim[i]  = 1;
                           	Tazed[i] = 1;
                            return 1;



                }
            }
        }
    }
    if (((newkeys & KEY_WALK && newkeys & KEY_UP) || (newkeys & KEY_WALK && newkeys & KEY_DOWN) || (newkeys & KEY_WALK && newkeys & KEY_LEFT) || (newkeys & KEY_WALK && newkeys & KEY_RIGHT))
		|| ((oldkeys & KEY_WALK && newkeys & KEY_UP) || (oldkeys & KEY_WALK && newkeys & KEY_DOWN) || (oldkeys & KEY_WALK && newkeys & KEY_LEFT) || (oldkeys & KEY_WALK && newkeys & KEY_RIGHT))
		|| ((newkeys & KEY_WALK && oldkeys & KEY_UP) || (newkeys & KEY_WALK && oldkeys & KEY_DOWN) || (newkeys & KEY_WALK && oldkeys & KEY_LEFT) || (newkeys & KEY_WALK && oldkeys & KEY_RIGHT))
		&& GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
		walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);

   }
	if(newkeys == KEY_SPRINT || newkeys == KEY_FIRE || newkeys == KEY_CROUCH)
	{
		if(RegistrationStep[playerid] == 5 || RegistrationStep[playerid] == 4)
		{
			RegistrationStep[playerid]=5;

		}

	}
	if(newkeys & KEY_FIRE && oldkeys & KEY_CROUCH && IsCbugWeapon(playerid))
	{
		if(PlayerInfo[playerid][pAdmin] <= 9)
		{
			ApplyAnimationEx(playerid, "SILENCED", "Silence_reload", 3.0, 0, 0, 0, 0, 0);

		}

	}
	if(oldkeys & KEY_FIRE && newkeys & KEY_CROUCH && IsCbugWeapon(playerid))
	{
		if(PlayerInfo[playerid][pAdmin] <= 9)
		{
			ApplyAnimationEx(playerid, "SILENCED", "Silence_reload", 3.0, 0, 0, 0, 0, 0);

		}

	}
	if(PRESSED(KEY_SPRINT))
    {
        if(PlayerisTut[playerid] >= 1)
        {
            if(PlayerisTut[playerid] == 1)
            {
			    PlayerisTut[playerid] = 2;
			    SetPlayerPos(playerid,1279.6980,-1542.4175,13.5274);
			    SetPlayerCameraPos(playerid,1299.7954,-1594.4066,35.6015);//Driving School
			    SetPlayerCameraLookAt(playerid,1279.6980,-1542.4175,13.5274);
			    format(string,sizeof(string),"Driving school ~n~You will be able to take a driving test here for 5000$");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 2)
            {
			    PlayerisTut[playerid] = 3;
       			SetPlayerPos(playerid, 1221.7010,-1328.6449,-5.00);
			    SetPlayerCameraPos(playerid, 1204.3781,-1313.3323,16.3984);
				SetPlayerCameraLookAt(playerid, 1174.7167,-1323.4485,14.5938);
			    format(string,sizeof(string),"If you're feeling sick~n~come to the hospital~n~to get healed and fixed by the EMS");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Tutorial:{FFFFFF}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 3)
            {
			    PlayerisTut[playerid] = 4;
			    SetPlayerPos(playerid,590.7849,-1243.1808,17.9521);
			    SetPlayerCameraPos(playerid,609.0580,-1219.5914,29.2979);//Bank
			    SetPlayerCameraLookAt(playerid,590.7849,-1243.1808,17.9521);
			    format(string,sizeof(string),"Bank is located here~n~You can get your paychecks by~n~going over to the money icon~n~COMMANDS:/withdraw,/savings,/deposit,/transfer");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Tutorial:{FFFFFF}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 4)
            {
			    PlayerisTut[playerid] = 5;
			    SetPlayerPos(playerid,543.6426,-1277.8851,17.2422);
			    SetPlayerCameraPos(playerid,538.1927,-1259.2106,29.4667);//Grotti Dealership
			    SetPlayerCameraLookAt(playerid,543.6426,-1277.8851,17.2422);
			    format(string,sizeof(string),"You can buy sport vehicles over here if you have enough money.~n~Command:/v.");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Tutorial:{FFFFFF}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 5)
            {
			    PlayerisTut[playerid] = 6;
			   	SetPlayerCameraPos(playerid,2125.4453,-1119.0323,37.1580);
       			SetPlayerCameraLookAt(playerid,2131.0527,-1150.2542,24.1689);
                SetPlayerPos(playerid,2130.0605,-1119.6272,25.3773);
			    format(string,sizeof(string),"Over here is the other dealership where you can buy non-sport cars.~n~/v for commands");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 6)
            {
			    PlayerisTut[playerid] = 7;
       			SetPlayerPos(playerid, 1786.1758,-1258.4976,-5.00);
			    SetPlayerCameraPos(playerid, 1779.4259,-1275.1025,15.6328);
		    	SetPlayerCameraLookAt(playerid, 1785.7263,-1296.0200,13.4213);
			    format(string,sizeof(string),"Here is where you can make advertisements ~n~So if you need to make a advertisement.~n~ Come down and /ad or /cad~n~For company advertisement. ");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Tutorial:{FFFFFF}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 7)
            {
			    PlayerisTut[playerid] = 0;
        		SetPlayerInterior(playerid, 0);
			    SetPlayerPos(playerid, 1642.2334,-2240.4983,13.4952);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerVirtualWorld(playerid, 0);
		        TogglePlayerControllable(playerid, 1);
			    TextDrawHideForPlayer(playerid,Textdraw98[playerid]);
			    OnPlayerDataSave(playerid);
			    SetCameraBehindPlayer(playerid);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Tutorial:{FFFFFF}The tutorial is now finished,good luck!.");
			    return 1;
			}
		}
	}


	if(PRESSED(LIGHT_KEY))
	{
		if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0)
		{
			if(GetPVarInt(playerid, "CopFlash") == 0)
			{
				new panels, doors, lights, tires;
				new carid = GetPlayerVehicleID(playerid);
				GetVehicleDamageStatus(carid, panels, doors, lights, tires);
				switch(GetPVarInt(playerid, "vMainOn"))
				{
					case 0:

					{
						lights = encode_lights(0, 0, 0, 0);
						SetPVarInt(playerid, "vMainOn", 1);

					}
					case 1:

					{
						lights = encode_lights(1, 1, 1, 1);
						SetPVarInt(playerid, "vMainOn", 0);

					}

				}
				UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);

			}

		}

	}

	if(PRESSED(KEY_CROUCH))
	{
		if(IsPublicService(GetPlayerVehicleID(playerid)) && GetPlayerVehicleSeat(playerid) == 0)
		{
			switch(GetPVarInt(playerid, "CopFlash"))
			{
				case 0:

				{
					KillTimer(BlinkTime[playerid]);
					BlinkTime[playerid] = SetTimerEx("vBlinker", PFLASH_RATE, 1, "i", playerid);
					SetPVarInt(playerid, "CopFlash", 1);

				}
				case 1:

				{
					KillTimer(BlinkTime[playerid]);
					new panels, doors, lights, tires;
					new carid = GetPlayerVehicleID(playerid);
					GetVehicleDamageStatus(carid, panels, doors, lights, tires);
					lights = encode_lights(1, 1, 1, 1);
					UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
					SetPVarInt(playerid, "CopFlash", 0);

				}

			}

		}

	}

	if(PRESSED(KEY_LOOK_LEFT))
	{
		if(GetPlayerVehicleSeat(playerid) == 0)
		{
			if(GetPVarInt(playerid, "vBLeft") == 0)
			{
				KillTimer(BlinkTime[playerid]);
				BlinkTime[playerid] = SetTimerEx("vBlinker", BLINK_RATE, 1, "i", playerid);
				SetPVarInt(playerid, "vBLeft", 1);
				SetPVarInt(playerid, "vBRight", 0);

			}
			else
			{
				KillTimer(BlinkTime[playerid]);
				new panels, doors, lights, tires;
				new carid = GetPlayerVehicleID(playerid);
				GetVehicleDamageStatus(carid, panels, doors, lights, tires);
				switch(GetPVarInt(playerid, "vMainOn"))
				{
					case 0:

					{
						lights = encode_lights(1, 1, 1, 1);

					}
					case 1:

					{
						lights = encode_lights(0, 0, 0, 0);

					}

				}
				UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
				SetPVarInt(playerid, "vBLeft", 0);

			}

		}

	}

	if(PRESSED(KEY_LOOK_RIGHT))
	{
		if(GetPlayerVehicleSeat(playerid) == 0)
		{
			if(GetPVarInt(playerid, "vBRight") == 0)
			{
				KillTimer(BlinkTime[playerid]);
				BlinkTime[playerid] = SetTimerEx("vBlinker", BLINK_RATE, 1, "i", playerid);
				SetPVarInt(playerid, "vBRight", 1);
				SetPVarInt(playerid, "vBLeft", 0);

			}
			else
			{
				KillTimer(BlinkTime[playerid]);
				new panels, doors, lights, tires;
				new carid = GetPlayerVehicleID(playerid);
				GetVehicleDamageStatus(carid, panels, doors, lights, tires);
				switch(GetPVarInt(playerid, "vMainOn"))
				{
					case 0:

					{
						lights = encode_lights(1, 1, 1, 1);

					}
					case 1:

					{
						lights = encode_lights(0, 0, 0, 0);

					}

				}
				UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
				SetPVarInt(playerid, "vBRight", 0);


			}

		}

		return 1;

	}

	else if(newkeys == KEY_SPRINT)
	{

		if(BenchPressTime[playerid] > 0)
		{
		    PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
		}
        else if(BenchPresses[playerid] > 0)
        {
  	    if(BenchPresses[playerid] >= 1 && BenchPresses[playerid] <= 99 && PlayerInfo[playerid][IsUsingWeight] == 1 && IsInMovingTime[playerid] == 0)
		{

	        PlayerInfo[playerid][pPower]+=5.000000;
	        TextDrawDestroy(MovingBox[playerid]);
	        MovingBox[playerid] = TextDrawCreate(PlayerInfo[playerid][pPower], 182.000000, "~n~");
			TextDrawBackgroundColor(MovingBox[playerid], 255);
			TextDrawFont(MovingBox[playerid], 1);
			TextDrawLetterSize(MovingBox[playerid], 0.900000, 0.499999);
			TextDrawColor(MovingBox[playerid], -1717986817);
			TextDrawSetOutline(MovingBox[playerid], 0);
			TextDrawSetProportional(MovingBox[playerid], 1);
			TextDrawSetShadow(MovingBox[playerid], 1);
			TextDrawUseBox(MovingBox[playerid], 1);
			TextDrawBoxColor(MovingBox[playerid], -1);
			TextDrawTextSize(MovingBox[playerid], 502.000000, 0.000000);
			TextDrawShowForPlayer(playerid,MovingBox[playerid]);
	        if(PlayerInfo[playerid][pPower] >= 586.000000)
	        {
	            ApplyAnimation(playerid,"benchpress","gym_bp_up_A", 4.0, 0, 0, 0, 1, 0);SetTimerEx("DownObject",2900,false,"u",playerid);
	            IsInMovingTime[playerid] = 1;
	            PlayerInfo[playerid][pReps]+=1;
	            TextDrawDestroy(RepsText[playerid]);
	            format(string,sizeof(string),"Reps: %d",PlayerInfo[playerid][pReps]);
	            RepsText[playerid] = TextDrawCreate(520.000000, 200.000000, string);
				TextDrawBackgroundColor(RepsText[playerid], 255);
				TextDrawFont(RepsText[playerid], 2);
				TextDrawLetterSize(RepsText[playerid], 0.500000, 1.000000);
				TextDrawColor(RepsText[playerid], -1);
				TextDrawSetOutline(RepsText[playerid], 1);
				TextDrawSetProportional(RepsText[playerid], 1);
				TextDrawShowForPlayer(playerid,RepsText[playerid]);
				}
				else
				{
				if(BenchPresses[playerid] >= 99 && PlayerInfo[playerid][IsUsingWeight] == 1 && IsInMovingTime[playerid] == 0)
				{
				ApplyAnimation(playerid,"benchpress","gym_bp_getoff", 4.0, 0, 0, 1, 1, 1);SetTimerEx("GetUp",2900,false,"u",playerid);
		    	KillTimer(ReduceTimer[playerid]);
		    	PlayerInfo[playerid][pPower] = 506.000000;
		   	 	PlayerInfo[playerid][pReps] = 0;
		    	IsInMovingTime[playerid] = 0;
		    	PlayerInfo[playerid][IsUsingWeight] = 0;
		    	TextDrawHideForPlayer(playerid,RepsText[playerid]);
		    	TextDrawHideForPlayer(playerid,Box1[playerid]);
		    	TextDrawHideForPlayer(playerid,Box2[playerid]);
		    	TextDrawHideForPlayer(playerid,MovingBox[playerid]);
		    	SetCameraBehindPlayer(playerid);
			    SetTimerEx("BenchPressFinish", 7000, false, "i", playerid);
				}
	           }
			}
		}
	}
	else if(newkeys & KEY_FIRE)
	{
		new wep = GetPlayerWeapon(playerid);
		if(wep == 38)
		{
			if(PlayerInfo[playerid][pAdmin] <= 9)
			{
				RemovePlayerWeaponEx(playerid, wep);
				ApplyAnimationEx(playerid, "SILENCED", "Silence_reload", 3.0, 0, 0, 0, 0, 0);

			}

		}
	else if(BenchPresses[playerid] > 0 && PlayerInfo[playerid][IsUsingWeight] == 1 && IsInMovingTime[playerid] == 0)
		{

	    	ApplyAnimation(playerid,"benchpress","gym_bp_getoff", 4.0, 0, 0, 1, 1, 1);SetTimerEx("GetUp",2900,false,"u",playerid);
	    	KillTimer(ReduceTimer[playerid]);
	    	PlayerInfo[playerid][pPower] = 506.000000;
	   	 	PlayerInfo[playerid][pReps] = 0;
	    	IsInMovingTime[playerid] = 0;
	    	PlayerInfo[playerid][IsUsingWeight] = 0;
	    	TextDrawHideForPlayer(playerid,RepsText[playerid]);
	    	TextDrawHideForPlayer(playerid,Box1[playerid]);
	    	TextDrawHideForPlayer(playerid,Box2[playerid]);
	    	TextDrawHideForPlayer(playerid,MovingBox[playerid]);
	    	SetCameraBehindPlayer(playerid);
	    	SetTimerEx("BenchPressFinish", 7000, false, "i", playerid);
		}



/*	else if(newkeys == KEY_JUMP)
	{
		if(IsPlayerConnected(playerid))
		{
			if(VehAsk[playerid] == 0)
			{
				return 1;

			}
			if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
			{
				return 1;

			}
			if (IsNotAEngineCar(idcar))
			{
				return 1;

			}
			if(idcar >= 135 && idcar <= 154)
			{
				if(HireCar[playerid] != idcar)
				{
					return 1;

				}

			}
			if(idcar >= 1 && idcar <= 9)
			{
				if(HireCar[playerid] != idcar)
				{
					return 1;

				}

			}
			if(IsAnOwnableCar(idcar))
			{
				if(PlayerInfo[playerid][pCarkey] == VehicleOwned[idcar])
				{

				}
				else if(PlayerInfo[playerid][pCarkey2] == VehicleOwned[idcar])
				{

				}
				else if(PlayerInfo[playerid][pCarkey3] == VehicleOwned[idcar])
				{

				}
				else
				{
					return 1;
				}

			}
			if(ReduceTime[playerid] > 0)
			{
				format(string, sizeof(string), " You need to wait %d seconds to type this command.", ReduceTime[playerid]);
				SendClientMessage(playerid, COLOR_GREY, string);
				return 1;

			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			GiveNameSpace(sendername);
			if(PlayerInfo[playerid][pMaskUse] == 1)
			{
				format(sendername, sizeof(sendername), "[Mask_%d_38]", RandMask[playerid]);
			}
			if (VehicleEngine[idcar] == 0)
			{
				format(string, sizeof(string), "* %s spins the %s's key into the ignition and turns on the engine.", sendername, VehicleName[GetVehicleModel(idcar)-400]);
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				new RandomStart;
				RandomStart = random(4);
				switch(RandomStart)
				{
					case 0,1,2:

					{
						if(VehAsk[playerid] == 1)
						{
							VehAsk[playerid] = 0;
							TogglePlayerControllable(playerid,true);

						}
						VehicleEngine[idcar] = 1;
						format(string, sizeof(string), "* %s engine starts (( %s ))", VehicleName[GetVehicleModel(idcar)-400], sendername);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

					}
					case 3:

					{
						format(string, sizeof(string), "* %s engine does not start (( %s ))", VehicleName[GetVehicleModel(idcar)-400], sendername);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						ReduceTime[playerid] = 3;

					}

				}

			}

		}

	}*/
	else if(((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE)) || ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE)) ||  (newkeys & KEY_FIRE))
	{
	    if(IsPlayerAiming(playerid))
	    {
			if(GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 30 || GetPlayerWeapon(playerid) == 31 && GetPlayerAmmo(playerid) > 1)
			{
				for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(i == playerid) continue;
					if(IsPlayerConnected(i))
					{
						if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
						{
						    if(IsPlayerAimingTargetBodyPart(playerid, i, 1)) // BODY_PART_HEAD
						    { DoDamage(playerid, i, 1, GetPlayerWeapon(playerid)); }
						    else if(IsPlayerAimingTargetBodyPart(playerid, i, 2)) // BODY_PART_TORSO
						    { DoDamage(playerid, i, 2, GetPlayerWeapon(playerid)); }
						    else if(IsPlayerAimingTargetBodyPart(playerid, i, 3)) // BODY_PART_LEGS
						    { DoDamage(playerid, i, 3, GetPlayerWeapon(playerid)); }
						}
					}
				}
			}
		}
	}
	return 1;
}

	else if(newkeys == KEY_SECONDARY_ATTACK)
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
			if(VehAsk[playerid] == 1)
			{
				VehAsk[playerid] = 0;
				TogglePlayerControllable(playerid,true);
				RemovePlayerFromVehicle(playerid);
				}

			}

		}
	   }
Reply
#4

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	SetTimerEx("CarRadios",1000,false,"i",playerid);
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
      new engine,lights,alarm,doors,bonnet,boot,objective,panels,tires;
     // 	cOnPlayerStateChange(playerid, newstate, oldstate);
    //new name[MAX_PLAYER_NAME];
    //GetPlayerName(playerid, name, sizeof(name));
    new string[128];
	new vehi = GetPlayerVehicleID(playerid);




    if(newstate == PLAYER_STATE_ONFOOT) {
        TelePos[playerid][0] = 0.0;
        TelePos[playerid][1] = 0.0;
        if(DriverTest[playerid] > 0) {
            DisablePlayerCheckpoint(playerid);
            gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
            DriverTest[playerid] = 0;
            SendClientMessage(playerid,COLOR_LIGHTRED,"[INFO]: You left Your car, so you failed the test.");

        }
        else if(VehAsk[playerid] == 1) {
            VehAsk[playerid] = 0;
            TogglePlayerControllable(playerid,true);

        }
        else if(SeatBelt[playerid] == 1) {
            SeatBelt[playerid] = 0;

        }

    }




 	else if(newstate == PLAYER_STATE_ONFOOT)
	{
		if(PayForTaxi[playerid] > 0 && Driver[playerid] < 9999)
		{


		    format(string,sizeof(string),"You left the taxi,you paid %d $ to the driver!",PayForTaxi[playerid]);
		    SendClientMessage(playerid,COLOR_WHITE,string);
		    GivePlayerMoney(Driver[playerid],PayForTaxi[playerid]);
		    GivePlayerMoney(playerid,-PayForTaxi[playerid]);
		    PayForTaxi[playerid] = 0;
		    GetFromTaxi[Driver[playerid]] = 0;
		    Accepted[playerid] = 9999;
		    TrTime[playerid] = 0;
		    TrTime[Driver[playerid]] = 0;
		}
	}
	    new newcar = GetPlayerVehicleID(playerid);



     if(newstate == PLAYER_STATE_DRIVER) {
//SetTimerEx("CarRadios", 1000, false, "i", playerid);

        if(AdminDuty[playerid] == 1) {

            new name[MAX_PLAYER_NAME];
            strcpy(name,CarInfo[VehicleOwned[newcar]][cOwner],MAX_PLAYER_NAME);
            //GiveNameSpace(name);
            //format(string,sizeof(string),"[INFO]: Vehicle registered to %s",name);
            return 1;

        }
   // SetTimerEx("CarRadios", 1000, false, "i", playerid);
        if(VehicleEngine[newcar] == 0) {

            if(!IsNotAEngineCar(newcar)) {
            //new engine,lights,alarm,doors,bonnet,boot,objective,panels,tires;
                GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
                SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                GetVehicleDamageStatus(newcar,panels,doors,lights,tires);
		        UpdateVehicleDamageStatus(newcar, panels, doors, 5, tires);
                VehAsk[playerid] = 1;
                SendClientMessage(playerid, COLOR_GREEN, "Engine is not started (/engine)");
                SendClientMessage(playerid, COLOR_GREEN, "If it is a faction vehicle (/fengine)");
            }

        }



        if(newstate == PLAYER_STATE_DRIVER) {
       // SetTimerEx("CarRadios", 1000, false, "i", playerid);

            new carid = GetPlayerVehicleID(playerid);
            GetVehicleDamageStatus(carid, panels, doors, lights, tires);
            lights = encode_lights(1, 1, 1, 1);
            SetPVarInt(playerid, "vMainOn", 0);
            UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);

        }

       else if(newstate == PLAYER_STATE_ONFOOT) {

            KillTimer(BlinkTime[playerid]);
            SetPVarInt(playerid, "CopFlash", 0);

        }
        if(PlayerInfo[playerid][pDrivLic] == 0) {

            SendClientMessage(playerid,COLOR_LIGHTRED,"You don't have a driving license! Pass a driving test to get one");
        }


            // new newcar = GetPlayerVehicleID(playerid);
        CarEnter[playerid] = 1;
        //SetTimerEx("CarRadios", 1000, false, "i", playerid);
        if(IsAnOwnableCar(newcar)) {
          //  new name[MAX_PLAYER_NAME];
        //    strcpy(name,CarInfo[VehicleOwned[newcar]][cOwner],MAX_PLAYER_NAME);
          //  GiveNameSpace(name);
            //format(string,sizeof(string),"[INFO]: Vehicle registered to %s",name);
            //SendClientMessage(playerid, 0x8080FF96, string);
            if (!IsNotAEngineCar(newcar)) {
                if(VehicleEngine[newcar] == 0) {
                    if(PlayerInfo[playerid][pCarkey] == VehicleOwned[newcar]) {
                        format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        return 1;
                    }
                    else if(PlayerInfo[playerid][pCarkey2] == VehicleOwned[newcar]) {
                        format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        return 1;
                    }
                    else if(PlayerInfo[playerid][pCarkey3] == VehicleOwned[newcar]) {
                        format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        return 1;
                    }
                    else {
                        TogglePlayerControllable(playerid,false);
                        VehAsk[playerid] = 2;
                      //  SendClientMessage(playerid,COLOR_GRAD3,"[INFO]: You can hotwire this vehicle using /engine if you have a toolkit, Or you can /exit.");

                    }

                }

            }
            if(VehicleEngine[newcar] == 1) {
                if(PlayerInfo[playerid][pCarkey] == VehicleOwned[newcar]) {
                    format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    return 1;
                }
                else if(PlayerInfo[playerid][pCarkey2] == VehicleOwned[newcar]) {
                    format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    return 1;
                }
                else if(PlayerInfo[playerid][pCarkey3] == VehicleOwned[newcar]) {
                    format(string,sizeof(string),"Welcome to your %s",VehicleName[GetVehicleModel(newcar)-400]);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    return 1;
                }
                else {
                    SendClientMessage(playerid,COLOR_GREEN,"Engine is on");

                }

            }

        }



                if(CarAlarm[vehi][caalarm] <= 2 && VehAsk[playerid] == 2 && IsAnOwnableCar(vehi)) {


                    //format(string,sizeof(string),"5-STAR:Vehicle %s alarm is activated",VehicleNames[GetVehicleModel(vehi)-400]);
                   // SendClientMessage(playerid, 0xE7D5ADFF, string);
                    //SetVehicleParamsForPlayer(vehi, playerid, 1, 0);
                    format(string, sizeof(string), "*[Vehicle alarm]:BEEP! BEEP! BEEP! BEEP!");
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    SetPVarInt(playerid, "VehON", 0);
                    AlarmTime[playerid] = SetTimerEx("Alarm", FLASH_TIME, 1, "i", playerid);
                    Stop[playerid] = SetTimerEx("Chill",SHUTDOWN,false,"i",playerid);





                }
                if(CarAlarm[vehi][caalarm] >= 4 &&  VehAsk[playerid] == 2 && IsAnOwnableCar(vehi)) {


                    new name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, name, sizeof(name));
                    new st[256];
              		//new Float:VPosX,Float:VPosY,Float:VPosZ;
				    //GetVehiclePos(key1[playerid],VPosX,VPosY,VPosZ);
				  //  SetVehicleParamsForPlayer(vehi, i, 1, 0);
                  //  SetVehicleParamsForPlayer(vehi, playerid, 1, 0);
                    SetTimerEx("VehicleA",1000, false, "i", playerid);
                    format(string, sizeof(string), "*[Vehicle alarm]:BEEP! BEEP! BEEP! BEEP!");
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    format(string,sizeof(string),"SMS:Vehicle %s alarm is activated,Sender: MOLE (555)",VehicleNames[GetVehicleModel(vehi)-400]);
                    SendClientMessage(playerid, 0xE7D5ADFF, string);
					//iVehicleObjective[vehi][0] = 1; //Marker
					//iVehicleObjective[vehi][1] = 0; //Door Lock
                    //CarLabel5 = Create3DTextLabel("Vehicle Alarm is on!" ,COLOR_YELLOW,VPosX,VPosY,VPosY+3,15.0,0);
                    //Attach3DTextLabelToVehicle(CarLabel5,key1[playerid],0.0, 0.0, 0.0);
                     new vZone[MAX_ZONE_NAME], pZone[MAX_ZONE_NAME];
                    GetVehicleZone(vehi, vZone, MAX_ZONE_NAME); GetPlayer2DZone(playerid, pZone, MAX_ZONE_NAME);
                    format(st, sizeof(st), "[Vehicle Alarm] %s located in %s.",VehicleNames[GetVehicleModel(vehi)-400]);
                    SendFamilyMessage(1,COLOR_LIGHTBLUE, st);
                    SetPVarInt(playerid, "VehON", 0);
                    AlarmTime[playerid] = SetTimerEx("Alarm", FLASH_TIME, 1, "i", playerid);
                    Stop[playerid] = SetTimerEx("Chill",SHUTDOWN,false,"i",playerid);

                    return 1;




                }
	            new Float:x,Float:y,Float:z;
				GetPlayerPos(playerid, x, y, z);
				if(IsAGasVeh(newcar))
				{
		    	if(PlayerInfo[playerid][pJob] != 3)
		    	{
			    SendClientMessage(playerid,COLOR_WHITE,"[Gas Vehicle]Your not a Gas Deliver!");
			    RemovePlayerFromVehicle(playerid);
			    return 1;
			}
			SendClientMessage(playerid,COLOR_GREEN,"Welcome to the Gas Deliver Van,use /gas to buy some gas.");
			format(string,sizeof(string),"Currently Vehicle Gas: %d",VGas[newcar]);
			SendClientMessage(playerid,COLOR_GREEN,string);
			PlayerPlaySound(playerid, 1055, x,y,z);
		}


else if(IsACopCar(newcar) && !(IsAnFbiCar(newcar)&&PlayerInfo[playerid][pMember]==2))
{
    if(PlayerInfo[playerid][pMember] != 1) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(IsASheriffCar(newcar))
{
    if(PlayerInfo[playerid][pMember] != 14) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(IsAnFbiCar(newcar))
{
    if(PlayerInfo[playerid][pMember] != 2) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(IsAGovCar(newcar))
{
    if(PlayerInfo[playerid][pMember] != 3) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(IsAnAmbulance(newcar))
{
    if(PlayerInfo[playerid][pMember] != 4) {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(IsAPizzabike(newcar))
{
    if(PlayerInfo[playerid][pJob] != 17) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this bike.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else {
        SendClientMessage(playerid, COLOR_GRAD3, "Type /startpizza to begin a pizza mission.");

    }

}


if(IsABus(newcar))
{
    if(PlayerInfo[playerid][pJob] != 14) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this bus.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else {
        if(JobDelay[playerid] > 0) {
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid,true);
            VehAsk[playerid] = 0;
            SendClientMessage(playerid, COLOR_GREY," You need to wait for Your last route time to reduce !");

        }
        else if(BusRoute[playerid] == 0) {
            ShowMenuForPlayer(BusRoutesM, playerid);
            BusRoute[playerid] = 1;
            gPlayerCheckpointStatus[playerid] = CHECKPOINT_BUSROUTE;
            BusRouteS[playerid] = 0;

        }

    }

}


else if(IsATowcar(newcar))
{
    if(PlayerInfo[playerid][pJob] != 7) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(newcar >= 135 && newcar <= 154)
{
    if (HireCar[playerid] != newcar) {
       new strins[256];
		format(strins, sizeof(strins), "You can rent this vehicle for $%d\nPlease Remember to /unrentvehicle when finished\nIf you rent this vehicle you will be able to /engine",SBizzInfo[0][sbEntranceCost]);
		ShowPlayerDialog(playerid,DACCT30,DIALOG_STYLE_MSGBOX,"Enterprise Rent",strins,"Rent","Exit");
        GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        VehAsk[playerid] = 1;

    }

}


else if(newcar >= 203 && newcar <= 205)
{
    if (HireCar[playerid] != newcar) {
        new strins[256];
		format(strins, sizeof(strins), "You can rent this vehicle for $%d\nPlease Remember to /unrentvehicle when finished\nIf you rent this vehicle you will be able to /engine",SBizzInfo[0][sbEntranceCost]);
		ShowPlayerDialog(playerid,DACCT30,DIALOG_STYLE_MSGBOX,"Enterprise Rent",strins,"Rent","Exit");
        GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        VehAsk[playerid] = 1;

    }

}


else if(newcar >= 194 && newcar <= 196)
{
   // format(string, sizeof(string), "Vehicle rental:Rent a vehicle for $%d /rentvehicle",SBizzInfo[1][sbEntranceCost]);
   // SendClientMessage(playerid, COLOR_WHITE,string);
   // SendClientMessage(playerid, COLOR_GREEN,"Rent a vehicle and you will be able to /rlock vehice.");
     new strins[256];
    format(strins, sizeof(strins), "You can rent this vehicle for $%d\nPlease Remember to /unrentvehicle when finished\nIf you rent this vehicle you will be able to /engine",SBizzInfo[0][sbEntranceCost]);
    ShowPlayerDialog(playerid,DACCT30,DIALOG_STYLE_MSGBOX,"Enterprise Rent",strins,"Rent","Exit");
    GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    VehAsk[playerid] = 1;

}


else if(newcar >= 1 && newcar <= 9)
{
    if (HireCar[playerid] != newcar) {
      //  format(string, sizeof(string), "Vehicle rental:Rent a vehicle for $%d /rentvehicle",SBizzInfo[1][sbEntranceCost]);
       // SendClientMessage(playerid, COLOR_WHITE,string);
      //  SendClientMessage(playerid, COLOR_GREEN,"Rent a vehicle and you will be able to /rlock vehice.");
        new strins[256];
        format(strins, sizeof(strins), "You can rent this vehicle for $%d\nPlease Remember to /unrentvehicle when finished\nIf you rent this vehicle you will be able to /engine",SBizzInfo[0][sbEntranceCost]);
        ShowPlayerDialog(playerid,DACCT30,DIALOG_STYLE_MSGBOX,"Enterprise Rent",strins,"Rent","Exit");
        GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        VehAsk[playerid] = 1;

    }

}


else if(newcar >= 112 && newcar <= 130)
{
    if (HireCar[playerid] != newcar) {

      //  format(string, sizeof(string), "Vehicle rental:Rent a vehicle for $%d /rentcar",SBizzInfo[0][sbEntranceCost]);
      //  SendClientMessage(playerid, COLOR_WHITE,string);
       // SendClientMessage(playerid, COLOR_GREEN,"Rent a vehicle and you will be able to /rlock vehice.");
        new strins[256];
        format(strins, sizeof(strins), "You can rent this vehicle for $%d\nPlease Remember to /unrentcar when finished\nIf you rent this vehicle you will be able to /engine",SBizzInfo[0][sbEntranceCost]);
        ShowPlayerDialog(playerid,DACCT29,DIALOG_STYLE_MSGBOX,"Enterprise Rent",strins,"Rent","Exit");
        VehAsk[playerid] = 1;
        GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(newcar,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);

    }

}


else if(newcar >= 84 && newcar <= 87)
{
// Race Cars
    if(GetPlayerInterior(playerid) != 7) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(newcar == 131 || newcar == 132 || newcar == 133 || newcar == 134)
{
    if(DriverTest[playerid] == 0) {
        SendClientMessage(playerid,COLOR_WHITE,"License exam: Try to pass license exam /licenseexam,if you succeed license cost 5000$");
        SendClientMessage(playerid,COLOR_WHITE,"If you don't want to take exam type /exit");
        TogglePlayerControllable(playerid,false);
        VehAsk[playerid] = 1;

    }
}


else if(newcar >= 61 && newcar <= 70)
{
// Taxi lock
    if(PlayerInfo[playerid][pMember] != 7) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(newcar >= 71 && newcar <= 73)
{
// News Van
    if(PlayerInfo[playerid][pMember] != 5) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }

}


else if(newcar >= 78 && newcar <= 95)
{
// Unused
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
    TogglePlayerControllable(playerid,true);
    VehAsk[playerid] = 0;

}


else if(newcar >= 159 && newcar <= 161)
{
// Unused
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
    TogglePlayerControllable(playerid,true);
    VehAsk[playerid] = 0;

}


else if(IsASweep(newcar))
{
  CheckP[playerid] = 0;
// Street Sweeper
    if(PlayerInfo[playerid][pJob] != 21) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else {
        if(JobDelay[playerid] > 0) {
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid,true);
            VehAsk[playerid] = 0;
            SendClientMessage(playerid, COLOR_GREY," You need to wait for Your last route time to reduce !");

        }
        else if(StreetSweep[playerid] == 0) {
          CheckP[playerid] = 0;
            ShowMenuForPlayer(StartSweepM, playerid);
            StreetSweep[playerid] = 1;
            gPlayerCheckpointStatus[playerid] = CHECKPOINT_SWEEP;

        }

    }

}


else if(newcar >= 155 && newcar <= 158)
{
// Harvester
   CheckP[playerid] = 0;
    if(PlayerInfo[playerid][pJob] != 18) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else {
        if(JobDelay[playerid] > 0) {
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid,true);
            VehAsk[playerid] = 0;
            SendClientMessage(playerid, COLOR_GREY," You need to wait for your last route time to reduce !");

        }
        else if(Harvesting[playerid] == 0) {
            SendClientMessage(playerid,COLOR_GRAD3,"[INFO]: Head to the checkpoint to begin.");
            Harvesting[playerid] = 1;
            gPlayerCheckpointStatus[playerid] = CHECKPOINT_HARVEST;
            SetPlayerCheckpoint(playerid,-376.6393,-1433.9570,25.7266,5.0);

        }

    }

}


else if(newcar >= 96 && newcar <= 101)
{
// Garbage Truck
    if(PlayerInfo[playerid][pJob] != 16) {
      CheckP[playerid] = 0;
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else {
        if(JobDelay[playerid] > 0) {
          CheckP[playerid] = 0;
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid,true);
            VehAsk[playerid] = 0;
            SendClientMessage(playerid, COLOR_GREY," You need to wait for your last route time to reduce !");

        }
        else if(GarbageRoute[playerid] == 0) {
          CheckP[playerid] = 0;
            SendClientMessage(playerid,COLOR_GRAD3,"[INFO]: Head to the checkpoint to begin.");
            GarbageRoute[playerid] = 1;
            SetPlayerTrash(playerid,2382.4307,-1937.4563,14.0951,187.187,5.0);
            gPlayerCheckpointStatus[playerid] = CHECKPOINT_GARBAGE;

        }

    }

}


else if(newcar >= 108 && newcar <= 111)
{
  CheckP[playerid] = 0;
// Trucker
    if(PlayerInfo[playerid][pJob] != 24) {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, COLOR_GREY,"You don't have keys to this vehicle.");
        TogglePlayerControllable(playerid,true);
        VehAsk[playerid] = 0;

    }
    else if(ProdMission[playerid] == 0) {
        SendClientMessage(playerid,COLOR_GRAD3,"[INFO]: Head to the checkpoint to begin.");
        gPlayerCheckpointStatus[playerid] = CHECKPOINT_PROD1;
        ProdMission[playerid] = 1;
        new RandomWeth;
        RandomWeth = random(3);
        switch(RandomWeth) {
            case 0:

                {
                    SetPlayerCheckpoint(playerid,2852.5193,-1532.5118,11.0938,5.0);
                      CheckP[playerid] = 0;

                }
            case 1:

                {
                    SetPlayerCheckpoint(playerid,1360.8496,-1643.5159,13.3828,5.0);
                      CheckP[playerid] = 0;

                }
            case 2:

                {
                    SetPlayerCheckpoint(playerid,2164.8250,-2271.3850,13.3368,5.0);
                      CheckP[playerid] = 0;

                }

        }

    }

}


}
else if(newstate == PLAYER_STATE_SPAWNED)
{
    TelePos[playerid][0] = 0.0;
    TelePos[playerid][1] = 0.0;

}

}
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	new string[128];
	new sendername[MAX_PLAYER_NAME];
    new giveplayer[MAX_PLAYER_NAME];
	if (IsAtPGarbage(playerid))
        {
		if(newkeys == KEY_CROUCH)
		{
			GetPlayerName(playerid, sendername, sizeof(sendername));
			GiveNameSpace(sendername);
			if(PlayerInfo[playerid][pMaskUse] == 1)
			{
				format(sendername, sizeof(sendername), "[Mask_%d_38]", RandMask[playerid]);
			}
			new dice = random(15)+1;
			ClearAnimations(playerid);
			if(dice == 1)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a dirty Burger Shot Hamburger.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a dirty old half eaten hamburger, Throw it away!");

			}
			else if(dice == 2)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a used condom.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found s used condom!");

			}
			else if(dice == 3)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a hotdog.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a hotdog!");
				new Float:PlayersArmour;
				GetPlayerHealth(playerid, PlayersArmour);
				SetPlayerHealthExs(playerid, PlayersArmour + 5.0);

			}
			else if(dice == 4)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a Banana Peal.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a Banana Peal");

			}
			else if(dice == 5)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a dead rat.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a dead rat!");

			}
			else if(dice == 6)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a used dildo.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a dildo!");
				GivePlayerWeaponEx(playerid,10,1);

			}
			else if(dice == 7)
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds a broken pool cue.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found a pool cue!");
				GivePlayerWeaponEx(playerid,7,1);

			}
			else
			{
				format(string, sizeof(string), "* %s leans over and picks threw the garbage and finds nothing of value.", sendername);
				SendClientMessage(playerid,COLOR_GRAD3,"You found nothing!");

			}
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			// Place Bomb
			ApplyAnimationEx(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
			return 1;

		}

	}

      if(((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE)) || ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE)) ||  (newkeys & KEY_FIRE)) {
   	    for(new i = 0; i < GetMaxPlayers(); i++)
    	{
            if(IsPlayerConnected(i) && playerid != i && !IsPlayerNPC(i)) {
                if(IsPlayerAiming(playerid, i)) {
                    if(PlayerInfo[playerid][pMember] == 1 && GetPlayerWeapon(playerid) == 23 || PlayerInfo[playerid][pMember] == 2 && GetPlayerWeapon(playerid) == 23  || PlayerInfo[playerid][pMember] == 14 && GetPlayerWeapon(playerid) == 23 ||  PlayerInfo[playerid][pGuard] == 1 && GetPlayerWeapon(playerid) == 23) {

                            if(IsPlayerInAnyVehicle(i) || IsPlayerInAnyVehicle(i)) {
                                return 0;
                            }
//SetPlayerHealth(i, 0);             GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
		                    GetPlayerName(playerid, sendername, sizeof(sendername));
                            GetPlayerName(i, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* %s shoots with there Tazer which hooks onto %s and tazes him to the ground.", sendername ,giveplayer);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            TogglePlayerControllable(i, 0);
							GameTextForPlayer(i, "~p~(Tazed)", 3000, 3);
                            GameTextForPlayer(playerid, "~r~(Tazed) Complete", 3000, 3);
                            SetTimerEx("FallPlayer", 1000, 0, "d", i);
                            SetTimerEx("UnTaze",20000, 0, "d",i);
                            SetPlayerDrunkLevel(i, 3000);
                           // SetPlayerHealth(i,100);
                            Usinganim[i]  = 1;
                           	Tazed[i] = 1;
                            return 1;



                }
            }
        }
    }
    if (((newkeys & KEY_WALK && newkeys & KEY_UP) || (newkeys & KEY_WALK && newkeys & KEY_DOWN) || (newkeys & KEY_WALK && newkeys & KEY_LEFT) || (newkeys & KEY_WALK && newkeys & KEY_RIGHT))
		|| ((oldkeys & KEY_WALK && newkeys & KEY_UP) || (oldkeys & KEY_WALK && newkeys & KEY_DOWN) || (oldkeys & KEY_WALK && newkeys & KEY_LEFT) || (oldkeys & KEY_WALK && newkeys & KEY_RIGHT))
		|| ((newkeys & KEY_WALK && oldkeys & KEY_UP) || (newkeys & KEY_WALK && oldkeys & KEY_DOWN) || (newkeys & KEY_WALK && oldkeys & KEY_LEFT) || (newkeys & KEY_WALK && oldkeys & KEY_RIGHT))
		&& GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
		walktime[playerid] = SetTimerEx("WalkAnim",200,0,"d",playerid);

   }
	if(newkeys == KEY_SPRINT || newkeys == KEY_FIRE || newkeys == KEY_CROUCH)
	{
		if(RegistrationStep[playerid] == 5 || RegistrationStep[playerid] == 4)
		{
			RegistrationStep[playerid]=5;

		}

	}
	if(newkeys & KEY_FIRE && oldkeys & KEY_CROUCH && IsCbugWeapon(playerid))
	{
		if(PlayerInfo[playerid][pAdmin] <= 9)
		{
			ApplyAnimationEx(playerid, "SILENCED", "Silence_reload", 3.0, 0, 0, 0, 0, 0);

		}

	}
	if(oldkeys & KEY_FIRE && newkeys & KEY_CROUCH && IsCbugWeapon(playerid))
	{
		if(PlayerInfo[playerid][pAdmin] <= 9)
		{
			ApplyAnimationEx(playerid, "SILENCED", "Silence_reload", 3.0, 0, 0, 0, 0, 0);

		}

	}
	if(PRESSED(KEY_SPRINT))
    {
        if(PlayerisTut[playerid] >= 1)
        {
            if(PlayerisTut[playerid] == 1)
            {
			    PlayerisTut[playerid] = 2;
			    SetPlayerPos(playerid,1279.6980,-1542.4175,13.5274);
			    SetPlayerCameraPos(playerid,1299.7954,-1594.4066,35.6015);//Driving School
			    SetPlayerCameraLookAt(playerid,1279.6980,-1542.4175,13.5274);
			    format(string,sizeof(string),"Driving school ~n~You will be able to take a driving test here for 5000$");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 2)
            {
			    PlayerisTut[playerid] = 3;
       			SetPlayerPos(playerid, 1221.7010,-1328.6449,-5.00);
			    SetPlayerCameraPos(playerid, 1204.3781,-1313.3323,16.3984);
				SetPlayerCameraLookAt(playerid, 1174.7167,-1323.4485,14.5938);
			    format(string,sizeof(string),"If you're feeling sick~n~come to the hospital~n~to get healed and fixed by the EMS");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Tutorial:{FFFFFF}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 3)
            {
			    PlayerisTut[playerid] = 4;
			    SetPlayerPos(playerid,590.7849,-1243.1808,17.9521);
			    SetPlayerCameraPos(playerid,609.0580,-1219.5914,29.2979);//Bank
			    SetPlayerCameraLookAt(playerid,590.7849,-1243.1808,17.9521);
			    format(string,sizeof(string),"Bank is located here~n~You can get your paychecks by~n~going over to the money icon~n~COMMANDS:/withdraw,/savings,/deposit,/transfer");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Tutorial:{FFFFFF}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 4)
            {
			    PlayerisTut[playerid] = 5;
			    SetPlayerPos(playerid,543.6426,-1277.8851,17.2422);
			    SetPlayerCameraPos(playerid,538.1927,-1259.2106,29.4667);//Grotti Dealership
			    SetPlayerCameraLookAt(playerid,543.6426,-1277.8851,17.2422);
			    format(string,sizeof(string),"You can buy sport vehicles over here if you have enough money.~n~Command:/v.");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Tutorial:{FFFFFF}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 5)
            {
			    PlayerisTut[playerid] = 6;
			   	SetPlayerCameraPos(playerid,2125.4453,-1119.0323,37.1580);
       			SetPlayerCameraLookAt(playerid,2131.0527,-1150.2542,24.1689);
                SetPlayerPos(playerid,2130.0605,-1119.6272,25.3773);
			    format(string,sizeof(string),"Over here is the other dealership where you can buy non-sport cars.~n~/v for commands");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 6)
            {
			    PlayerisTut[playerid] = 7;
       			SetPlayerPos(playerid, 1786.1758,-1258.4976,-5.00);
			    SetPlayerCameraPos(playerid, 1779.4259,-1275.1025,15.6328);
		    	SetPlayerCameraLookAt(playerid, 1785.7263,-1296.0200,13.4213);
			    format(string,sizeof(string),"Here is where you can make advertisements ~n~So if you need to make a advertisement.~n~ Come down and /ad or /cad~n~For company advertisement. ");
			    TextDrawSetString(Textdraw98[playerid],string);
			    TextDrawShowForPlayer(playerid,Textdraw98[playerid]);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Tutorial:{FFFFFF}Use SPACEBAR to continue,SHIFT to go back.");
			    return 1;
			}
            if(PlayerisTut[playerid] == 7)
            {
			    PlayerisTut[playerid] = 0;
        		SetPlayerInterior(playerid, 0);
			    SetPlayerPos(playerid, 1642.2334,-2240.4983,13.4952);
		        SetCameraBehindPlayer(playerid);
		        SetPlayerVirtualWorld(playerid, 0);
		        TogglePlayerControllable(playerid, 1);
			    TextDrawHideForPlayer(playerid,Textdraw98[playerid]);
			    OnPlayerDataSave(playerid);
			    SetCameraBehindPlayer(playerid);
			    SendClientMessage(playerid,COLOR_WHITE,"{FF6633}Tutorial:{FFFFFF}The tutorial is now finished,good luck!.");
			    return 1;
			}
		}
	}


	if(PRESSED(LIGHT_KEY))
	{
		if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0)
		{
			if(GetPVarInt(playerid, "CopFlash") == 0)
			{
				new panels, doors, lights, tires;
				new carid = GetPlayerVehicleID(playerid);
				GetVehicleDamageStatus(carid, panels, doors, lights, tires);
				switch(GetPVarInt(playerid, "vMainOn"))
				{
					case 0:

					{
						lights = encode_lights(0, 0, 0, 0);
						SetPVarInt(playerid, "vMainOn", 1);

					}
					case 1:

					{
						lights = encode_lights(1, 1, 1, 1);
						SetPVarInt(playerid, "vMainOn", 0);

					}

				}
				UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);

			}

		}

	}

	if(PRESSED(KEY_CROUCH))
	{
		if(IsPublicService(GetPlayerVehicleID(playerid)) && GetPlayerVehicleSeat(playerid) == 0)
		{
			switch(GetPVarInt(playerid, "CopFlash"))
			{
				case 0:

				{
					KillTimer(BlinkTime[playerid]);
					BlinkTime[playerid] = SetTimerEx("vBlinker", PFLASH_RATE, 1, "i", playerid);
					SetPVarInt(playerid, "CopFlash", 1);

				}
				case 1:

				{
					KillTimer(BlinkTime[playerid]);
					new panels, doors, lights, tires;
					new carid = GetPlayerVehicleID(playerid);
					GetVehicleDamageStatus(carid, panels, doors, lights, tires);
					lights = encode_lights(1, 1, 1, 1);
					UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
					SetPVarInt(playerid, "CopFlash", 0);

				}

			}

		}

	}

	if(PRESSED(KEY_LOOK_LEFT))
	{
		if(GetPlayerVehicleSeat(playerid) == 0)
		{
			if(GetPVarInt(playerid, "vBLeft") == 0)
			{
				KillTimer(BlinkTime[playerid]);
				BlinkTime[playerid] = SetTimerEx("vBlinker", BLINK_RATE, 1, "i", playerid);
				SetPVarInt(playerid, "vBLeft", 1);
				SetPVarInt(playerid, "vBRight", 0);

			}
			else
			{
				KillTimer(BlinkTime[playerid]);
				new panels, doors, lights, tires;
				new carid = GetPlayerVehicleID(playerid);
				GetVehicleDamageStatus(carid, panels, doors, lights, tires);
				switch(GetPVarInt(playerid, "vMainOn"))
				{
					case 0:

					{
						lights = encode_lights(1, 1, 1, 1);

					}
					case 1:

					{
						lights = encode_lights(0, 0, 0, 0);

					}

				}
				UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
				SetPVarInt(playerid, "vBLeft", 0);

			}

		}

	}

	if(PRESSED(KEY_LOOK_RIGHT))
	{
		if(GetPlayerVehicleSeat(playerid) == 0)
		{
			if(GetPVarInt(playerid, "vBRight") == 0)
			{
				KillTimer(BlinkTime[playerid]);
				BlinkTime[playerid] = SetTimerEx("vBlinker", BLINK_RATE, 1, "i", playerid);
				SetPVarInt(playerid, "vBRight", 1);
				SetPVarInt(playerid, "vBLeft", 0);

			}
			else
			{
				KillTimer(BlinkTime[playerid]);
				new panels, doors, lights, tires;
				new carid = GetPlayerVehicleID(playerid);
				GetVehicleDamageStatus(carid, panels, doors, lights, tires);
				switch(GetPVarInt(playerid, "vMainOn"))
				{
					case 0:

					{
						lights = encode_lights(1, 1, 1, 1);

					}
					case 1:

					{
						lights = encode_lights(0, 0, 0, 0);

					}

				}
				UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
				SetPVarInt(playerid, "vBRight", 0);


			}

		}

		return 1;

	}

	else if(newkeys == KEY_SPRINT)
	{

		if(BenchPressTime[playerid] > 0)
		{
		    PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
		}
        else if(BenchPresses[playerid] > 0)
        {
  	    if(BenchPresses[playerid] >= 1 && BenchPresses[playerid] <= 99 && PlayerInfo[playerid][IsUsingWeight] == 1 && IsInMovingTime[playerid] == 0)
		{

	        PlayerInfo[playerid][pPower]+=5.000000;
	        TextDrawDestroy(MovingBox[playerid]);
	        MovingBox[playerid] = TextDrawCreate(PlayerInfo[playerid][pPower], 182.000000, "~n~");
			TextDrawBackgroundColor(MovingBox[playerid], 255);
			TextDrawFont(MovingBox[playerid], 1);
			TextDrawLetterSize(MovingBox[playerid], 0.900000, 0.499999);
			TextDrawColor(MovingBox[playerid], -1717986817);
			TextDrawSetOutline(MovingBox[playerid], 0);
			TextDrawSetProportional(MovingBox[playerid], 1);
			TextDrawSetShadow(MovingBox[playerid], 1);
			TextDrawUseBox(MovingBox[playerid], 1);
			TextDrawBoxColor(MovingBox[playerid], -1);
			TextDrawTextSize(MovingBox[playerid], 502.000000, 0.000000);
			TextDrawShowForPlayer(playerid,MovingBox[playerid]);
	        if(PlayerInfo[playerid][pPower] >= 586.000000)
	        {
	            ApplyAnimation(playerid,"benchpress","gym_bp_up_A", 4.0, 0, 0, 0, 1, 0);SetTimerEx("DownObject",2900,false,"u",playerid);
	            IsInMovingTime[playerid] = 1;
	            PlayerInfo[playerid][pReps]+=1;
	            TextDrawDestroy(RepsText[playerid]);
	            format(string,sizeof(string),"Reps: %d",PlayerInfo[playerid][pReps]);
	            RepsText[playerid] = TextDrawCreate(520.000000, 200.000000, string);
				TextDrawBackgroundColor(RepsText[playerid], 255);
				TextDrawFont(RepsText[playerid], 2);
				TextDrawLetterSize(RepsText[playerid], 0.500000, 1.000000);
				TextDrawColor(RepsText[playerid], -1);
				TextDrawSetOutline(RepsText[playerid], 1);
				TextDrawSetProportional(RepsText[playerid], 1);
				TextDrawShowForPlayer(playerid,RepsText[playerid]);
				}
				else
				{
				if(BenchPresses[playerid] >= 99 && PlayerInfo[playerid][IsUsingWeight] == 1 && IsInMovingTime[playerid] == 0)
				{
				ApplyAnimation(playerid,"benchpress","gym_bp_getoff", 4.0, 0, 0, 1, 1, 1);SetTimerEx("GetUp",2900,false,"u",playerid);
		    	KillTimer(ReduceTimer[playerid]);
		    	PlayerInfo[playerid][pPower] = 506.000000;
		   	 	PlayerInfo[playerid][pReps] = 0;
		    	IsInMovingTime[playerid] = 0;
		    	PlayerInfo[playerid][IsUsingWeight] = 0;
		    	TextDrawHideForPlayer(playerid,RepsText[playerid]);
		    	TextDrawHideForPlayer(playerid,Box1[playerid]);
		    	TextDrawHideForPlayer(playerid,Box2[playerid]);
		    	TextDrawHideForPlayer(playerid,MovingBox[playerid]);
		    	SetCameraBehindPlayer(playerid);
			    SetTimerEx("BenchPressFinish", 7000, false, "i", playerid);
				}
	           }
			}
		}
	}
	else if(newkeys & KEY_FIRE)
	{
		new wep = GetPlayerWeapon(playerid);
		if(wep == 38)
		{
			if(PlayerInfo[playerid][pAdmin] <= 9)
			{
				RemovePlayerWeaponEx(playerid, wep);
				ApplyAnimationEx(playerid, "SILENCED", "Silence_reload", 3.0, 0, 0, 0, 0, 0);

			}

		}
	else if(BenchPresses[playerid] > 0 && PlayerInfo[playerid][IsUsingWeight] == 1 && IsInMovingTime[playerid] == 0)
		{

	    	ApplyAnimation(playerid,"benchpress","gym_bp_getoff", 4.0, 0, 0, 1, 1, 1);SetTimerEx("GetUp",2900,false,"u",playerid);
	    	KillTimer(ReduceTimer[playerid]);
	    	PlayerInfo[playerid][pPower] = 506.000000;
	   	 	PlayerInfo[playerid][pReps] = 0;
	    	IsInMovingTime[playerid] = 0;
	    	PlayerInfo[playerid][IsUsingWeight] = 0;
	    	TextDrawHideForPlayer(playerid,RepsText[playerid]);
	    	TextDrawHideForPlayer(playerid,Box1[playerid]);
	    	TextDrawHideForPlayer(playerid,Box2[playerid]);
	    	TextDrawHideForPlayer(playerid,MovingBox[playerid]);
	    	SetCameraBehindPlayer(playerid);
	    	SetTimerEx("BenchPressFinish", 7000, false, "i", playerid);
		}



/*	else if(newkeys == KEY_JUMP)
	{
		if(IsPlayerConnected(playerid))
		{
			if(VehAsk[playerid] == 0)
			{
				return 1;

			}
			if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
			{
				return 1;

			}
			if (IsNotAEngineCar(idcar))
			{
				return 1;

			}
			if(idcar >= 135 && idcar <= 154)
			{
				if(HireCar[playerid] != idcar)
				{
					return 1;

				}

			}
			if(idcar >= 1 && idcar <= 9)
			{
				if(HireCar[playerid] != idcar)
				{
					return 1;

				}

			}
			if(IsAnOwnableCar(idcar))
			{
				if(PlayerInfo[playerid][pCarkey] == VehicleOwned[idcar])
				{

				}
				else if(PlayerInfo[playerid][pCarkey2] == VehicleOwned[idcar])
				{

				}
				else if(PlayerInfo[playerid][pCarkey3] == VehicleOwned[idcar])
				{

				}
				else
				{
					return 1;
				}

			}
			if(ReduceTime[playerid] > 0)
			{
				format(string, sizeof(string), " You need to wait %d seconds to type this command.", ReduceTime[playerid]);
				SendClientMessage(playerid, COLOR_GREY, string);
				return 1;

			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			GiveNameSpace(sendername);
			if(PlayerInfo[playerid][pMaskUse] == 1)
			{
				format(sendername, sizeof(sendername), "[Mask_%d_38]", RandMask[playerid]);
			}
			if (VehicleEngine[idcar] == 0)
			{
				format(string, sizeof(string), "* %s spins the %s's key into the ignition and turns on the engine.", sendername, VehicleName[GetVehicleModel(idcar)-400]);
				ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				new RandomStart;
				RandomStart = random(4);
				switch(RandomStart)
				{
					case 0,1,2:

					{
						if(VehAsk[playerid] == 1)
						{
							VehAsk[playerid] = 0;
							TogglePlayerControllable(playerid,true);

						}
						VehicleEngine[idcar] = 1;
						format(string, sizeof(string), "* %s engine starts (( %s ))", VehicleName[GetVehicleModel(idcar)-400], sendername);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

					}
					case 3:

					{
						format(string, sizeof(string), "* %s engine does not start (( %s ))", VehicleName[GetVehicleModel(idcar)-400], sendername);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						ReduceTime[playerid] = 3;

					}

				}

			}

		}

	}*/
	else if(((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE)) || ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE)) ||  (newkeys & KEY_FIRE))
	{
	    if(IsPlayerAiming(playerid))
	    {
			if(GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 30 || GetPlayerWeapon(playerid) == 31 && GetPlayerAmmo(playerid) > 1)
			{
				for(new i = 0; i < MAX_PLAYERS; i++)
				{
					if(i == playerid) continue;
					if(IsPlayerConnected(i))
					{
						if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
						{
						    if(IsPlayerAimingTargetBodyPart(playerid, i, 1)) // BODY_PART_HEAD
						    { DoDamage(playerid, i, 1, GetPlayerWeapon(playerid)); }
						    else if(IsPlayerAimingTargetBodyPart(playerid, i, 2)) // BODY_PART_TORSO
						    { DoDamage(playerid, i, 2, GetPlayerWeapon(playerid)); }
						    else if(IsPlayerAimingTargetBodyPart(playerid, i, 3)) // BODY_PART_LEGS
						    { DoDamage(playerid, i, 3, GetPlayerWeapon(playerid)); }
						}
					}
				}
			}
		}
	}
	return 1;
}

	else if(newkeys == KEY_SECONDARY_ATTACK)
	{
		if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
			if(VehAsk[playerid] == 1)
			{
				VehAsk[playerid] = 0;
				TogglePlayerControllable(playerid,true);
				RemovePlayerFromVehicle(playerid);
				}

			}

		}
	   }
Edit: Sorry that i posted twice my internet connection is very slowly
Reply
#5

I hope its the whole information that i pasted.
Reply
#6

Well, I'm guessing that you the variable 'VehicleOwned' has an array size of 2000 or MAX_VEHICLES.
MAX_VEHICLES = 2000
Eg.
pawn Код:
new VehicleOwned[MAX_VEHICLES];
This means that you can have 2000 elements, starting at '0'. So the elements go from VehicleOwned[0] up to VehicleOwned[1999], which is 1 less than 2000/MAX_VEHICLES.

Код:
Accessing element at index 2001 past array upper bound 1999
This means you are trying to get an element at the index 2001. As our maximum is 1999, if you exceed that, you're going to get an array index out of bounds error.

The number in the brackets "[" and "]" must not be equal to or larger than what is in the introduction line.
If we have:
pawn Код:
new VehicleOwned[5000];
and I try and do:
pawn Код:
VehicleOwned[5000]
//or
VehicleOwned[5001]
Then I am going to get an error, because the maximum element index we can access is 4999. (5000 - 1 = 4999)

I'm trying to find a tutorial for this kind of error to explain it easier, but I cannot seem to find one. Basically, when you do VehicleOwned[newcar] or VGas[newcar], 'newcar' is equal to 2001, which is giving you an out of bounds error.
Reply
#7

So you finding a tutorial about this?
Reply
#8

Like you said.
Reply
#9

Quote:

I'm trying to find a tutorial for this kind of error to explain it easier, but I cannot seem to find one.

Like I said.
Reply
#10

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Like I said.
Then how am i supposed to fix it if you cant find any ways to fix it?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)