OnPlayerCommandText
#1

Код:
[09:47:09]+ [debug] Run time error 4: "Array index out of bounds"
[09:47:09]+ [debug]  Accessing element at index 32 past array upper bound 31
[09:47:09]+ [debug] AMX backtrace:
[09:47:09]+ [debug] #0 0001af9c in ?? (... <2 arguments>) at C:\Users\MaHdy\Desktop\SPA Test\pawno\include\zcmd.inc:94
[09:47:09]+ [debug] #1 00006d6c in public OnPlayerCommandText (playerid=16, cmdtext[]=@0x010d1484 "/AWSGDAYUKWDGJKQAWGSGDAWGJIWDG...") at C:\Users\MaHdy\Desktop\SPA Test\pawno\include\YSI\y_hooks/impl.inc:929
[09:47:09]+ [debug] Run time error 4: "Array index out of bounds"
[09:47:09]+ [debug]  Accessing element at index 32 past array upper bound 31
[09:47:09]+ [debug] AMX backtrace:
[09:47:09]+ [debug] #0 00019c40 in ?? (... <2 arguments>) at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\ZCMD.inc:94
[09:47:09]+ [debug] #1 0000d4bc in public OnPlayerCommandText (playerid=16, cmdtext[]=@0x01080b7c "/AWSGDAYUKWDGJKQAWGSGDAWGJIWDG...") at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\YSI\y_hooks/impl.inc:929
[09:47:09]+ [debug] Run time error 4: "Array index out of bounds"
[09:47:09]+ [debug]  Accessing element at index 32 past array upper bound 31
[09:47:09]+ [debug] AMX backtrace:
[09:47:09]+ [debug] #0 000002b4 in public OnPlayerCommandText (playerid=16, cmdtext[]=@0x00005808 "/AWSGDAYUKWDGJKQAWGSGDAWGJIWDG...") at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\zcmd.inc:94
Reps , if help thanks !
Reply
#2

Would you like to show us the code?
Reply
#3

Open zcmd.inc and replace:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (zcmd_g_HasOPCS && !CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
    {
        return 1;
    }
    new
        pos,
        funcname[MAX_FUNC_NAME];
    while (cmdtext[++pos] > ' ')
    {
        funcname[pos-1] = tolower(cmdtext[pos]);
    }
    format(funcname, sizeof(funcname), "cmd_%s", funcname);
    while (cmdtext[pos] == ' ') pos++;
    if (!cmdtext[pos])
    {
        if (zcmd_g_HasOPCE)
        {
            return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, "\1"));
        }
        return CallLocalFunction(funcname, "is", playerid, "\1");  
    }
    if (zcmd_g_HasOPCE)
    {
        return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, cmdtext[pos]));
    }
    return CallLocalFunction(funcname, "is", playerid, cmdtext[pos]);
}
with:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (zcmd_g_HasOPCS && !CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
    {
        return 1;
    }
    new
        pos,
        funcname[MAX_FUNC_NAME];
    while (cmdtext[++pos] > ' ')
    {
        if(pos > MAX_FUNC_NAME) break;
        else funcname[pos-1] = tolower(cmdtext[pos]);
    }
    format(funcname, sizeof(funcname), "cmd_%s", funcname);
    while (cmdtext[pos] == ' ') pos++;
    if (!cmdtext[pos])
    {
        if (zcmd_g_HasOPCE)
        {
            return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, "\1"));
        }
        return CallLocalFunction(funcname, "is", playerid, "\1");  
    }
    if (zcmd_g_HasOPCE)
    {
        return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, cmdtext[pos]));
    }
    return CallLocalFunction(funcname, "is", playerid, cmdtext[pos]);
}
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Open zcmd.inc and replace:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (zcmd_g_HasOPCS && !CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
    {
        return 1;
    }
    new
        pos,
        funcname[MAX_FUNC_NAME];
    while (cmdtext[++pos] > ' ')
    {
        funcname[pos-1] = tolower(cmdtext[pos]);
    }
    format(funcname, sizeof(funcname), "cmd_%s", funcname);
    while (cmdtext[pos] == ' ') pos++;
    if (!cmdtext[pos])
    {
        if (zcmd_g_HasOPCE)
        {
            return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, "\1"));
        }
        return CallLocalFunction(funcname, "is", playerid, "\1");  
    }
    if (zcmd_g_HasOPCE)
    {
        return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, cmdtext[pos]));
    }
    return CallLocalFunction(funcname, "is", playerid, cmdtext[pos]);
}
with:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (zcmd_g_HasOPCS && !CallLocalFunction("OnPlayerCommandReceived", "is", playerid, cmdtext))
    {
        return 1;
    }
    new
        pos,
        funcname[MAX_FUNC_NAME];
    while (cmdtext[++pos] > ' ')
    {
        if(pos > MAX_FUNC_NAME) break;
        else funcname[pos-1] = tolower(cmdtext[pos]);
    }
    format(funcname, sizeof(funcname), "cmd_%s", funcname);
    while (cmdtext[pos] == ' ') pos++;
    if (!cmdtext[pos])
    {
        if (zcmd_g_HasOPCE)
        {
            return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, "\1"));
        }
        return CallLocalFunction(funcname, "is", playerid, "\1");  
    }
    if (zcmd_g_HasOPCE)
    {
        return CallLocalFunction("OnPlayerCommandPerformed", "isi", playerid, cmdtext, CallLocalFunction(funcname, "is", playerid, cmdtext[pos]));
    }
    return CallLocalFunction(funcname, "is", playerid, cmdtext[pos]);
}
Thank you ur always in service best
EDIT:
I got this now
Код:
[15:55:52]+ Number of vehicle models: 86
[15:56:35]+ Incoming connection: 192.168.1.114:51652
[15:56:35]+ [join] test3113 has joined the server (0:192.168.1.114)
[15:56:51]+ [debug] Run time error 4: "Array index out of bounds"
[15:56:51]+ [debug]  Accessing element at index 32 past array upper bound 31
[15:56:51]+ [debug] AMX backtrace:
[15:56:51]+ [debug] #0 0001af9c in ?? (... <2 arguments>) at C:\Users\MaHdy\Desktop\SPA Test\pawno\include\zcmd.inc:94
[15:56:51]+ [debug] #1 00006d6c in public OnPlayerCommandText (playerid=0, cmdtext[]=@0x010d152c "/gsaaaaaaaaaaaaaaaaaaaaaaaaaaa...") at C:\Users\MaHdy\Desktop\SPA Test\pawno\include\YSI\y_hooks/impl.inc:929
[15:56:51]+ [debug] Run time error 4: "Array index out of bounds"
[15:56:51]+ [debug]  Accessing element at index 32 past array upper bound 31
[15:56:51]+ [debug] AMX backtrace:
[15:56:51]+ [debug] #0 00019c40 in ?? (... <2 arguments>) at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\ZCMD.inc:94
[15:56:51]+ [debug] #1 0000d4bc in public OnPlayerCommandText (playerid=0, cmdtext[]=@0x01080b7c "/gsaaaaaaaaaaaaaaaaaaaaaaaaaaa...") at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\YSI\y_hooks/impl.inc:929
[15:56:51]+ [debug] Run time error 4: "Array index out of bounds"
[15:56:51]+ [debug]  Accessing element at index 32 past array upper bound 31
[15:56:51]+ [debug] AMX backtrace:
[15:56:51]+ [debug] #0 000002b4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0x00005808 "/gsaaaaaaaaaaaaaaaaaaaaaaaaaaa...") at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\zcmd.inc:94
[15:56:51]+ [debug] Run time error 4: "Array index out of bounds"
[15:56:51]+ [debug]  Accessing element at index 32 past array upper bound 31
[15:56:51]+ [debug] AMX backtrace:
[15:56:51]+ [debug] #0 00000200 in public OnPlayerCommandText (0x00000000, 0x000011e8) from maths.amx
[15:56:53]+ [debug] Run time error 4: "Array index out of bounds"
[15:56:53]+ [debug]  Accessing element at index 32 past array upper bound 31
[15:56:53]+ [debug] AMX backtrace:
[15:56:53]+ [debug] #0 0001af9c in ?? (... <2 arguments>) at C:\Users\MaHdy\Desktop\SPA Test\pawno\include\zcmd.inc:94
[15:56:53]+ [debug] #1 00006d6c in public OnPlayerCommandText (playerid=0, cmdtext[]=@0x010d152c "/gsaaaaaaaaaaaaaaaaaaaaaaaaaaa...") at C:\Users\MaHdy\Desktop\SPA Test\pawno\include\YSI\y_hooks/impl.inc:929
[15:56:53]+ [debug] Run time error 4: "Array index out of bounds"
[15:56:53]+ [debug]  Accessing element at index 32 past array upper bound 31
[15:56:53]+ [debug] AMX backtrace:
[15:56:53]+ [debug] #0 00019c40 in ?? (... <2 arguments>) at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\ZCMD.inc:94
[15:56:53]+ [debug] #1 0000d4bc in public OnPlayerCommandText (playerid=0, cmdtext[]=@0x01080b7c "/gsaaaaaaaaaaaaaaaaaaaaaaaaaaa...") at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\YSI\y_hooks/impl.inc:929
[15:56:53]+ [debug] Run time error 4: "Array index out of bounds"
[15:56:53]+ [debug]  Accessing element at index 32 past array upper bound 31
[15:56:53]+ [debug] AMX backtrace:
[15:56:53]+ [debug] #0 000002b4 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0x00005808 "/gsaaaaaaaaaaaaaaaaaaaaaaaaaaa...") at C:\Users\MaHdy\Desktop\SPA Server original\pawno\include\zcmd.inc:94
[15:56:53]+ [debug] Run time error 4: "Array index out of bounds"
[15:56:53]+ [debug]  Accessing element at index 32 past array upper bound 31
[15:56:53]+ [debug] AMX backtrace:
[15:56:53]+ [debug] #0 00000200 in public OnPlayerCommandText (0x00000000, 0x000011e8) from maths.amx
[15:56:55]+ [part] test3113 has left the server (0:1)
Reply
#5

Using the second code I posted prevents it from happening. Are you sure you replaced it and save it? Also that you modified the correct zcmd.inc that you use for your scripts? It still shows the line 94 and the array is on line 95 which prooves the include doesn't use:
pawn Код:
if(pos > MAX_FUNC_NAME) break; // preventing the runtime error.
else funcname[pos-1] = tolower(cmdtext[pos]);
Reply
#6

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Using the second code I posted prevents it from happening. Are you sure you replaced it and save it? Also that you modified the correct zcmd.inc that you use for your scripts? It still shows the line 94 and the array is on line 95 which prooves the include doesn't use:
pawn Код:
if(pos > MAX_FUNC_NAME) break; // preventing the runtime error.
else funcname[pos-1] = tolower(cmdtext[pos]);
can you upload new zcmd the fixed one please
Reply
#7

Quote:
Originally Posted by Mahde
Посмотреть сообщение
can you upload new zcmd the fixed one please
http://www.solidfiles.com/d/23bf4d1698/zcmd.inc
Reply
#8

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Thank you best helper in samp forum i want ask another question i v 2 commands one is admins and other is /vips how to integrate admins and vips in one command like /admins u se vips and admins here is the codes:
Код:
CMD:admins(playerid,params[])
{
   new IsOnline = 0;
   strdel(JLstring,0,500);
   foreach(Player, i)
   {
      if (pInfo[i][pLevel] >= 1 && pInfo[i][AHide] == 0)
	  {
 		      switch(pInfo[i][pLevel])
              {
			      case 1: {
				  LevelName = ADMIN_LEVEL_1;
				  LevelColor = LEVEL_1_COLOR;
				  }
				  case 2: {
				  LevelName = ADMIN_LEVEL_2;
				  LevelColor = LEVEL_2_COLOR;
				  }
				  case 3: {
				  LevelName = ADMIN_LEVEL_4;
				  LevelColor = LEVEL_3_COLOR;
				  }
				  case 4: {
				  LevelName = ADMIN_LEVEL_3;
				  LevelColor = LEVEL_4_COLOR;
				  }
				  case 5: {
				  LevelName = ADMIN_LEVEL_5;
				  LevelColor = LEVEL_5_COLOR;
				  }
				  default: {
				  LevelName = ADMIN_LEVEL_6;
				  LevelColor = LEVEL_6_COLOR;
				  }
	          }
	          if (IsPlayerAdmin(i)) format(Jstring, 128, "{FF0000}%s - Level: %d (RCON Administrator)\n",GetName(i),pInfo[i][pLevel]);
	          else format(Jstring, 128, "%s%s - Level: %d (%s)\n",LevelColor,GetName(i),pInfo[i][pLevel],LevelName);
			  strcat(JLstring, Jstring, sizeof(JLstring));
			  IsOnline++;
		}
   }
   if (IsOnline == 0)
   ShowPlayerDialog(playerid,JDIALOGS+165,DIALOG_STYLE_MSGBOX,"{00FFE6}Online admins","{FF0000}No admins are online!" ,"OK","");
   else
   {
       if(IsOnline == 1) ShowPlayerDialog(playerid,JDIALOGS+165,DIALOG_STYLE_MSGBOX,"{00FFE6}1 admin online",JLstring ,"OK","");
	   else format(Jstring, 128, "{00FFE6}%d admins online",IsOnline), ShowPlayerDialog(playerid,JDIALOGS+165,DIALOG_STYLE_MSGBOX,Jstring,JLstring ,"OK","");
   }
   strdel(JLstring,0,500);
   return 1;
}
VIPS:
Код:
CMD:vips(playerid,params[])
{
   new IsOnline = 0;
   strdel(JLstring,0,500);
   foreach(Player, i)
   {
      if (pInfo[i][Donator] >= 1)
	  {
 		      switch(pInfo[i][Donator])
              {
			      case 1:
				  {
					  LevelName = VIP_LEVEL_1;
					  LevelColor = VIP_1_COLOR;
				  }
				  case 2:
				  {
					  LevelName = VIP_LEVEL_2;
					  LevelColor = VIP_2_COLOR;
				  }
				  default:
				  {
					  LevelName = VIP_LEVEL_3;
					  LevelColor = VIP_3_COLOR;
				  }
	          }
			  format(Jstring, 128, "%s%s - Level: %d (%s)\n",LevelColor,GetName(i),pInfo[i][Donator],LevelName);
			  strcat(JLstring, Jstring, sizeof(JLstring));
			  IsOnline++;
		}
   }
   if (IsOnline == 0)
   ShowPlayerDialog(playerid,JDIALOGS+165,DIALOG_STYLE_MSGBOX,"{00FFE6}Online V.I.P members","{FF0000}No V.I.P members online!" ,"OK","");
   else
   {
       if(IsOnline == 1) ShowPlayerDialog(playerid,JDIALOGS+165,DIALOG_STYLE_MSGBOX,"{00FFE6}1 V.I.P member online",JLstring ,"OK","");
	   else format(Jstring, 128, "{00FFE6}%d V.I.P members online",IsOnline), ShowPlayerDialog(playerid,JDIALOGS+165,DIALOG_STYLE_MSGBOX,Jstring,JLstring ,"OK","");
   }
   strdel(JLstring,0,500);
   return 1;
}
Thank you!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)