SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 22/07/2012, 12:32 PM   #61
NetKiel
Big Clucker
 
Join Date: Feb 2011
Posts: 63
Reputation: 0
Default AW: Plugin development guide

I get a strange Error, when i try to start my plugin on Linux.
it always says
Quote:
Failed (plugins/Plugin.so: undefined symbol: sampgdk_TextDrawShowForPlayer)
I compiled all .cpp files with the libary included but nothing worked.
NetKiel is offline   Reply With Quote
Old 31/07/2012, 11:42 PM   #62
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 4,247
Reputation: 1137
Default Re: Plugin development guide

Does anyone know just how to get the SAMPGDK library installed?

Code:
#include <sampgdk/a_samp.h>
I want to know how I can have it be included like that. Thanks.
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is online now   Reply With Quote
Old 02/08/2012, 02:06 AM   #63
Rancho
Big Clucker
 
Join Date: Jun 2012
Posts: 88
Reputation: 59
Default Re: Plugin development guide

Quote:
Originally Posted by Rancho View Post
Hello, I'm trying to make something..
C++:
Code:
int playerid = params[1];
	int idx;
	if(!amx_FindPublic(amx,"__GetPlayerName",&idx)){
		cell ret;
		cell* str_phys;
		cell amxaddr;
		amx_Push(amx,playerid);
		amx_Allot(amx,24,&amxaddr,&str_phys);
		
		amx_Push(amx,amxaddr);
		amx_Exec(amx,&ret,idx);

		char name[24];
		amx_GetString(name,str_phys,0,24);
		amx_Release(amx,amxaddr);
		printf("%s",name);
	}else{
		printf("Native");
	}
Pawn:
Code:
forward __GetPlayerName(playerid,name[]);
public __GetPlayerName(playerid,name[]){
	GetPlayerName(playerid,name,MAX_PLAYER_NAME);
}
It doesn't crash but prints player name: "" (empty)

P.S: I don't want to use invoke or gdk.I want to make this.
P.S: playerid is correct.I tested.
I fixed, I was push playerid, string_addr but I couldn't think reverse pushing sort.

Fİrst I pushed string addr, after playerid.It worked for me.
Rancho is offline   Reply With Quote
Old 06/08/2012, 10:04 PM   #64
misho1
Gangsta
 
misho1's Avatar
 
Join Date: Feb 2011
Location: Egypt
Posts: 768
Reputation: 23
Default Re: Plugin development guide

DELETED
__________________
196.205.159.181:7777
Gaming Overload server
Mappers needed, Reward setting him admin level 3 to level 5 and that depends on his mapping skills
misho1 is offline   Reply With Quote
Old 26/09/2012, 05:57 PM   #65
Edvin
Gangsta
 
Edvin's Avatar
 
Join Date: Dec 2010
Posts: 868
Reputation: 71
Default Re: Plugin development guide

Wow, awesome tutorial, very very good explained.
Edvin is offline   Reply With Quote
Old 11/11/2012, 07:52 AM   #66
Plovix
Gangsta
 
Plovix's Avatar
 
Join Date: Dec 2011
Location: Croatia
Posts: 493
Reputation: 92
Default Re: Plugin development guide

Thank you very much for tutorial,very useful for me!
Plovix is offline   Reply With Quote
Old 22/11/2012, 08:02 PM   #67
Megalock
Little Clucker
 
Join Date: Jan 2012
Posts: 6
Reputation: 0
Exclamation Respuesta: Plugin development guide

This code:

Code:
#include "..\SDK\amx\amx.h"
#include "..\SDK\plugincommon.h"
#include "..\SDK\Invoke.h"

typedef void (*logprintf_t)(char* format, ...);


logprintf_t logprintf;
extern void *pAMXFunctions;



cell AMX_NATIVE_CALL HelloWorld(AMX* amx, cell* params)
{
    logprintf("This was printed from the Test plugin! Yay!");
    return 1;
}

PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() 
{
    return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES;
}

PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData) 
{
    pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS];
    logprintf = (logprintf_t) ppData[PLUGIN_DATA_LOGPRINTF];
    logprintf(" * Test plugin was loaded.");
    return true;
}

PLUGIN_EXPORT void PLUGIN_CALL Unload()
{
    logprintf(" * Test plugin was unloaded.");
}

cell AMX_NATIVE_CALL WhereIsPlayer(AMX* amx, cell* params)
{
    float
        x = NULL,
        y = NULL,
        z = NULL;

    //Get the player's position (and check to see if he is even connected).
    if(g_Invoke->callNative(&PAWN::GetPlayerPos, params[1], &x, &y, &z))
    {
        char name[24];

        //Get the rest of the player's information (name, interior, and virtualworld) and print it.
        g_Invoke->callNative(&PAWN::GetPlayerName, params[1], name);
        int interior = g_Invoke->callNative(&PAWN::GetPlayerInterior, params[1]);
        int virtualworld = g_Invoke->callNative(&PAWN::GetPlayerVirtualWorld, params[1]);

        logprintf("%s is at X: %.2f, Y: %.2f, Z: %.2f (Virtual world: %d, Interior %d).", name, x, y, z, virtualworld, interior);
        return 1;

    }
    return 0;
}

AMX_NATIVE_INFO PluginNatives[] =
{
    {"HelloWorld", HelloWorld},
    {0, 0}
};

PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx ) 
{
    return amx_Register(amx, PluginNatives, -1);
}


PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx ) 
{
    return AMX_ERR_NONE;
}
Give me errors:

Code:
     Creando biblioteca Test\Debug\Test.lib and object Test\Debug\Test.exp
Test.obj : error LNK2019: extern symbol "public: int __cdecl Invoke::callNative(struct PAWN::Native const *,...)" (?callNative@Invoke@@QAAHPBUNative@PAWN@@ZZ) unresolved external symbol referenced in function 'function' "long __cdecl WhereIsPlayer(struct tagAMX *,long *)" (?WhereIsPlayer@@YAJPAUtagAMX@@PAJ@Z)
Test.obj : error LNK2001: símbolo externo "class Invoke * g_Invoke" (?g_Invoke@@3PAVInvoke@@A) unresolved external symbol
Test\Debug\Test.dll : fatal error LNK1120: 2 unresolved external symbols
========== Generated: 0 corrects, 1 incorrect ==========
Sorry for language of compiler.

It's the same problem of:


on page 6, here, on this tutorial.

Last edited by Megalock; 22/11/2012 at 08:49 PM.
Megalock is offline   Reply With Quote
Old 02/12/2012, 11:10 AM   #68
Megalock
Little Clucker
 
Join Date: Jan 2012
Posts: 6
Reputation: 0
Default Respuesta: Plugin development guide

Please help.
Megalock is offline   Reply With Quote
Old 09/12/2012, 04:39 PM   #69
GWMPT
High-roller
 
Join Date: Nov 2012
Location: Portugal.
Posts: 993
Reputation: 287
Default Re: Plugin development guide

I have a small nabass question.
So, via the plugin, we *can* use all functions that c/++ gives, right?
GWMPT is offline   Reply With Quote
Old 09/12/2012, 06:32 PM   #70
TheArcher
High-roller
 
TheArcher's Avatar
 
Join Date: Dec 2009
Location: Home
Posts: 2,377
Reputation: 251
Default Re: Plugin development guide

Quote:
Originally Posted by klklt0 View Post
I have a small nabass question.
So, via the plugin, we *can* use all functions that c/++ gives, right?
In theory yes...but in some case you need to have install libraries or even clients.
__________________
TheArcher 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
SA-MP 0.3c in development Kalcor News and Updates 889 19/09/2014 05:39 PM
0.3b Development bar gone WackoX General 94 02/08/2010 11:17 PM
A guide to install Jacob's IRC plugin? Celson Server Support 5 09/06/2009 08:06 AM


All times are GMT. The time now is 08:56 PM.


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