Runtime error from crashdetect
#1

Код:
Line 14966: [11:32:43] [debug] Run time error 4: "Array index out of bounds"
	Line 14967: [11:32:43] [debug]  Attempted to read/write array element at negative index -1
	Line 14968: [11:32:43] [debug] AMX backtrace:
	Line 14969: [11:32:43] [debug] #0 00284bd4 in ?? (... <2 arguments>) at C:\Users\Martin Ivanov\Desktop\server working\server working\gamemodes\bgmod.pwn:23193
	Line 14970: [11:32:43] [debug] #1 00018b88 in public OnPlayerCommandText (playerid=36, cmdtext[]=@0184a468 "/sethp michel123 100") at C:\Users\Martin Ivanov\Desktop\server working\server working\pawno\include\YSI\y_hooks/impl.inc:929
This is the command
Код:
if(strcmp(cmd, "/sethp", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "Използвай: /sethp [Playerid/PartOfName] [health]");
				return 1;
			}
			new playa;
			new health;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "Използвай: /sethp [Playerid/PartOfName] [health]");
				return 1;
			}
			health = strval(tmp);
			if(Dueling[playa] == true) return SendClientMessage(playerid,COLOR_RED,"Играчът е в дуел в момента!");
			if (pInfo[playerid][Adminlevel] >= 2 && pInfo[playerid][Adminlevel] <=7)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
				        SetPlayerHealth(playa, health);
			            format(string, sizeof(string), "ADMIN: Администратор %s зареди твоята кръв на %d", PlayerName(playerid), health);
						SendClientMessage(playa, COLOR_LIGHT_BLUE, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "Нямаш права, за да ползваш командата!");
			}
		}
		return 1;
	}
The line from the error is:
Код:
 SetPlayerHealth(playa, health);
Thanks in advance!!!
Reply
#2

Are you using the russian pawn compiler? It might have not thrown you an error about wrong type. SetPlayerHealth takes a Float as an argument, not a tagless value
Reply
#3

How can I check which is my compiler?
When I compile the gamemode, it says: Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Reply
#4

If you just downloaded samp-server and use default PAWNO editor, then you are using standard compiler, and I just might be wrong about the cause. One more theory I have: search your files and includes for "#if defined _ALS_SetPlayerHealth". If you get any hits, there might be another function which is executed before the real SeTPlayerHeatth.
Reply
#5

No, there isn't. I searched in all includes that I have in my gamemode.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)