Errors..
#1

Hi,
i activated crashdetect plugins and it says
Код:
[14:44:52] [debug] Run time error 4: "Array index out of bounds"
[14:44:52] [debug]   Accessing element at index 65535 past array upper bound 2283564
[14:44:52] [debug] Backtrace (most recent call first):
[14:44:52] [debug] #0  public OnPlayerDeath()+0xb9030 from cws8.0M.amx
everytime anyone dies...
This is Onplayerdeath, can you help me to find the mistake?
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	if(mod_guerra == true) return MortiDuranteLaGuerra(playerid,killerid);
    death[playerid]++;
    kills[killerid]++;
    soldibancacws -= 2000;
    uscitebk += 2000;
    GivePlayerMoney(killerid, (GetPlayerMoney(playerid)));
    ResetPlayerMoney(playerid);
    ricaricapunticaz(killerid);
    GameTextForPlayer(playerid, "~r~Ucciso", 1000, 2);
    SendDeathMessage(killerid, playerid, reason);
	new name[MAX_PLAYER_NAME];
	new string[256];
	new deathreason[20];
	GetPlayerName(playerid, name, sizeof(name));
	GetWeaponName(reason, deathreason, 20);
	new killer[MAX_PLAYER_NAME];
	GetPlayerName(killerid, killer, sizeof(killer));
	if (strlen(deathreason) > 0)
	{
	    format(string, sizeof(string), "[KILL] %s ha ammazzato %s. (%s)", killer, name, deathreason);
	}
	    else
	{
	    format(string, sizeof(string), "[KILL] %s ha ammazzato %s.", killer, name);
	}
if(ondm[playerid] == true) return ondm[playerid] = false;
SendClientMessageToAll(0xEB000FFF, string);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(killerid, X, Y, Z);
if(X >= 1379.583 && X <= 2136.347 && Y >= -2649.059 && Y <= -2412.194)//Anti DM 1 /stuntls
{
    Autowarn(killerid);
    multa(killerid);
    GivePlayerMoney(playerid,1200);
    GivePlayerMoney(killerid,-1700);
}
if(X >= -2627.522 && X <=  -1798.393 && Y >= 1436.379 && Y <= 2323.897)//Anti DM 2 /stuntsf
{
    Autowarn(killerid);
    multa(killerid);
    GivePlayerMoney(playerid,1200);
    GivePlayerMoney(killerid,-1700);
}
    return 1;
}
On pawn it doesn't say errors..
Thanks a lot.
P.S. sorry for bad english, i'm italian..
Reply
#2

Don't use killerid as an array index before having verified that it is actually a valid player! If the player dies by "natural" causes then killerid will be INVALID_PLAYER_ID (65535).
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Don't use killerid as an array index before having verified that it is actually a valid player! If the player dies by "natural" causes then killerid will be INVALID_PLAYER_ID (65535).
Thank you,fixed
Reply
#4

I have another problem:
My server crashes after database connection (on windows all works, the problem is on linux)
Quote:

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[10:23:03] filterscripts = "" (string)
[10:23:03]
[10:23:03] Server Plugins
[10:23:03] --------------
[10:23:03] Loading plugin: streamer.so
[10:23:03]

*** Streamer Plugin v2.7.2 by Incognito loaded ***

[10:23:03] Loaded.
[10:23:03] Loading plugin: sscanf.so
[10:23:03]

[10:23:03] ===============================

[10:23:03] sscanf plugin loaded.

[10:23:03] Version: 2.8.2

[10:23:03] © 2012 Alex "******" Cole

[10:23:03] ===============================

[10:23:03] Loaded.
[10:23:03] Loading plugin: mail.so
[10:23:03] Plugin mail.dll got loaded.
[10:23:03] Loaded.
[10:23:03] Loading plugin: mysql.so
[10:23:03]

> MySQL plugin R5 successfully loaded.

[10:23:03] Loaded.
[10:23:03] Loading plugin: dns.so
[10:23:03]

*** DNS Plugin v2.4 by Incognito loaded ***

[10:23:03] Loaded.
[10:23:03] Loading plugin: crashdetect.so
[10:23:03] crashdetect v4.1.2 is OK.
[10:23:03] Loaded.
[10:23:03] Loaded 6 plugins.

[10:23:03]
[10:23:03] Filterscripts
[10:23:03] ---------------
[10:23:03] Loaded 0 filterscripts.

[10:23:03] Connessione al database in corso ....
[10:23:03] [DB] STEP: Connessione Effettuata
[10:23:03] [debug] Server crashed while executing cws8.0M.amx
[10:23:03] [debug] Backtrace (most recent call first):
[10:23:03] [debug] #0 native mysql_free_result() from mysql.so
[10:23:03] [debug] #1 0x00109894()+0x20 from cws8.0M.amx
[10:23:03] [debug] #2 public SSCANF_OnGameModeInit()+0x208 from cws8.0M.amx
[10:23:03] [debug] #3 public OnGameModeInit()+0x1e9c from cws8.0M.amx

Reply
#5

Help
Reply
#6

Bump
Reply
#7

Bump
Reply
#8

Bump
Reply
#9

Quote:
Originally Posted by Salva2000
Посмотреть сообщение
Help
Quote:
Originally Posted by Salva2000
Посмотреть сообщение
Bump
Quote:
Originally Posted by Salva2000
Посмотреть сообщение
Bump
Quote:
Originally Posted by Salva2000
Посмотреть сообщение
Bump
Quote:
Originally Posted by ******
Посмотреть сообщение
No Double Posting - There is a modify button , use it. However, bumping a topic in which you have or require further information is allowed after at least 24 hours. Note that two identical posts appearing at the same time is usually a mistake attributed to lag, and will not be penalized (but the second one will be removed).
What part of "after at least 24 hours" in this rule did you not understand?

Tell me how many infraction points you will receive from thread bumping and I will look into your question.
Forum rules
Reply
#10

Quote:
Originally Posted by introzen
Посмотреть сообщение
What part of "after at least 24 hours" in this rule did you not understand?

Tell me how many infraction points you will receive from thread bumping and I will look into your question.
Forum rules
Sorry, i didn't know the rules. 8 points.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)