SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/01/2020, 12:34 AM   #1
Ranstom
Little Clucker
 
Join Date: Dec 2019
Posts: 2
Reputation: 0
Default I can't use the command, I get an error

I have a bug that when I die I can't use the / reappear command

Quote:
[01:17:02] [cmd] [Elliot_Crawford]: /reaparecer
[01:17:02] [debug] Run time error 4: "Array index out of bounds"
[01:17:02] [debug] Attempted to read/write array element at index 2 in array of size 2
[01:17:02] [debug] AMX backtrace:
[01:17:02] [debug] #0 0027f250 in ?? (0) from RP.amx
[01:17:02] [debug] #1 0027f628 in public cmd_reaparecer (0, 40014944) from RP.amx
[01:17:02] [debug] #2 native CallLocalFunction () from samp-server.exe
[01:17:02] [debug] #3 000008c4 in public OnPlayerCommandText (0, 40014896) from RP.amx
Code:
GCMD:reaparecer(playerid)
{
	new string[128], time_r = 60;
	if (user[playerid][jMuerto2] == 1) time_r = 480;
	else time_r = 120;
	if (reaparecer[playerid] == 0) return _Mensaje(playerid, 0, "0", "No estás en estado herido o muerto.");
	if(!CheckTimer(time_r, r_tiempo[playerid]))
	{
	    if (user[playerid][jDtipo] != 0)
	    {
			terminardroga(playerid, user[playerid][jDtipo]);
			user[playerid][jDtiempo] = 0;
		}
		if (user[playerid][jEncarcelado] == 0)
		{
		    new id = is_player_spawn(playerid);
		    format(string, sizeof(string), "[SISTEMA] %s ha usado el comando /reaparecer.", nombre_pj(playerid));
			ProxDetector(25.0, playerid, string, 0xAFB1B5FF, 0xAFB1B5FF, 0xAFB1B5FF, 0xAFB1B5FF, 0xAFB1B5FF);
			_Limuerte(playerid);
			user[playerid][jAlcohol] = 0;
			Sangre_(playerid, 100);
			Chaleco_(playerid, 0);
			user[playerid][jBanco] -= 25;
			d_estado += 25;
			if (user[playerid][jPremium] == 2)
			{
				if (user[playerid][jCasaKey] != INVALID_CASA_ID)
				{
					new casa=user[playerid][jCasaKey];
					user[playerid][jInterior] = i_Casa[casa][c_Int];
					user[playerid][jVirtualWorld] = i_Casa[casa][c_VW];
					set_pos(playerid, i_Casa[casa][cExteriorX], i_Casa[casa][cExteriorY], i_Casa[casa][cExteriorZ], i_Casa[casa][cExteriorA], i_Casa[casa][c_Int], i_Casa[casa][c_VW]);
				}
				else
				{
					user[playerid][jInterior] = 0;
					user[playerid][jVirtualWorld] = 0;
					set_pos(playerid, point_muerte[id][x_spawn], point_muerte[id][y_spawn], point_muerte[id][z_spawn], point_muerte[id][angle_spawn], 0, 0);
				    QuitarManos(playerid);
				}
			}
			else
			{
				user[playerid][jInterior] = 0;
				user[playerid][jVirtualWorld] = 0;
				set_pos(playerid, point_muerte[id][x_spawn], point_muerte[id][y_spawn], point_muerte[id][z_spawn], point_muerte[id][angle_spawn], 0, 0);
			    QuitarManos(playerid);
			}
			limpiar_chat(playerid, 20);
			format(string, sizeof(string), "Bienvenido de vuelta, %s.", nombre_pj(playerid));
			Mensaje_(playerid, 0x537CDBFF, string);
			Mensaje_(playerid, 0x537CDBFF, "Has spawneado en el hospital más cercano.");
			TogglePlayerControllable(playerid, 1);
			SetCameraBehindPlayer(playerid);
			user[playerid][jMuerto2] = 0;
			user[playerid][jMuerto] = 0;
			EliminarHerido(playerid);
			format(QuienMato[playerid], 24, "Nadie");
			reaparecer[playerid] = 0;
			_Limuerte(playerid);
		}
		else
		{
			_Limuerte(playerid);
			limpiar_chat(playerid, 20);
			user[playerid][jAlcohol] = 0;
			_HERIDO(playerid);
			user[playerid][jMuerto2] = 0;
			user[playerid][jMuerto] = 0;
			EliminarHerido(playerid);
			format(QuienMato[playerid], 24, "Nadie");
			reaparecer[playerid] = 0;
		}
	}
	else
	{
		format(string, 144, "Faltan %d segundos para que puedas usar este comando.", CheckTimer(time_r, r_tiempo[playerid]));
		Mensaje_(playerid, 0xb0b0b0ff, string);
	}
	return 1;
}
Ranstom is offline   Reply With Quote
Old 14/01/2020, 07:49 AM   #2
Calisthenics
Gangsta
 
Join Date: May 2018
Posts: 958
Reputation: 167
Default Re: I can't use the command, I get an error

The problem is in one of these functions:
pawn Code:
is_player_spawn(playerid)

_Limuerte(playerid)

QuitarManos(playerid)

EliminarHerido(playerid)

_HERIDO(playerid)
Compile with debug info: https://github.com/Zeex/samp-plugin-...ith-debug-info
to find out which one and the line.
__________________
Calisthenics is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Help] Command Error ApolloScripter Scripting Help 4 12/01/2019 08:03 PM
SERVER:Unknown command. error even the command works well GameOvr Scripting Help 20 07/09/2018 03:05 PM
Error in /seen command MayaEU Scripting Help 1 12/11/2015 05:13 PM
Error with command VirtasVarsketis Scripting Help 20 21/09/2015 02:44 PM
An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now) Tom_Dedi Help Archive 3 07/11/2010 02:01 PM


All times are GMT. The time now is 05:00 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.