onplayerstatechange
#1

i set crashdetect and when i start mod and enter in the vehicle i get this in server log:

Код:
[15:38:09] [debug] Run time error 4: "Array index out of bounds"
[15:38:09] [debug]  Accessing element at index 92 past array upper bound 31
[15:38:09] [debug] AMX backtrace:
[15:38:09] [debug] #0 0003c3ec in public RL_OnPlayerStateChange (0x00000000, 0x00000002, 0x00000001) from MLRP.amx
[15:38:09] [debug] #1 native CallLocalFunction () [00471ef0] from samp-server.exe
[15:38:09] [debug] #2 0001979c in ?? (0x00000000, 0x00000002, 0x00000001) from MLRP.amx
[15:38:09] [debug] #3 000063dc in public OnPlayerStateChange (0x00000000, 0x00000002, 0x00000001) from MLRP.amx
onplayerstatechange:

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new newcar = GetPlayerVehicleID(playerid);
/* ============================================================================================================================================================================================= */
/* ====SALON BICIKLA==== */
    if(newstate == PLAYER_STATE_DRIVER)
	{
		if(BicikloProdaja(newcar))
		{
			TogglePlayerControllable(playerid, 0);
		}
	}
/* ============================================================================================================================================================================================= */
/* ====RENT==== */
	if(newstate == PLAYER_STATE_DRIVER)
	{
		if(RentBikes(newcar))
		{
 			if(Iznajmljivanje[playerid] != newcar)
			{
				SendClientMessage(playerid,COLOR_RLYLIGHTGREEN,"Iznajmite biciklo koristeci {FFFFFF}/rentcar. {9ACD32}Izadji sa bicikle koristeci {FFFFFF}/exit.");
				GameTextForPlayer(playerid,"~g~Cijena: $25",  3000, 1);
				TogglePlayerControllable(playerid, 0);
			}
		}
	}

	if(newstate == PLAYER_STATE_DRIVER)
	{
		if(RentMotors(newcar))
		{
 			if(Iznajmljivanje[playerid] != newcar)
			{
				SendClientMessage(playerid,COLOR_RLYLIGHTGREEN,"Iznajmite motor koristeci {FFFFFF}/rentcar. {9ACD32}Izadji sa motora koristeci {FFFFFF}/exit.");
				GameTextForPlayer(playerid,"~g~Cijena: $50",  3000, 1);
				TogglePlayerControllable(playerid, 0);
			}
		}
	}

	if(newstate == PLAYER_STATE_DRIVER)
	{
		if(RentCars(newcar))
		{
 			if(Iznajmljivanje[playerid] != newcar)
			{
				SendClientMessage(playerid,COLOR_RLYLIGHTGREEN,"Iznajmite vozilo koristeci {FFFFFF}/rentcar. {9ACD32}Izadji iz vozila koristeci {FFFFFF}/exit.");
				GameTextForPlayer(playerid,"~g~Cijena: $100",  3000, 1);
				TogglePlayerControllable(playerid, 0);
			}
		}
	}

/* ============================================================================================================================================================================================= */
/* ====[ ORGANIZACIJE ]==== */
	if(newstate == PLAYER_STATE_DRIVER)
   	{
      	for(new i=0; i<sizeof(LspdVozila); i++)
      	{
          	if(GetPlayerVehicleID(playerid)==LspdVozila[i])
          	{
              	new iVehicleID = GetPlayerVehicleID(playerid);
              	if(IsAPoliceCar(iVehicleID) && (PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)) { }
		      	else
              	{
                  	RemovePlayerFromVehicle(playerid);
                  	SendClientMessage(playerid, COLOR_GREY, "(Izbacen!) Nemate kljuceve ovog vozila!");
         		}
          }
      }
   }

   if(newstate == PLAYER_STATE_DRIVER)
   	{
      	for(new i=0; i<sizeof(FbiVozila); i++)
      	{
          	if(GetPlayerVehicleID(playerid)==FbiVozila[i])
          	{
              	new iVehicleID = GetPlayerVehicleID(playerid);
              	if(IsAFbiVozilo(iVehicleID) && (PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)) { }
		      	else
              	{
                  	RemovePlayerFromVehicle(playerid);
                  	SendClientMessage(playerid, COLOR_GREY, "(Izbacen!) Nemate kljuceve ovog vozila!");
              	}
          }
      }
   }

   if(newstate == PLAYER_STATE_DRIVER)
   {
      	for(new i=0; i<sizeof(LsbVozila); i++)
      	{
          	if(GetPlayerVehicleID(playerid)==LsbVozila[i])
          	{
              	new iVehicleID = GetPlayerVehicleID(playerid);
              	if(IsALsbCar(iVehicleID) && (PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)) { }
			  	else
              	{
                  	RemovePlayerFromVehicle(playerid);
                  	SendClientMessage(playerid, COLOR_GREY, "(Izbacen!) Nemate kljuceve ovog vozila!");
              	}
          	}
      	}
   	}
	if(newstate == PLAYER_STATE_DRIVER)
    {
      for(new i=0; i<sizeof(kosilica); i++)
      {
          if(GetPlayerVehicleID(playerid)==kosilica[i])
          {
              new iVehicleID = GetPlayerVehicleID(playerid);
              if(VoziloKosaca(iVehicleID) && (PlayerInfo[playerid][pPosao] == POSAO_KOSAC)) { }
			  else
              {
                  RemovePlayerFromVehicle(playerid);
                  SendClientMessage(playerid, COLOR_GREY, "(Izbacen!) Nisi zaposlen kao kosac trave!");
              }
          }
      }
   }
	if(newstate == PLAYER_STATE_DRIVER)
	{
	   	if(!VoziloJeMotor(GetVehicleModel(GetPlayerVehicleID(playerid))) && !VoziloJeAvion(GetVehicleModel(GetPlayerVehicleID(playerid))) && !VoziloJeBrod(GetVehicleModel(GetPlayerVehicleID(playerid))) && !VoziloJeKamion(GetVehicleModel(GetPlayerVehicleID(playerid))) && !VoziloJeBicikla(GetVehicleModel(GetPlayerVehicleID(playerid))))
	   	{
			if(PlayerInfo[playerid][pVozacka] <= 0)
			{
				SendClientMessage(playerid, COLOR_LIGHTRED, "(Upozorenje!) {FFFFFF}Nemas vozacku dozvolu, pazi da te policija ne uhvati!");
			}
		}
	}
	if(newstate == PLAYER_STATE_DRIVER)
	{
	    new string[75],Float:Pos[3]; GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
		if(strcmp(KucaVlasnik[GetPlayerVehicleID(playerid)], GetName(playerid), false) == 0)
		{

		}
		else
		{
			format(string,sizeof(string), "Kucno vozilo zakljucano! {FFFF00}Vlasnik: %s", KucaVlasnik[GetPlayerVehicleID(playerid)]);
			SendClientMessage(playerid, COLOR_RED, string);
			SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
		}
	}
	new vehicleid = GetPlayerVehicleID(playerid);
	if(newstate == PLAYER_STATE_DRIVER)
 	{
		if(vehEngine[vehicleid] == 0)
  		{
    		TogglePlayerControllable(playerid, 0);
        	GameTextForPlayer(playerid, "~w~Za paljenje motora~n~pritisnite tipku broj 2~n~ili kucajte /engine", 2000, 3);
      	}
		else if(vehEngine[vehicleid] == 1)
  		{
    		TogglePlayerControllable(playerid, 1);
      	}
	}
	return 1;
}
whats wrong here?
Reply
#2

BUMP!
Reply
#3

BUMP?!
Reply
#4

HELP PLZ
Reply
#5

try increasing the size of the following arrays.

pawn Код:
FbiVozila
LsbVozila
Because those are the array variables I found in the entire OnPlayerStateChange
Reply
#6

how do you mean? PLZ HELP!
Reply
#7

BUMP!!!
Reply
#8

HELP PLZ
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)