[Tutorial] How to create a plugin
#21

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...
Reply
#22

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.
Reply
#23

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...
Reply
#24

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

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.
Reply
#26

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!
Reply
#27

Awesome work Ryder
Reply
#28

Good tutorial!
Reply
#29

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++ -.-
Reply
#30

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

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

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

Finally YESS thx youu
Reply
#34

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.
Reply
#35

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.
Reply
#36

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?!
Reply
#37

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?
Reply
#38

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++?
Reply
#39

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
Reply
#40

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?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)