Just Practicing (Objects / edit objects)
#1

Hello, I'm just practicing scripting a bit in my free time so this time I encountered "Error" that's causing the function not to do what's supposed to do. (sending the message of the current object that's placed)

EDIT:
Here is the code I'm using to create a table (it's just an object..) - just in case you want to see.
Code:
CreatePokerTable(playerid,tableid)
{
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	
	Table[tableid][X] = Float:x;
	Table[tableid][Y] = Float:y;
	Table[tableid][Z] = Float:z;
	CreateDynamicObject(19474, x, y, z, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 200.0);
 	//CreateObject(19474, x, y, z, 0.0, 0.0, 96.0);
 	SendClientMessage(playerid, -1, "You have sucessfuly created a table please use /edittable to place it at desired location!");
	return 1;
}
Code:
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
// stuff above
if(response == EDIT_RESPONSE_FINAL)
	{
	    new Float:x, Float:y, Float:z;
		GetObjectPos(objectid, x, y, z);
		Table[tableid][X] = Float:x;
		Table[tableid][Y] = Float:y;
		Table[tableid][Z] = Float:z;
		
		new Float:RotX,Float:RotY,Float:RotZ;
		GetObjectRot(objectid, RotX, RotY, RotZ);
		Table[tableid][RX] = Float:RotX;
		Table[tableid][RY] = Float:RotY;
		Table[tableid][RZ] = Float:RotZ;
		format(testmsg,sizeof(testmsg),"Table is set at X: %f | Y: %f | Z: %f | RX: %f | RY: %f | RZ: %f",x,y,z,RotX,RotY,RotZ);
		SendClientMessage(playerid,-1, testmsg);	
	}
       // stuff below
Message I get in .exe is the following:

Code:
[16:47:14] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
[16:47:14] Script[gamemodes/Table.amx]: Run time error 20: "Invalid index parameter (bad entry point)"
[16:47:14] Number of vehicle models: 0
[16:47:14] New version of CrashDetect is available for download (4.13)
[16:47:17] [connection] 127.0.0.1:52630 requests connection cookie.
[16:47:18] [connection] incoming connection: 127.0.0.1:52630 id: 0
[16:47:19] [join] Smithson has joined the server (0:127.0.0.1)
[16:47:33] Player 0 selected object 1
[16:47:34] [debug] Run time error 4: "Array index out of bounds"
[16:47:34] [debug]  Accessing element at index 108 past array upper bound 9
[16:47:34] [debug] AMX backtrace:
[16:47:34] [debug] #0 0001a284 in public Streamer_OnPlayerEditObject (0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x43072df4, 0xc291eeb4, 0x3fb70000, 0x00000000, 0x00000000, 0x00000000) from Poker.amx
[16:47:34] [debug] #1 00019b24 in public OnPlayerEditObject (0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x43072df4, 0xc291eeb4, 0x3fb70000, 0x00000000, 0x00000000, 0x00000000) from Poker.amx
[16:47:35] [debug] Run time error 4: "Array index out of bounds"
[16:47:35] [debug]  Accessing element at index 108 past array upper bound 9
[16:47:35] [debug] AMX backtrace:
[16:47:35] [debug] #0 0001a284 in public Streamer_OnPlayerEditObject (0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x43072df4, 0xc291eeb4, 0x3f1ea3d8, 0x00000000, 0x00000000, 0x00000000) from Poker.amx
[16:47:35] [debug] #1 00019b24 in public OnPlayerEditObject (0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x43072df4, 0xc291eeb4, 0x3f1ea3d8, 0x00000000, 0x00000000, 0x00000000) from Poker.amx
[16:47:35] [debug] Run time error 4: "Array index out of bounds"
[16:47:35] [debug]  Accessing element at index 108 past array upper bound 9
[16:47:35] [debug] AMX backtrace:
[16:47:35] [debug] #0 0001a284 in public Streamer_OnPlayerEditObject (0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x43072df4, 0xc291eeb4, 0x3f82851f, 0x00000000, 0x00000000, 0x00000000) from Poker.amx
[16:47:35] [debug] #1 00019b24 in public OnPlayerEditObject (0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x43072df4, 0xc291eeb4, 0x3f82851f, 0x00000000, 0x00000000, 0x00000000) from Poker.amx
[16:47:35] [debug] Run time error 4: "Array index out of bounds"
[16:47:35] [debug]  Accessing element at index 108 past array upper bound 9
[16:47:35] [debug] AMX backtrace:
[16:47:35] [debug] #0 0001a284 in public Streamer_OnPlayerEditObject (0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x43072df4, 0xc291eeb4, 0x3f598520, 0x00000000, 0x00000000, 0x00000000) from Poker.amx
[16:47:35] [debug] #1 00019b24 in public OnPlayerEditObject (0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x43072df4, 0xc291eeb4, 0x3f598520, 0x00000000, 0x00000000, 0x00000000) from Poker.amx
[16:47:36] [debug] Run time error 4: "Array index out of bounds"
[16:47:36] [debug]  Accessing element at index 108 past array upper bound 9
[16:47:36] [debug] AMX backtrace:
[16:47:36] [debug] #0 0001a284 in public Streamer_OnPlayerEditObject (0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x43072df4, 0xc291eeb4, 0x3f5c147c, 0x00000000, 0x00000000, 0x00000000) from Poker.amx
[16:47:36] [debug] #1 00019b24 in public OnPlayerEditObject (0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x43072df4, 0xc291eeb4, 0x3f5c147c, 0x00000000, 0x00000000, 0x00000000) from Poker.amx
And the function doesn't display message when I clicked "save" button thanks for help in advance
Reply


Messages In This Thread
Just Practicing (Objects / edit objects) - by Lajko1 - 09.06.2017, 15:04
Re: Just Practicing (Objects / edit objects) - by Vince - 09.06.2017, 16:21
Re: Just Practicing (Objects / edit objects) - by Lajko1 - 09.06.2017, 17:04
Re: Just Practicing (Objects / edit objects) - by Pottus - 09.06.2017, 21:09
Re: Just Practicing (Objects / edit objects) - by Lajko1 - 09.06.2017, 22:19
Re: Just Practicing (Objects / edit objects) - by Lajko1 - 10.06.2017, 09:00
Re: Just Practicing (Objects / edit objects) - by Pottus - 10.06.2017, 15:15

Forum Jump:


Users browsing this thread: 1 Guest(s)