[Tutorial] Plugin development guide

Trying to make the creation of TextDraw but the server crash

Code:
 logprintf("Creating textdraw... %.1f, %.1f, %s", tdPosX, tdPosY, tdString);
	g_Invoke->callNative(&PAWN::TextDrawCreate, params[1],params[2],params[2]);
    logprintf("Creating textdraw... %.1f, %.1f, %s", tdPosX, tdPosY, tdString);
Result:
Code:
Console input: loadfs ap
10:40:33 Creating textdraw... 120.0, 12.0, Testuje xD
10:40:33 [debug] Server crashed while executing ap.amx
10:40:33 [debug] AMX backtrace:
10:40:33 [debug] #0 native StworzCreate () [0f2116e5] from TDAPI.DLL
10:40:33 [debug] #1 0000004c in public OnFilterScriptInit () at ap.pwn:9
10:40:33 [debug] System backtrace:
10:40:33 [debug] #0 0f213e15 in Invoke::callNative () from D:\GTA\serwertest\plugins\TDAPI.DLL
10:40:33 [debug] #1 0f211f88 in DrawCreate () from D:\GTA\serwertest\plugins\TDAPI.DLL
10:40:33 [debug] #2 004010b6 in ?? () from D:\GTA\serwertest\samp-server.exe
10:40:33 [debug] #3 0f4c39e2 in ?? () from D:\GTA\serwertest\plugins\crashdetect.DLL
10:40:33 [debug] #4 0f4c5e26 in ?? () from D:\GTA\serwertest\plugins\crashdetect.DLL
10:40:33 [debug] #5 0f4bbf3f in ?? () from D:\GTA\serwertest\plugins\crashdetect.DLL
10:40:33 [debug] #6 0f4c3a0e in ?? () from D:\GTA\serwertest\plugins\crashdetect.DLL
10:40:33 [debug] #7 0046a258 in ?? () from D:\GTA\serwertest\samp-server.exe
10:40:33 [debug] #8 759a1719 in ?? () from C:\Windows\syswow64\MSCTF.dll
10:40:33 [debug] #9 00496f39 in ?? () from D:\GTA\serwertest\samp-server.exe
10:40:33 [debug] #10 0048545e in ?? () from D:\GTA\serwertest\samp-server.exe
10:40:33 [debug] #11 00487653 in ?? () from D:\GTA\serwertest\samp-server.exe
10:40:33 [debug] #12 0231fd8c in ?? ()
Reply

Quote:
Originally Posted by RCON1
View Post
Trying to make the creation of TextDraw but the server crash

Code:
 logprintf("Creating textdraw... %.1f, %.1f, %s", tdPosX, tdPosY, tdString);
	g_Invoke->callNative(&PAWN::TextDrawCreate, params[1],params[2],params[2]);
    logprintf("Creating textdraw... %.1f, %.1f, %s", tdPosX, tdPosY, tdString);
Result:
Code:
Console input: loadfs ap
10:40:33 Creating textdraw... 120.0, 12.0, Testuje xD
10:40:33 [debug] Server crashed while executing ap.amx
10:40:33 [debug] AMX backtrace:
10:40:33 [debug] #0 native StworzCreate () [0f2116e5] from TDAPI.DLL
10:40:33 [debug] #1 0000004c in public OnFilterScriptInit () at ap.pwn:9
10:40:33 [debug] System backtrace:
10:40:33 [debug] #0 0f213e15 in Invoke::callNative () from D:\GTA\serwertest\plugins\TDAPI.DLL
10:40:33 [debug] #1 0f211f88 in DrawCreate () from D:\GTA\serwertest\plugins\TDAPI.DLL
10:40:33 [debug] #2 004010b6 in ?? () from D:\GTA\serwertest\samp-server.exe
10:40:33 [debug] #3 0f4c39e2 in ?? () from D:\GTA\serwertest\plugins\crashdetect.DLL
10:40:33 [debug] #4 0f4c5e26 in ?? () from D:\GTA\serwertest\plugins\crashdetect.DLL
10:40:33 [debug] #5 0f4bbf3f in ?? () from D:\GTA\serwertest\plugins\crashdetect.DLL
10:40:33 [debug] #6 0f4c3a0e in ?? () from D:\GTA\serwertest\plugins\crashdetect.DLL
10:40:33 [debug] #7 0046a258 in ?? () from D:\GTA\serwertest\samp-server.exe
10:40:33 [debug] #8 759a1719 in ?? () from C:\Windows\syswow64\MSCTF.dll
10:40:33 [debug] #9 00496f39 in ?? () from D:\GTA\serwertest\samp-server.exe
10:40:33 [debug] #10 0048545e in ?? () from D:\GTA\serwertest\samp-server.exe
10:40:33 [debug] #11 00487653 in ?? () from D:\GTA\serwertest\samp-server.exe
10:40:33 [debug] #12 0231fd8c in ?? ()
I couldn't get it to work either, i switch to using sampgdk
Reply

He wants to do it without sampgdk, you can manage?
Reply

In previous issues already did it,.

Now I have this:
Code:
PLUGIN_EXPORT void PLUGIN_CALL ProcessTick()
{
    static int tick = 0;

    tick++;

	logprintf("%d xd", tick);
}
In the console, nothing ...
Reply

Help me please,i already put on Module definition file plugin.def but when i debug it show me LINK : fatal error LNK1104: cannot open file 'plugin.def'
Reply

Quote:
Originally Posted by MikE1990
View Post
Help me please,i already put on Module definition file plugin.def but when i debug it show me LINK : fatal error LNK1104: cannot open file 'plugin.def'
Add file plugin.def and pasce:
Code:
EXPORTS
	; AMX
	Supports
	Load
	Unload
	AmxLoad
	AmxUnload
Reply


Here i already add it but i cant find it in folder
Reply

Create it then?
Reply

1> Creating library C:\Users\PC\Desktop\plugin\Debug\plugin.lib and object C:\Users\PC\Desktop\plugin\Debug\plugin.exp
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
Reply

Quote:
Originally Posted by MikE1990
View Post
1> Creating library C:\Users\PC\Desktop\plugin\Debug\plugin.lib and object C:\Users\PC\Desktop\plugin\Debug\plugin.exp
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
Install VIsual Studio 2010 Service Pack 1. I had the same problem a few days back and installing SP1 fixed it.

http://www.microsoft.com/en-us/downl....aspx?id=23691

Or just get Visual Studio 2013, it's a lot better and it can open projects created in VS2010 if you need that.
Reply

Thank you RCON1,KingHual and xeeZ i will rep u
Reply

Any idea, why the server crashes on start up, when i use "struct" in c++?
Reply

Quote:
Originally Posted by kadaradam
View Post
Any idea, why the server crashes on start up, when i use "struct" in c++?
I'm 99% sure that's not the reason. Show us code?
Reply

Quote:
Originally Posted by KingHual
View Post
I'm 99% sure that's not the reason. Show us code?
If i remove the code, the server starts well.

Code:
[11:46:33] [debug] Native backtrace:
[11:46:33] [debug] #0 536120f1 in ?? () from C:\Users\Adam\Downloads\samp03z_svr_RC1-2_win32\plugins\streamer.DLL
[11:46:33] [debug] #1 53361afe in AmxLoad () from C:\Users\Adam\Downloads\samp03z_svr_RC1-2_win32\plugins\Inventory.DLL
[11:46:33] [debug] #2 00469205 in ?? () from C:\Users\Adam\Downloads\samp03z_svr_RC1-2_win32\samp-server.exe
Code:
struct items {
	int itemid;
};
struct items example;

PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData)
{
	pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS];
	logprintf = (logprintf_t)ppData[PLUGIN_DATA_LOGPRINTF];

	logprintf("Inventory plugin loaded");

	example.itemid = 5;
	return 1;
}
Reply

I have a problem with the invoke IsPlayerConnected always returns 0

Code:
int CheckAimers()
{
	int i;
	for (i = 0; i < MaxPlayerId; i++)
	{
		logprintf( "witam [%d", g_Invoke->callNative( &PAWN::IsPlayerConnected, i ) );
Code:
...
16:30:40 witam [0
16:30:40 witam [0
16:30:40 witam [0
16:30:40 witam [0
16:30:40 witam [0
16:30:40 witam [0
16:30:40 witam [0
16:30:40 witam [0
16:30:40 witam [0
16:30:40 witam [0
Reply

Many thanks for this lesson.
Reply

While i added the filter SDK and his files to the Visual Studio it tells me when i am compiling that there is no such file or directory : SDK\amx\amx.h
How can i fix this?
Reply

This is also operates with the newer version? Microsoft Visual Studio 2013 C + +?
Reply

Yep it does (and perfectly) with Visual Studio 2012, so I can't think of any problem which could happen with VS 2013.
Reply

Quote:
Originally Posted by Admigo
View Post
While i added the filter SDK and his files to the Visual Studio it tells me when i am compiling that there is no such file or directory : SDK\amx\amx.h
How can i fix this?
Anyone?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)