I get the following error when I run my own plugin:
"Bad entity in IndexOfEdict() index -1487468 pEdict 0F0B0FA0 sv.edicts 10D10010"
I know it's the following piece of code that causes this, since it didn't give the error with previous versions (without that piece of code)
Code:
// Global
new Handle:ammoOffset;
new Handle:clipOffset;
public OnPluginStart() {
ammoOffset = FindSendPropInfo("CTFPlayer", "m_iAmmo");
clipOffset = FindSendPropInfo("CTFWeaponBase", "m_iClip1");
}
// The actual piece of code
for(new i=1;i<=MaxClients;i++) {
if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i)) {
for (new n = 1; n < 4; n++)
{
SetEntData(i, ammoOffset + (n * 4), 0);
}
// Set their current weapon clips to 1
if ((GetEntData(GetPlayerWeaponSlot(i, 0), 4)) > 1) {
for (new n = 0; i < n; n++)
{
SetEntData(GetPlayerWeaponSlot(i, n), clipOffset, 1);
}
}
}
I chopped away all the unnecesary stuff.
}