SA-MP Forums Archive
Nitro Errors - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Nitro Errors (/showthread.php?tid=399352)



Nitro Errors - UnknownGamer - 14.12.2012

pawn Код:
#include <a_samp>

new bool:AutoNOS[MAX_PLAYERS];

public OnFilterScriptInit()
{
    AutoNOS[MAX_PLAYERS] = true;
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && AutoNOS[playerid] && (newkeys & KEY_ACTION || newkeys & KEY_FIRE)) AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    return 1;
}
Error:

pawn Код:
C:\Users\matt\Desktop\GB; Freeroam\filterscripts\nitro.pwn(7) : error 032: array index out of bounds (variable "AutoNOS")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.



Re: Nitro Errors - Glad2BeHere - 14.12.2012

if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && AutoNOS[playerid] && newkeys & KEY_ACTION || newkeys & KEY_FIRE) AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);


Re: Nitro Errors - Vince - 14.12.2012

pawn Код:
public OnFilterScriptInit()
{
    AutoNOS[MAX_PLAYERS] = true;
    return 1;
}
That's not how it works! Remove that and use this declaration instead:

pawn Код:
new bool:AutoNOS[MAX_PLAYERS] = {true, ...};