IMPORTANT[PLEASE READ]
#1

So i got this message for over one month and im trying to fix it both this errors any help?[PLEASE BE CLEAR IM NOT A PROFESSIONAL]

Quote:

[22:47:01] [debug] Run time error 5: "Invalid memory access"
[22:47:01] [debug] AMX backtrace:
[22:47:01] [debug] #0 001787f0 in public OnPlayerKeyStateChange () from PCNR.amx
[22:47:49] [death] E98uz died 255
[22:52:14] [chat] [E98uz]: UWAU
[22:58:11] [debug] Run time error 5: "Invalid memory access"
[22:58:11] [debug] AMX backtrace:
[22:58:11] [debug] #0 001787f0 in public OnPlayerKeyStateChange () from PCNR.amx


Quote:

Run time error 4: "Array index out of bounds"
[23:18:51] [debug] Accessing element at negative index -1
[23:18:51] [debug] AMX backtrace:
[23:18:51] [debug] #0 000d97c4 in public n_OnVehicleRespray (0, 375, 67, 67) from PCNR.amx
[23:18:51] [debug] #1 native CallLocalFunction () from sampsvr-port_2503
[23:18:51] [debug] #2 00020568 in public OnVehicleRespray (0, 375, 67, 67) from PCNR.amx
[23:18:57] [debug] Run time error 4: "Array index out of bounds"
[23:18:57] [debug] Accessing element at negative index -1


If you cant fix both please fix one of them

Regards,
Private(MohammedZ);;;; Thank you
Reply
#2

Provide code (the ones causing it).
Reply
#3

Quote:

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_JUMP && !(oldkeys & KEY_JUMP) && GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_CUFFED) ApplyAnimation(playerid, "GYMNASIUM", "gym_jog_falloff",4.1,0,1,1,0,0);//Credits to MP2
if(GetPlayerAnimationIndex(playerid) == 1660 || GetPlayerAnimationIndex(playerid) == 1661) { GivePlayerCash(playerid, -1); return 1; }//Drink machine/s
if(IsPlayerUsingAnim{playerid} == true && newkeys == KEY_SECONDARY_ATTACK)
{
if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_NONE)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
ClearAnimations(playerid);
IsPlayerUsingAnim{playerid} = false;
}
if(newkeys == KEY_SUBMISSION)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 407)
{
return cmd_fire(playerid, "");
}
if (newkeys == KEY_SUBMISSION)
{
if(TruckEligibleCar(vehicleid)) // If the car is trucking eligible
{
return cmd_startjob(playerid, "");
}
}
if (newkeys == KEY_SUBMISSION)
{
TextDrawHideForPlayer(playerid, Policerefill);
TextDrawHideForPlayer(playerid, Policerefill2);
TextDrawHideForPlayer(playerid, Weapons);
TextDrawHideForPlayer(playerid, Armour);
TextDrawHideForPlayer(playerid, Cars);
TextDrawHideForPlayer(playerid, Textdraw110);
TextDrawHideForPlayer(playerid, Textdraw111);
TextDrawHideForPlayer(playerid, Textdraw112);
TextDrawHideForPlayer(playerid, Textdraw113);
TextDrawHideForPlayer(playerid, Textdraw114);
TextDrawHideForPlayer(playerid, Textdraw115);
TextDrawHideForPlayer(playerid, Textdraw116);
TextDrawHideForPlayer(playerid, Textdraw117);
TextDrawHideForPlayer(playerid, Sellcar1);
TextDrawHideForPlayer(playerid, Sellyourcar);
TextDrawHideForPlayer(playerid, Sellcar);
TextDrawHideForPlayer(playerid, Nosell);
}
}
return 1;
}

Quote:

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
if(IsShopVehicle[vehicleid] != 1 && !strcmp(GetName(playerid), VehicleInfo[vehicleid][vOwner], false))
{
VehicleInfo[IsShopVehicle[vehicleid]][vColor1] = color1;
VehicleInfo[IsShopVehicle[vehicleid]][vColor2] = color2;
SaveVehicleStats(IsShopVehicle[vehicleid]);
}
return 1;
}

Thats it both onplayerkeystatechange and onvehiclerespray
Reply
#4

?Those are the codes do you need any more codes
Reply
#5

This is because of the infinite loops I think.
So undo your previous edits, maybe it will fix.
Reply
#6

anyone else?
Reply
#7

Quote:
Originally Posted by SpikY_
Посмотреть сообщение
This is because of the infinite loops I think.
So undo your previous edits, maybe it will fix.
No, it's not because of that. Infinite loops will only make the server unresponsive, not give you warnings/errors. Plus, where are the loops?

And if you want a guaranteed to work fix, please make it into a working script and post it here to find out what is actually wrong with it - if you don't want to, then wait for someone else to reply or either fix it on your own.
Reply
#8

You are assuming that the player is driving a vehicle. I will get back to you when I get on my laptop at work in about an hour.
Reply
#9

For your array index out of bounds. I am guessing it is that IsShopVehicle will return a value -1 and you are trying to get the array with this:
Код:
VehicleInfo[IsShopVehicle[vehicleid]][vColor1] = color1;
VehicleInfo[IsShopVehicle[vehicleid]][vColor2] = color2;
I am guessing you want to call vehicleid and not IsShopVehicle[vehicleid]
Reply
#10

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
For your array index out of bounds. I am guessing it is that IsShopVehicle will return a value -1 and you are trying to get the array with this:
Код:
VehicleInfo[IsShopVehicle[vehicleid]][vColor1] = color1;
VehicleInfo[IsShopVehicle[vehicleid]][vColor2] = color2;
I am guessing you want to call vehicleid and not IsShopVehicle[vehicleid]
This is most certainly correct. You don't post how IsShopVehicle is defined but the way its used in the if statement compared to how you're using it as an array index is different and is your issue.

For your other issue you need to post how you define IsPlayerUsingAnim, cmd_fire function and cmd_startjob function
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)