SA-MP Forums Archive
[Tutorial] How to create a plugin - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to create a plugin (/showthread.php?tid=253436)

Pages: 1 2 3 4 5 6


Re: How to create a plugin - Zh3r0 - 07.05.2011

Quote:
Originally Posted by RyDeR`
View Post
You probably missed some steps starting from 9.
Re-followed the steps and yeah i missed inserting a name.def inside Linker > Input.
Done that, now still gives me that error...


Re: How to create a plugin - RyDeR` - 07.05.2011

Did you recompile with F7, and copied the new .dll to plugins (I'm sure you did, but who knows)?

Otherwise, I suggest you to delete that project and retry everything.


Re: How to create a plugin - Zh3r0 - 07.05.2011

Quote:
Originally Posted by RyDeR`
View Post
Did you recompile with F7, and copied the new .dll to plugins (I'm sure you did, but who knows)?

Otherwise, I suggest you to delete that project and retry everything.
Done everything according to your tutorial, pressed F7, compiled successfully, copied the .dll from the debug folder into my server into plugins folder, added on plugins test inside server.cfg and that's almost it...


PS: I retried to make it again, didn't worked.
Gotta re-do it again to see...


Re: How to create a plugin - linuxthefish - 07.05.2011

Time to have some fun, I've been wanting to learn about this for ages!


Re: How to create a plugin - RyDeR` - 07.05.2011

My bad. I wrote it correct but the picture is wrong. You have to write *.def next to "Module Definition File".

Changing picture now..

EDIT: Changed.


Re: How to create a plugin - Zh3r0 - 07.05.2011

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
My bad. I wrote it correct but the picture is wrong. You have to write *.def next to "Module Definition File".

Changing picture now..

EDIT: Changed.
Works just fine now! Thanks!


Re: How to create a plugin - Ironboy - 07.05.2011

Awesome work Ryder


Re: How to create a plugin - Institute - 07.05.2011

Good tutorial!


Re: How to create a plugin - Hiddos - 07.05.2011

Quote:
Originally Posted by Deskoft
View Post
THIS will make a boost in the plugins
If that happens then I will create a discussion topic suggesting that useless releases will be deleted. There's no need coding a plugin if you can do it in PAWN already, with minor exceptions.

Thanks for the tut. Now let's hope people won't go moronic about C++ -.-


Re: How to create a plugin - RyDeR` - 07.05.2011

It's not that easy so I don't think it will happen.


Re: How to create a plugin - Michael@Belgium - 08.05.2011

Wow Thank you so much !!! XD I think it's the first tut for making plugins ?!
It's awesome


Re: How to create a plugin - SkizzoTrick - 08.05.2011

Finally :O
Good job Ryder!Explainfull and very usefull,thanks.


Re: How to create a plugin - iJumbo - 08.05.2011

Finally YESS thx youu


Re: How to create a plugin - me-borno - 08.05.2011

Ok, ive figuered out that whould work at all..

this is my new atempt:

Код:
static cell AMX_NATIVE_CALL GetVehicleName(AMX *amx, cell *params)
{
char* name = "No Vehicle";
...
return char (name);
}
but when i try this, the server actually crashes :S
it builds fine, but still... its crashes.


Re: How to create a plugin - RyDeR` - 08.05.2011

Quote:
Originally Posted by me-borno
Посмотреть сообщение
Ok, ive figuered out that whould work at all..

this is my new atempt:

Код:
static cell AMX_NATIVE_CALL GetVehicleName(AMX *amx, cell *params)
{
char* name = "No Vehicle";
...
return char (name);
}
but when i try this, the server actually crashes :S
it builds fine, but still... its crashes.
You can't return a string that you can use in PAWN. You have to use amx_GetAddr and amx_SetString.


Re: How to create a plugin - me-borno - 08.05.2011

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
You can't return a string that you can use in PAWN. You have to use amx_GetAddr and amx_SetString.
Hmm.. could you explain that a bit more? perhaps in dutch? xD

Edit:
Ok, i almost found out how it works.
i made a function wich returns the vehicle name, and i almost works!

Код:
static cell AMX_NATIVE_CALL GetVehicleName(AMX *amx, cell *params)
{
	cell* addr = NULL;
	char* name = "No Vehicle";
	switch(params[1])
	{
		case 400: name = "Landstalker"; break;
		case 401: name = "Bravura"; break;
		case 402: name = "Buffalo"; break;
		case 403: name = "Linerunner"; break;
                ...
		case 609: name = "Boxville"; break;
		case 610: name = "Farm Plow"; break;
		case 611: name = "Utility Trailer"; break;
	}
	amx_GetAddr(amx, params[2], &addr);
	amx_SetString(addr, name, NULL, NULL, 64);
	logprintf("DEBUG: addr: %d name: %s", addr, name); 
	return 1;
}
and when i use it like this in Pawno:
Код:
printf("<Debug> %s", GetVehicleName(401));
it outputs
Код:
[21:23:27] <Debug> ☺
[21:23:27] Bravura
Whats wrong with that DEVELISH SMILEY?!


Re: How to create a plugin - Heavy_Badass - 09.05.2011

thank you, this will give me a jumpstart without having to figure this out.

does anyone have experience with this + netbeans if you want to run it on a linux server?


Re: How to create a plugin - RyDeR` - 13.05.2011

I have a question about this. Maybe someone knows? I know how to call natives from SA-MP to C++, but I don't know how to do it for functions like GetPlayerPos. Anyone has any idea how we can use GetPlayerPos in C++?


Re: How to create a plugin - Fj0rtizFredde - 13.05.2011

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
I have a question about this. Maybe someone knows? I know how to call natives from SA-MP to C++, but I don't know how to do it for functions like GetPlayerPos. Anyone has any idea how we can use GetPlayerPos in C++?
I think you use PawnCommand.. I did read a thread a long time ago about that.. Let me find it.

Here it is: https://sampforum.blast.hk/showthread.php?tid=87938


Re: How to create a plugin - Sasino97 - 14.05.2011

THANKS VERY MUCH!!!!!!

This tutorial is what I was looking for!!!!!!!!!

But a question, what C++ functions can I use to make a working plug-in on SA-MP?