Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Runtime error from crashdetect

$
0
0
Code:

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
Code:

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:
Code:

SetPlayerHealth(playa, health);
Thanks in advance!!!

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>