please help me
#1

when someone clicks register they crash and in the log it says this , but they should go through a tutorial , i dont know why they crash

PHP код:
[03:11:19James_Brown has logged in.
[
03:11:19]  Loading James_Brown's vehicles.
[03:11:19] [debug] Run time error 4: "Array index out of bounds"
[03:11:19] [debug]  Accessing element at index 999 past array upper bound 500
[03:11:19] [debug] AMX backtrace:
[03:11:19] [debug] #0 000792a0 in public RL_OnPlayerStateChange (0, 1, 8) from slrp.amx
[03:11:19] [debug] #1 native CallLocalFunction () from samp-server.exe
[03:11:19] [debug] #2 00014c18 in public OnPlayerStateChange (0, 1, 8) from slrp.amx
[03:11:37]  Unloading James_Brown'
s vehicles.
[
03:11:37] [partJames_Brown has left the server (0:0
Reply
#2

paste your code for OnPlayerStateChange
Reply
#3

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate != 2NOPTrigger[playerid] = 0;
    if(
IsPlayerNPC(playerid))
    {
        if(
newstate == PLAYER_STATE_SPECTATING)
        {
            
TogglePlayerSpectating(playeridfalse);
        }
        return 
1;
    }
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        
ShowSpeedo(playerid);
    }
    if(
oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {
        
HideSpeedo(playerid);
    }
    if(
GettingSpectated[playerid] != 999)
    {
        new 
spectator GettingSpectated[playerid];
        if(!
IsPlayerConnected(spectator))
        {
            
GettingSpectated[playerid] = 999;
            
Spectate[spectator] = 999;
        }
        if(
newstate == PLAYER_STATE_DRIVER && PlayerInfo[spectator][pAdmin] >= || newstate == PLAYER_STATE_PASSENGER && PlayerInfo[spectator][pAdmin] >= 2)
        {
            
TogglePlayerSpectating(spectatortrue);
            new 
carid GetPlayerVehicleIDplayerid );
            
PlayerSpectateVehiclespectatorcarid );
            
SetPVarInt(spectator"SpecState"newstate);
        }
        else if(
newstate == PLAYER_STATE_ONFOOT && PlayerInfo[spectator][pAdmin] >= 2)
        {
            
TogglePlayerSpectating(spectatortrue);
               
PlayerSpectatePlayerspectatorplayerid );
               
SetPlayerInteriorspectatorGetPlayerInteriorplayerid ) );
            
SetPVarInt(spectator"SpecState"newstate);
        }
    }
    if(
newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 508)
    {
        
TogglePlayerControllable(playerid0);
        
GameTextForPlayer(playerid"Objects loading..."40005);
         
SetPVarInt(playerid"LoadingObjects"1);
          
SetTimerEx("SafeLoadObjects"40000"d"playerid);
         
SetPlayerPos(playerid2404.993164, -1512.187500898.142944);
         
SetPlayerFacingAngle(playerid0);
        
SetCameraBehindPlayer(playerid);
        
SetPlayerInterior(playerid1);
        
Injourney[playerid] = GetPlayerVehicleID(playerid);
    }
    if(
newstate == PLAYER_STATE_ONFOOT)
    {
         if(
Audio_IsClientConnected(playerid))
        {
            
Audio_Stop(playeridstationidp[playerid]);
             
stationidp[playerid] = 0;
        }
        new 
spectator GettingSpectated[playerid];
        if(
PlayerInfo[spectator][pAdmin] >= 2) {
            
// Preventing possible buffer overflows with the arrays
             
TogglePlayerSpectating(spectatortrue);
            
PlayerSpectatePlayerspectatorplayerid );
            
SetPlayerInteriorspectatorGetPlayerInteriorplayerid ) );
            
SetPVarInt(spectator"SpecState"newstate);
            
SetPlayerInteriorspectatorGetPlayerInteriorplayerid ) );
            
SetPlayerVirtualWorldspectatorGetPlayerVirtualWorldplayerid ) );
        }
        if(
oldstate == PLAYER_STATE_DRIVER)
        {
            
SetPlayerWeaponsEx(playerid);
        }
        else if(
oldstate == PLAYER_STATE_PASSENGERSetPlayerWeaponsEx(playerid);
        if(
ConnectedToPC[playerid] == 1337)//mdc
        
{
            
SendClientMessageEx(playeridCOLOR_LIGHTBLUE"* You are now logged off the MDC.");
            
ConnectedToPC[playerid] = 0;
        }
        if(
TransportDuty[playerid] > 0)
        {
            if(
TransportDuty[playerid] == 1)
            {
                
TaxiDrivers -= 1;
            }
            else if(
TransportDuty[playerid] == 2)
            {
                
BusDrivers -= 1;
            }
            
TransportDuty[playerid] = 0;
            new 
string[42];
            
format(stringsizeof(string), "* You are now off duty and earned $%d."TransportMoney[playerid]);
            
SendClientMessageEx(playeridCOLOR_LIGHTBLUEstring);
            
GivePlayerCash(playeridTransportMoney[playerid]);
            
ConsumingMoney[playerid] = 1TransportValue[playerid] = 0TransportMoney[playerid] = 0;
            
SetPlayerColor(playeridTEAM_HIT_COLOR);
            
TransportTime[playerid] = 0;
               
TransportCost[playerid] = 0;
        }
        if(
TransportDriver[playerid] < 999)
        {
            new 
string[128];
            
TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
            
format(stringsizeof(string), "~w~The ride cost~n~~r~$%d",TransportCost[playerid]);
            
GameTextForPlayer(playeridstring50003);
            
format(stringsizeof(string), "~w~Passenger left the taxi.~n~~g~Earned $%d",TransportCost[playerid]);
            
GameTextForPlayer(TransportDriver[playerid], string50003);
            
GivePlayerCash(playerid, -TransportCost[playerid]);
            new 
ip[32], ipex[32];
            
GetPlayerIp(playeridipsizeof(ip));
            
GetPlayerIp(TransportDriver[playerid], ipexsizeof(ipex));
            
TaxiWarn[playerid][TransportDriver[playerid]] += TransportCost[playerid];
            if(
TaxiWarn[playerid][TransportDriver[playerid]] >= 10000)
            {
                
format(stringsizeof(string), "%s (IP:%s) has taxied %s (IP:%s) $%d in this session."GetPlayerNameEx(playerid), ipGetPlayerNameEx(TransportDriver[playerid]), ipexTaxiWarn[playerid][TransportDriver[playerid]]);
                
Log("logs/pay.log"string);
                
ABroadCast(COLOR_YELLOWstring2);
            }
            
TransportTime[TransportDriver[playerid]] = 0;
            
TransportCost[TransportDriver[playerid]] = 0;
            
TransportCost[playerid] = 0;
            
TransportTime[playerid] = 0;
            
TransportDriver[playerid] = 999;
        }
        
TelePos[playerid][0] = 0.0;
        
TelePos[playerid][1] = 0.0;
    }
    new 
seatid GetPlayerVehicleSeat(playerid);
    if(
newstate == PLAYER_STATE_PASSENGER && IsABaitCar(GetPlayerVehicleID(playerid)))
    {
        foreach(
Playeri)
        {
            if(
seatid == 1)
            {
                
PlayerTextDrawSetString(iTextdraw6"~g~]");
            }
            else if(
seatid == 2)
            {
                
PlayerTextDrawSetString(iTextdraw7"~g~[");
            }
            else if(
seatid == 3)
            {
                
PlayerTextDrawSetString(iTextdraw8"~g~]");
            }
        }
    }
    if(
newstate == PLAYER_STATE_PASSENGER// TAXI & BUSSES
    
{
         if(
stationidv[GetPlayerVehicleID(playerid)] != 0)
        {
            new 
station[64];
            switch(
stationidv[GetPlayerVehicleID(playerid)])
            {
                case 
1format(stationsizeof(station), "http://216.246.109.162:8000");
                case 
2format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1415249");
                case 
3format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1415249");
                case 
4format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628721");
                case 
5format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283687");
                case 
6format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628932");
                case 
7format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1756658");
                case 
8format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200");
                case 
9format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057197");
                case 
10format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=18695");
                case 
11format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
                case 
12format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=181367");
                case 
13format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1275071");
                case 
14format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
                case 
15format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356");
                case 
16format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1279013");
                case 
17format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1281016");
                case 
18format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280855");
                case 
19format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1116397");
                case 
20format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057543");
                case 
21format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=616366");
                case 
22format(stationsizeof(station), "http://38.107.220.164:8014");
                case 
23format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=847066");
            }
            if(
Audio_IsClientConnected(playerid))
             {
                 
Audio_Stop(playeridstationidp[playerid]);
                
stationidp[playerid] = Audio_PlayStreamed(playeridstationfalsetruefalse);
            }
        }
        new 
vehicleid GetPlayerVehicleID(playerid);
        if(
vehicleid == NGVehicles[12] ||
        
vehicleid == NGVehicles[13] ||
        
vehicleid == NGVehicles[14] ||
        
vehicleid == NGVehicles[15] ||
        
vehicleid == NGVehicles[16] ||
        
vehicleid == NGVehicles[17])
        {
            
TogglePlayerSpectating(playerid1);
            
PlayerSpectateVehicle(playeridvehicleid);
            
SetPVarInt(playerid"NGPassenger"1);
            
SetPVarInt(playerid"NGPassengerVeh"vehicleid);
            
SetPVarInt(playerid"NGPassengerSkin"GetPlayerSkin(playerid));
            new 
Float:healthFloat:armour;
            
GetPlayerHealth(playeridhealth);
            
GetPlayerArmour(playeridarmour);
            
SetPVarFloat(playerid"NGPassengerHP"health);
            
SetPVarFloat(playerid"NGPassengerArmor"armour);
        }
        
/*new gun,tmp;
        GetPlayerWeaponData(playerid,4,gun,tmp);
        #pragma unused tmp
        if(gun)SetPlayerArmedWeapon(playerid,gun);
        else SetPlayerArmedWeapon(playerid,0);*/
        
if(PlayerInfo[playerid][pGuns][4] > 0)    SetPlayerArmedWeapon(playerid,PlayerInfo[playerid][pGuns][4]);
        else 
SetPlayerArmedWeapon(playerid,0);
        if( 
GetPVarIntplayerid"ToBeEjected" ) >= )
        {
               
SetPVarIntplayerid"ToBeEjected");
               
RemovePlayerFromVehicleplayerid );
               new 
Float:XFloat:YFloat:Z;
            
GetPlayerPos(playeridXYZ);
            
SetPlayerPos(playeridXYZ+2);
            if(
GetPVarInt(playerid"Injured") == 1)
              {
                  
Streamer_UpdateEx(playeridGetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
                   
SetPlayerPos(playeridGetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
                
SetPlayerVirtualWorld(playeridGetPVarInt(playerid,"MedicVW"));
                
SetPlayerInterior(playeridGetPVarInt(playerid,"MedicInt"));
                   
ClearAnimations(playerid);
                
ApplyAnimation(playerid"KNIFE""KILL_Knife_Ped_Die"4.0011101);
               }
           }
        
//SetPVarInt(playerid, "LastWeapon", GetPlayerWeapon(playerid));
        
gLastCar[playerid] = vehicleid;
        foreach(
Playeri)
        {
             if(
IsPlayerInVehicle(ivehicleid) && GetPlayerState(i) == && TransportDuty[i] > 0)
               {
                if(
GetPlayerCash(playerid) < TransportValue[i])
                {
                    new 
string[28];
                    
format(stringsizeof(string), "* You need $%d to enter."TransportValue[i]);
                    
SendClientMessageEx(playeridCOLOR_LIGHTBLUEstring);
                    
RemovePlayerFromVehicle(playerid);
                    new 
Float:XFloat:YFloat:Z;
                    
GetPlayerPos(playeridXYZ);
                    
SetPlayerPos(playeridXYZ+2);
                    
TogglePlayerControllable(playerid1);
                }
                else
                {
                    new 
string[64];
                    if(
TransportDuty[i] == 1)
                    {
                        
format(stringsizeof(string), "* You paid $%d to the taxi driver."TransportValue[i]);
                        
SendClientMessageEx(playeridCOLOR_LIGHTBLUEstring);
                        
format(stringsizeof(string), "* Passenger %s has entered your taxi."GetPlayerNameEx(playerid));
                        
SendClientMessageEx(iCOLOR_LIGHTBLUEstring);
                        
TransportTime[i] = 1;
                        
TransportTime[playerid] = 1;
                        
TransportCost[playerid] = TransportValue[i];
                        
TransportCost[i] = TransportValue[i];
                        
TransportDriver[playerid] = i;
                    }
                    else if(
TransportDuty[i] == 2)
                    {
                        
format(stringsizeof(string), "* You paid $%d to the Taxi Driver."TransportValue[i]);
                        
SendClientMessageEx(playeridCOLOR_LIGHTBLUEstring);
                        
format(stringsizeof(string), "* Passenger %s has entered your Taxi."GetPlayerNameEx(playerid));
                        
SendClientMessageEx(iCOLOR_LIGHTBLUEstring);
                    }
                    
GivePlayerCash(playerid, - TransportValue[i]);
                    
TransportMoney[i] += TransportValue[i];
                }
              }
        }
    }
    if(
newstate == PLAYER_STATE_WASTED)
    {
        if(
GetPVarInt(playerid"EventToken") == 0)
        {
            
SetPVarInt(playerid"MedicBill"1);
        }
        if(
ConnectedToPC[playerid] == 1337)//mdc
        
{
            
ConnectedToPC[playerid] = 0;
        }
        
Seatbelt[playerid] = 0;
    }
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        if(
stationidv[GetPlayerVehicleID(playerid)] != 0)
        {
            new 
station[64];
            switch(
stationidv[GetPlayerVehicleID(playerid)])
            {
                case 
1format(stationsizeof(station), "http://216.246.109.162:8000");
                case 
2format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1415249");
                case 
3format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1415249");
                case 
4format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628721");
                case 
5format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283687");
                case 
6format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628932");
                case 
7format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1756658");
                case 
8format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200");
                case 
9format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057197");
                case 
10format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=18695");
                case 
11format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
                case 
12format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=181367");
                case 
13format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1275071");
                case 
14format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
                case 
15format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356");
                case 
16format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1279013");
                case 
17format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1281016");
                case 
18format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280855");
                case 
19format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1116397");
                case 
20format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057543");
                case 
21format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=616366");
                case 
22format(stationsizeof(station), "http://38.107.220.164:8014");
                case 
23format(stationsizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=847066");
            }
            if(
Audio_IsClientConnected(playerid))
             {
                 
Audio_Stop(playeridstationidp[playerid]);
                
stationidp[playerid] = Audio_PlayStreamed(playeridstationfalsetruefalse);
            }
        }
        
SetPlayerArmedWeapon(playerid0);
        new
            
newcar GetPlayerVehicleID(playerid),
            
enginelightsalarmdoorsbonnetbootobjectivev;
        
gLastCar[playerid] = newcar;
         foreach(
Playeri) {
               
GetPlayerVehicle(inewcar);
            if(
!= -1) {
                if(
== playerid) {
                    new
                        
string[96];
                    
format(stringsizeof(string),"You are the owner of this %s."GetVehicleName(newcar));
                    
SendClientMessageEx(playeridCOLOR_GREYstring);
                    if(
PlayerVehicleInfo[i][v][pvTicket] != 0)
                    {
                        
format(stringsizeof(string),"A $%d parking ticket was left on your vehicle. You must pay the ticket at the DMV in Dilimore."PlayerVehicleInfo[i][v][pvTicket]);
                        
SendClientMessageEx(playeridCOLOR_GREYstring);
                        
SendClientMessageEx(playeridCOLOR_GREY"Failure to pay this ticket as soon as possible will result in a fine, or even an arrest.");
                    }
                }
                else if(
== PlayerInfo[playerid][pVehicleKeysFrom]) {
                    new
                        
string[64 MAX_PLAYER_NAME];
                    
format(stringsizeof(string),"You have the keys for this %s from owner %s."GetVehicleName(newcar), GetPlayerNameEx(i));
                    
SendClientMessageEx(playeridCOLOR_GREYstring);
                }
                else if(
PlayerVehicleInfo[i][v][pvLocked] == && PlayerVehicleInfo[i][v][pvLock] == 1) {
                    
GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
                    
SetVehicleParamsEx(newcar,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
                    
SetTimerEx("DisableVehicleAlarm"300000"d",  newcar);
                    if(
IsPlayerInRangeOfVehicle(inewcar5.0) && IsACop(i))
                    {
                        new 
string[128],
                        
Float:vXFloat:vYFloat:vZ;
                        
GetVehiclePos(newcarvXvYvZ);
                        
SetAllCopCheckpoint(vXvY-5vZ5.0);
                        
PlayAudioStreamForPlayer(playerid"http://www.w2sjw.com/sounds/MODAT.mp3");
                        
format(stringsizeof(string), "Lo-Jack stolen vehicle contact recieved. Reply code 473HDE");
                        
SendRadioMessage(1TACTICAL1string);
                        
format(stringsizeof(string), "Proximity is approximately 5 meters radius");
                        
SendRadioMessage(1TACTICAL1string);
                        
format(stringsizeof(string), "All units be on the lookout for any suspcious behavior");
                        
SendRadioMessage(1TACTICAL1string);
                    }        
                }
                else if(
PlayerVehicleInfo[i][v][pvLocked] == && PlayerVehicleInfo[i][v][pvLock] == 2) {
                    new
                        
string[128 MAX_PLAYER_NAME];
                      if(
PlayerInfo[playerid][pAdmin] < 2)
                    {
                        
format(stringsizeof(string), "* %s has been stunned by the electric anti-theft.",GetPlayerNameEx(playerid));
                        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        new 
Float:XFloat:YFloat:ZFloat:HP;
                         
GetPlayerPos(playeridXYZ);
                         
SendAudioToRange(103001000XYZ20.0);
                         
SetPlayerPos(playerid1YZ);
                         
RemovePlayerFromVehicle(playerid);
                         
SetPVarInt(playerid"IsFrozen"1);
                        
TogglePlayerControllable(playerid,0);
                        
SetTimerEx("ReleasePlayer"100000"d"playerid);
                        
GameTextForPlayer(playerid,"~r~STUNNED!",11000,3);
                        
GetPlayerHealth(playerid,HP);
                        
SetPlayerHealth(playerid,HP-15);
                        if(
IsPlayerInRangeOfVehicle(inewcar2.0) && IsACop(i))
                        {
                            new 
Float:vXFloat:vYFloat:vZ;
                            
GetVehiclePos(newcarvXvYvZ);
                            
SetAllCopCheckpoint(vXvY-5vZ5.0);
                            
PlayAudioStreamForPlayer(playerid"http://www.w2sjw.com/sounds/MODAT.mp3");
                            
format(stringsizeof(string), "Lo-Jack vehicle damage contact recieved. Reply code 263CJD");
                            
SendRadioMessage(1TACTICAL1string);
                            
format(stringsizeof(string), "Proximity is approximately 2 meters radius");
                            
SendRadioMessage(1TACTICAL1string);
                            
format(stringsizeof(string), "All units be on the lookout for any suspcious behavior");
                            
SendRadioMessage(1TACTICAL1string);
                        }        
                    }
                    else
                    {
                        
format(stringsizeof(string), "Warning: This %s is owned by %s."GetVehicleName(newcar), GetPlayerNameEx(i));
                          
SendClientMessageEx(playeridCOLOR_GREYstring);
                    }
                }
                return 
1;
            }
        }
        for(new 
0MAX_FAMILYf++) {
            
GetGangVehicle(fnewcar);
            if(
!= -1) {
                new 
string[49 MAX_PLAYER_NAME];
                if(
PlayerInfo[playerid][pFMember] == f)
                {
                    
format(stringsizeof(string), "You are in the family that owns this %s."GetVehicleName(newcar));
                    
SendClientMessageEx(playeridCOLOR_GREYstring);
                }
                else if(
FamilyVehicleInfo[f][v][fvLocked] == && FamilyVehicleInfo[f][v][fvLock] == 1)
                {
                    
GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
                    
SetVehicleParamsEx(newcar,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
                    
SetTimerEx("DisableVehicleAlarm"200000"d",  newcar);
                }
                else if(
FamilyVehicleInfo[f][v][fvLocked] == && FamilyVehicleInfo[f][v][fvLock] == 2)
                {
                    
format(stringsizeof(string), "* %s has been stunned by the electric anti-theft.",GetPlayerNameEx(playerid));
                    
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    new 
Float:XFloat:YFloat:ZFloat:HP;
                    
GetPlayerPos(playeridXYZ);
                    
SendAudioToRange(103001000XYZ20.0);
                    
SetPlayerPos(playerid1YZ);
                    
RemovePlayerFromVehicle(playerid);
                    new 
Float:slxFloat:slyFloat:slz;
                    
GetPlayerPos(playeridslxslyslz);
                    
SetPlayerPos(playeridslxslyslz);
                    
SetPVarInt(playerid"IsFrozen"1);
                    
TogglePlayerControllable(playerid,0);
                    
SetTimerEx("ReleasePlayer"100000"d"playerid);
                    
GameTextForPlayer(playerid,"~r~STUNNED!",11000,3);
                    
GetPlayerHealth(playerid,HP);
                    
SetPlayerHealth(playerid,HP-15);
                }
                return 
1;
            }
        }
        new 
vehicleid newcar;
        if(
IsVIPcar(vehicleid))
        {
            if(
PlayerInfo[playerid][pDonateRank] >= 2)
            {    
                
ShowPlayerDialog(playerid,10420,DIALOG_STYLE_MSGBOX,"VIP RULES","1. VIP CARS are for personal/play use only.\r\n2. Do Not Roleplay Using VIP CARS, the one you are in!\r\n3. If you abuse VIP Cars your access will be removed\r\n4. Do Not Meta-Game using VIP Chat\r\n5. If you revoke your donation you will be banned.\r\n6. Any items given to VIP's are non transferrable.\r\n7. Final Note: VIP is a gift, it can be taken for any reason.","OK","");
            }
            else
            {
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz+1.3);
                
PlayerPlaySound(playerid1130slxslyslz+1.3);
                
RemovePlayerFromVehicle(playerid);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not a Silver+ VIP, this is a vehicle restricted to those!");
            }
        }
        else if(
IsAnAmbulance(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pLeader] == 4)
            {
                if(
UVFDVehicles[0] == vehicleid && PlayerInfo[playerid][pRank] < 3)
                {
                    
RemovePlayerFromVehicle(playerid);
                    new 
Float:slxFloat:slyFloat:slz;
                    
GetPlayerPos(playeridslxslyslz);
                    
SetPlayerPos(playeridslxslyslz);
                    
NOPCheck(playerid);
                    
SendClientMessageEx(playeridCOLOR_GRAD2"Only ranks 5+ can drive this vehicle.");
                }
            }
            else
            {
                
SendClientMessageEx(playerid,COLOR_GREY,"   You are not in the LAFD!");
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
            }
        }
        else if(
IsAnSASDCar(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pLeader] == 7)
            {
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in LASD!");
            }
        }
        else if(
IsAnSFPDCar(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pLeader] == 3)
            {
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in the SFPD!");
            }
        }
        else if(
IsARRWrecker(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == 14 && PlayerInfo[playerid][pRank] >= 4)
            {
                
SendClientMessageEx(playeridCOLOR_GREEN"__________________LA Recovery WRECKER____________________");
                
SendClientMessageEx(playeridCOLOR_GRAD2"<< Avaiable wrecker commands: >>");
                
SendClientMessageEx(playeridCOLOR_GRAD2"<< /wreck /unwreck /impound >>");
                
SendClientMessageEx(playeridCOLOR_GREEN"____________________________________________________________");
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not atleast rank 4 and above in LA Recovery");
            }
        }
        else if(
IsARRTower(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == 14 && PlayerInfo[playerid][pRank] >= 3)
            {
                
SendClientMessageEx(playeridCOLOR_GREEN"__________________LA Recovery TOW TRUCK____________________");
                
SendClientMessageEx(playeridCOLOR_GRAD1"<< Avaiable tow commands: >>");
                
SendClientMessageEx(playeridCOLOR_GRAD1"<< /tow /untow /impound >>");
                
SendClientMessageEx(playeridCOLOR_GREEN"______________________________________________________________");
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not atleast rank 3 and above in LA Recovery");
            }
        }
        else if(
IsARRBattery(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == 14 && PlayerInfo[playerid][pRank] >= 1)
            {
                
SendClientMessageEx(playeridCOLOR_GREEN"__________________LA Recovery BATTERY______________________");
                
SendClientMessageEx(playeridCOLOR_GRAD1"<< Avaiable mechanic commands: >>");
                
SendClientMessageEx(playeridCOLOR_GRAD1"<< /fix /refill >>");
                
SendClientMessageEx(playeridCOLOR_GREEN"______________________________________________________________");
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not atleast rank 3 and above in LA Recovery");
            }
        }
        else if(
IsAIAWrecker(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == 17 && PlayerInfo[playerid][pRank] >= 4)
            {
                
SendClientMessageEx(playeridCOLOR_GREEN"__________________IZZY's AUTOMOTIVE WRECKER____________________");
                
SendClientMessageEx(playeridCOLOR_GRAD2"<< Avaiable wrecker commands: >>");
                
SendClientMessageEx(playeridCOLOR_GRAD2"<< /wreck /unwreck /impound >>");
                
SendClientMessageEx(playeridCOLOR_GREEN"____________________________________________________________");
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not atleast rank 4 and above in Izzy's Automotive");
            }
        }
        else if(
IsAIATower(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == 17 && PlayerInfo[playerid][pRank] >= 4)
            {
                
SendClientMessageEx(playeridCOLOR_GREEN"__________________IZZY's AUTOMOTIVE TOW TRUCK____________________");
                
SendClientMessageEx(playeridCOLOR_GRAD1"<< Avaiable tow commands: >>");
                
SendClientMessageEx(playeridCOLOR_GRAD1"<< /tow /untow /impound >>");
                
SendClientMessageEx(playeridCOLOR_GREEN"______________________________________________________________");
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not atleast rank 3 and above in Izzy's Automotive");
            }
        }
        else if(
IsAIABattery(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == 17 && PlayerInfo[playerid][pRank] >= 1)
            {
                
SendClientMessageEx(playeridCOLOR_GREEN"__________________IZZY's AUTOMOTIVE BATTERY______________________");
                
SendClientMessageEx(playeridCOLOR_GRAD1"<< Avaiable mechanic commands: >>");
                
SendClientMessageEx(playeridCOLOR_GRAD1"<< /fix /refill >>");
                
SendClientMessageEx(playeridCOLOR_GREEN"______________________________________________________________");
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not atleast rank 3 and above in Izzy's Automotive");
            }
        }
        
/* else if(IsABaitCar(vehicleid))
        {
            new string[128];
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && BaitCarActive == 1)
            {
                format(string, 128, "BAITCAR: Driver door ajar");
                SendRadioMessage(7, COLOR_DBLUE, string);
            }
            else if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER && BaitCarActive == 1)
            {
                format(string, 128, "BAITCAR: Passenger door ajar");
                SendRadioMessage(7, COLOR_DBLUE, string);
            }
        } */
        
else if(IsAnEPCar(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == && PlayerInfo[playerid][pDivision] == || PlayerInfo[playerid][pMember] == && PlayerInfo[playerid][pRank] >= 5)
            {
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in the SFPD Executive Protection Division!");
            }
        }
        else if(
IsAnWPCar(vehicleid))
        {
               if(
PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pMember] == 7){
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in LASD!");
            }
        }
        else if(
IsACopCar(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
            {
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in the LAPD!");
            }
        }
         else if(
IsAHouse168Car(vehicleid))
        {
            
TogglePlayerControllable(playeridfalse);
              
ShowPlayerDialog(playeridHouse275CARDIALOG_STYLE_INPUT"Keypad""Password:""ENTER""EXIT");
        }
        else if(
IsAFBICar(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == 2||PlayerInfo[playerid][pLeader] == 2)
            {
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in the FBI!");
            }
        }
    
/*    else if(IsAnNGARMCar(vehicleid))
        {
            if((PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pDivision] == 3 || PlayerInfo[playerid][pDivision] == 6 || PlayerInfo[playerid][pDivision] == 7))
            {
            }
            else
            {
                RemovePlayerFromVehicle(playerid);
                new Float:slx, Float:sly, Float:slz;
                GetPlayerPos(playerid, slx, sly, slz);
                SetPlayerPos(playerid, slx, sly, slz);
                NOPCheck(playerid);
                SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in the NG ARM Division!");
            }
        } */
        
else if(IsAnNGAIRCar(vehicleid))
        {
            if((
PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11) && (PlayerInfo[playerid][pDivision] == || PlayerInfo[playerid][pDivision] == 4))
            {
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in the NG AIR Division!");
            }
        }
        else if(
IsAnNGCar(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
            {
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in the National Guard!");
            }
        }
        else if(
IsAnDOCCar(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == 11||PlayerInfo[playerid][pLeader] == 11)
            {
            }
            else
            {
                   
NOPCheck(playerid);
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in the National Guard!");
            }
        }
        else if(
IsAnMPSCar(vehicleid))
        {
            if(
IsACop(playerid))
            {
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You aren't in a LEO Faction.");
            }
        }
        else if(
IsACoastguardCar(vehicleid))
        {
            if( ( 
PlayerInfo[playerid][pMember] == || PlayerInfo[playerid][pLeader] == ) || ( PlayerInfo[playerid][pMember] == && PlayerInfo[playerid][pDivision] == ))
            {
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in the Coastguard division!");
            }
        }
         else if(
IsANewsCar(vehicleid))
        {
            if(
PlayerInfo[playerid][pMember] == ||PlayerInfo[playerid][pLeader] == 9)
            {
            }
            else
            {
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                
NOPCheck(playerid);
                
SendClientMessageEx(playeridCOLOR_GRAD2"You are not in the SANews!");
            }
        }
           else if(
IsAPlane(vehicleid))
        {
              if(
PlayerInfo[playerid][pFlyLic] != 1)
              {
                  
RemovePlayerFromVehicle(playerid);
                  new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
                  
NOPCheck(playerid);
                 
SendClientMessageEx(playerid,COLOR_GREY,"You don't have a pilot license!");
              }
        }
        else if(
IsAHelicopter(vehicleid))
        {
            
PlayerInfo[playerid][pAGuns][GetWeaponSlot(46)] = 46;
            
GivePlayerValidWeapon(playerid4660000);
        }
        else if(
IsAnTaxi(vehicleid) || IsAnBus(vehicleid))
        {
            if(
PlayerInfo[playerid][pJob] == 17 || PlayerInfo[playerid][pJob2] == 17 || PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pTaxiLicense] == 1)
            {
            }
            else
            {
                
SendClientMessageEx(playerid,COLOR_GREY,"   You are not a Taxi/Bus Driver!");
                
RemovePlayerFromVehicle(playerid);
                new 
Float:slxFloat:slyFloat:slz;
                
GetPlayerPos(playeridslxslyslz);
                
SetPlayerPos(playeridslxslyslz);
            }
        }
        if( 
GetPVarIntplayerid"ToBeEjected" ) >= )
        {
               
SetPVarIntplayerid"ToBeEjected");
               
RemovePlayerFromVehicleplayerid );
               new 
Float:XFloat:YFloat:Z;
            
GetPlayerPos(playeridXYZ);
            
SetPlayerPos(playeridXYZ+2);
            if(
GetPVarInt(playerid"Injured") == 1)
              {
                  
Streamer_UpdateEx(playeridGetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
                   
SetPlayerPos(playeridGetPVarFloat(playerid,"MedicX"), GetPVarFloat(playerid,"MedicY"), GetPVarFloat(playerid,"MedicZ"));
                
SetPlayerVirtualWorld(playeridGetPVarInt(playerid,"MedicVW"));
                
SetPlayerInterior(playeridGetPVarInt(playerid,"MedicInt"));
                   
ClearAnimations(playerid);
                
ApplyAnimation(playerid"KNIFE""KILL_Knife_Ped_Die"4.0011101);
               }
           }
        
//if(lights == VEHICLE_PARAMS_UNSET) SetVehicleParamsEx(newcar,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
        
TelePos[playerid][0] = 0.0;
        
TelePos[playerid][1] = 0.0;
        
//SetPVarInt(playerid, "LastWeapon", GetPlayerWeapon(playerid));
        
if(IsARental(newcar) && gBike[playerid] == && gBikeRenting[playerid] == 0)
        {
            
TogglePlayerControllable(playerid,0);
            
ShowPlayerDialog(playeridRENTMENUDIALOG_STYLE_LIST"Bike Shed BMX Rentals","15 Minutes - 1000$\n30 Minutes - 2000$\n1 Hour - 4000$""Rent""Cancel");
        }
        if(
GetCarDealershipVehicleId(newcar) != -&& GetCarDealershipVehicleId(newcar) == GetPVarInt(playerid"editingcdveh")) return 1;
        if(
GetCarDealershipVehicleId(newcar) != -1)
        {
            new 
string[57 20 4];
            
format(stringsizeof(string),"Would you like to buy this %s?\n\nThis vehicle costs $%d."GetVehicleName(newcar), CarDealershipInfo[GetCarDealershipId(newcar)][cdVehicleCost][GetCarDealershipVehicleId(newcar)]);
            
ShowPlayerDialog(playerid,DIALOG_CDBUY,DIALOG_STYLE_MSGBOX,"PROJECT-LA CAR DEALERSHIP",string,"Buy","Cancel");
            
TogglePlayerControllable(playeridfalse);
            return 
1;
        }
        
GetVehicleParamsEx(newcar,engine,lights,alarm,doors,bonnet,boot,objective);
        if((
engine == VEHICLE_PARAMS_UNSET || engine == VEHICLE_PARAMS_OFF) && GetVehicleModel(newcar) != 509 && GetVehicleModel(newcar) != 481 && GetVehicleModel(newcar) != 510) {
            
SendClientMessageEx(playeridCOLOR_WHITE"This vehicle's engine is not running - if you wish to start it, type /car engine.");
        }
        else
        {
            if(
GetVehicleModel(GetPlayerVehicleID(playerid)) != 481 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 509 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 510)
            {
                
//format(erpstring, sizeof(erpstring), "%.2f GAL", VehicleFuel[GetPlayerVehicleID(playerid)]);
                //TextDrawSetString(FuelText[playerid],erpstring);
            
}
        }
    }
    if((
newstate == || newstate == || newstate == || newstate == 9) && pTazer[playerid] == 1)
    {
        
GivePlayerValidWeapon(playeridpTazerReplace[playerid], 60000);
        
pTazer[playerid] = 0;
    }
    
/*if((newstate == 2 || newstate == 3 || newstate == 7 || newstate == 9) && pBeanbag[playerid] == 1)
    {
        GivePlayerValidWeapon(playerid, pBeanbagReplace[playerid], 60000);
        pBeanbag[playerid] = 0;
    }*/
    
if(newstate == PLAYER_STATE_SPAWNED)
    {
        if(
ConnectedToPC[playerid] == 1337)//mdc
        
{
            
ConnectedToPC[playerid] = 0;
        }
        
TelePos[playerid][0] = 0.0;
        
TelePos[playerid][1] = 0.0;
        
gPlayerSpawned[playerid] = 1;
        
SafeTime[playerid] = 60;
    }
    if(
newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        if(
VehicleStatus{vehicleid} == 1) return SendClientMessageEx(playeridCOLOR_WHITE"You are not allowed to enter this Shamal as it's been damaged!");
        new 
string[47 MAX_PLAYER_NAME];
           
format(stringsizeof(string), "* %s enters the Shamal airplane as a passenger."GetPlayerNameEx(playerid));
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
         
SetPlayerPos(playerid2.50903623.1187301199.593750);
         
SetPlayerFacingAngle(playerid82.14);
        
SetCameraBehindPlayer(playerid);
        
PlayerInfo[playerid][pVW] = vehicleid;
        
SetPlayerVirtualWorld(playeridvehicleid);
        
PlayerInfo[playerid][pInt] = 1;
        
SetPlayerInterior(playerid1);
        
InsideShamal[playerid] = vehicleid;
        
SendClientMessageEx(playeridCOLOR_WHITE"Type /exit near the door to exit the vehicle, or /window to look outside.");
    }
    
IsPlayerSteppingInVehicle[playerid] = -1;
    return 
1;

Reply
#4

anyone please?
Reply
#5

we can't help you unless you shorten the amount of total code given, if the crash occurs when the players clicks register, then that is probably where the problem will be, that error means you are trying to access data that doesn't exist, so check all your array sizes, go all out and check everything, (listitem, dialogid etc)
https://sampforum.blast.hk/showthread.php?tid=482429
Reply
#6

here

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate != 2NOPTrigger[playerid] = 0;
    if(
IsPlayerNPC(playerid))
    {
        if(
newstate == PLAYER_STATE_SPECTATING)
        {
            
TogglePlayerSpectating(playeridfalse);
        }
        return 
1;
    }
    if(
oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        
ShowSpeedo(playerid);
    }
    if(
oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {
        
HideSpeedo(playerid);
    }
    if(
GettingSpectated[playerid] != 999)
    {
        new 
spectator GettingSpectated[playerid];
        if(!
IsPlayerConnected(spectator))
        {
            
GettingSpectated[playerid] = 999;
            
Spectate[spectator] = 999;
        }
        if(
newstate == PLAYER_STATE_DRIVER && PlayerInfo[spectator][pAdmin] >= || newstate == PLAYER_STATE_PASSENGER && PlayerInfo[spectator][pAdmin] >= 2)
        {
            
TogglePlayerSpectating(spectatortrue);
            new 
carid GetPlayerVehicleIDplayerid );
            
PlayerSpectateVehiclespectatorcarid );
            
SetPVarInt(spectator"SpecState"newstate);
        }
        else if(
newstate == PLAYER_STATE_ONFOOT && PlayerInfo[spectator][pAdmin] >= 2)
        {
            
TogglePlayerSpectating(spectatortrue);
               
PlayerSpectatePlayerspectatorplayerid );
               
SetPlayerInteriorspectatorGetPlayerInteriorplayerid ) );
            
SetPVarInt(spectator"SpecState"newstate);
        }
    }
    if(
newstate == PLAYER_STATE_PASSENGER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 508)
    {
        
TogglePlayerControllable(playerid0);
        
GameTextForPlayer(playerid"Objects loading..."40005);
         
SetPVarInt(playerid"LoadingObjects"1);
          
SetTimerEx("SafeLoadObjects"40000"d"playerid);
         
SetPlayerPos(playerid2404.993164, -1512.187500898.142944);
         
SetPlayerFacingAngle(playerid0);
        
SetCameraBehindPlayer(playerid);
        
SetPlayerInterior(playerid1);
        
Injourney[playerid] = GetPlayerVehicleID(playerid);
    }
    if(
newstate == PLAYER_STATE_ONFOOT)
    {
         if(
Audio_IsClientConnected(playerid))
        {
            
Audio_Stop(playeridstationidp[playerid]);
             
stationidp[playerid] = 0;
        }
        new 
spectator GettingSpectated[playerid];
        if(
PlayerInfo[spectator][pAdmin] >= 2) {
            
// Preventing possible buffer overflows with the arrays
             
TogglePlayerSpectating(spectatortrue);
            
PlayerSpectatePlayerspectatorplayerid );
            
SetPlayerInteriorspectatorGetPlayerInteriorplayerid ) );
            
SetPVarInt(spectator"SpecState"newstate);
            
SetPlayerInteriorspectatorGetPlayerInteriorplayerid ) );
            
SetPlayerVirtualWorldspectatorGetPlayerVirtualWorldplayerid ) );
        } 
Reply
#7

what happens is when they click register it just closes samp and shows the user under the map in like blueberry acres and the it shows gta_sa has stopped working
Reply
#8

A good practice to follow when debugging is, try comment out sections of code until the error disappears, and then add back sections of code piece by piece until you get find exactly where the error generates from.
Reply
#9

i sent you my ip server to show you the problem if you have time , i been trying to fix it for weeks but no luck
Reply
#10

pawn Код:
if(GettingSpectated[playerid] != 999)
    {
        new spectator = GettingSpectated[playerid];
        if(!IsPlayerConnected(spectator))
here, you are assigning spectator to gettingSpectated[playerid] which from what it looks like would = 999,
then you are checking if player 999 is connected, im assuming you only have 500 defined as your max players?

Код:
[03:11:19] [debug]  Accessing element at index 999 past array upper bound 500
that's what that means.
Reply


Forum Jump:


Users browsing this thread: