OnPlayerStateChange
#1

Hi all , i have a sh** of problem i tryed to fix it but i can't i don't know why , the problem is:

[debug] AMX backtrace:
[debug] #0 0005536c in public OnPlayerStateChange (playerid=0, newstate=2, oldstate=1) at C:\***\***\Desktop\***\gamemodes\***.pwn:1482
[debug] Run time error 4: "Array index out of bounds"
[debug] Accessing element at index 103 past array upper bound 99

This is the line:

if(VehicleInfo[vehicleid][bought] == 1)

Full line :

new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
new pVehicleModel = GetVehicleModel(GetPlayerVehicleID(playerid)), sStr[128];
//----------------------------------------------------------------------
pvehicleid[ playerid ] = GetPlayerVehicleID(playerid);
pmodelid[ playerid ] = GetVehicleModel(pvehicleid[ playerid ]);
//----------------------------------------------------------------------
format(sStr, 128, "%s", VehicleNames[pVehicleModel - 400]);
//----------------------------------------------------------------------
PlayerTextDrawSetString(playerid, ecar8[playerid], sStr);
//----------------------------------------------------------------------
for(new i = 0; i < 7; i++) TextDrawShowForPlayer(playerid,Ecar[i]);
PlayerTextDrawShow(playerid, ecar8[playerid]);

if(VehicleInfo[vehicleid][bought] == 1)
{
AccInfo[playerid][lastvehicle] = vehicleid;
SendVehicleSecurityMessage(playerid,vehicleid);
}
}


What can i do?
Reply
#2

It says error in. " OnPlayerStateChange(playerid=0, newstate=2, oldstate=1)" whereas OnPlayerStateChange have this parameter. "playerid, newstate, oldstate".

I suggest removing =0, =1, =2 or whatever.
Reply
#3

i don't use
Reply
#4

Show me the declaration of this variable.
pawn Код:
Ecar
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)