|
|
#51 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Oct 2011
Posts: 357
Reputation: 14
|
What the hell... I'm just trying to use invoke and here is my results
. Please, help someone.![]() Code:
#include "SDK\amx\amx.h"
#include "SDK\plugincommon.h"
#include "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)
{
invoke = new Invoke;
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.");
}
AMX_NATIVE_INFO PluginNatives[] =
{
{"HelloWorld", HelloWorld},
{0, 0}
};
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx )
{
invoke->amx_list.push_back(amx);
return amx_Register(amx, PluginNatives, -1);
}
PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx )
{
for (std::list<AMX *>::iterator i = invoke->amx_list.begin(); i != invoke->amx_list.end(); ++i)
{
if (* i == amx)
{
invoke->amx_list.erase(i);
break;
}
}
return AMX_ERR_NONE;
}
|
|
|
|
|
|
#52 |
|
Beta Tester
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: 629
Posts: 13,338
Reputation: 1911
|
Have you tried compiling? Those look like IntelliSense errors, which are not always accurate.
|
|
|
|
|
|
#53 | |
|
Banned
![]() Join Date: Jun 2012
Location: Seriously??
Posts: 13
Reputation: 0
|
Quote:
|
|
|
|
|
|
|
#54 | ||
|
Huge Clucker
![]() ![]() ![]() Join Date: Oct 2011
Posts: 357
Reputation: 14
|
Quote:
:Code:
1>------ Build started: Project: C++_iScreenFader, Configuration: Debug Win32 ------ 1> main.cpp 1>f:\program files\microsoft visual studio 10.0\vc\include\malloc.h(251): warning C4005: 'alloca' : macro redefinition 1> c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\sdk\amx\amx.h(87) : see previous definition of 'alloca' 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(26): error C2065: 'invoke' : undeclared identifier 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(48): error C2065: 'invoke' : undeclared identifier 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(48): error C2227: left of '->amx_list' must point to class/struct/union/generic type 1> type is ''unknown-type'' 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(48): error C2228: left of '.push_back' must have class/struct/union 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(55): error C2065: 'invoke' : undeclared identifier 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(55): error C2227: left of '->amx_list' must point to class/struct/union/generic type 1> type is ''unknown-type'' 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(55): error C2228: left of '.begin' must have class/struct/union 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(55): error C2065: 'invoke' : undeclared identifier 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(55): error C2227: left of '->amx_list' must point to class/struct/union/generic type 1> type is ''unknown-type'' 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(55): error C2228: left of '.end' must have class/struct/union 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(59): error C2065: 'invoke' : undeclared identifier 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(59): error C2227: left of '->amx_list' must point to class/struct/union/generic type 1> type is ''unknown-type'' 1>c:\users\gintautas\documents\visual studio 2010\projects\c++_iscreenfader\c++_iscreenfader\main.cpp(59): error C2228: left of '.erase' must have class/struct/union ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Quote:
.
|
||
|
|
|
|
|
#55 |
|
Little Clucker
![]() Join Date: Jun 2012
Location: Turkey / GTATurk
Posts: 45
Reputation: 50
|
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");
}
Code:
forward __GetPlayerName(playerid,name[]);
public __GetPlayerName(playerid,name[]){
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
}
P.S: I don't want to use invoke or gdk.I want to make this. P.S: playerid is correct.I tested. |
|
|
|
|
|
#56 | |
|
Little Clucker
![]() Join Date: Jun 2012
Location: Turkey / GTATurk
Posts: 45
Reputation: 50
|
Quote:
Up+++ |
|
|
|
|
|
|
#57 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Oct 2011
Posts: 357
Reputation: 14
|
What I'm doing wrong? plugin_test prints wrong values.
pawn Code:
Code:
// calling:
testfunc( amx, 5, 3, 2, 8 );
// function:
void testfunc( AMX* amx, int itg_MinX, int itg_MinY, int itg_MaxX, int itg_MaxY )
{
int idx;
const cell arr[] = { itg_MinX, itg_MinY, itg_MaxX, itg_MaxY };
if(!amx_FindPublic(amx, "plugin_test", &idx))
{
cell
ret,
addr = 0;
cell
amx_addr,
*phys_addr;
amx_Allot(amx, sizeof(arr) / sizeof(cell), &amx_addr, &phys_addr);
memcpy(phys_addr, arr, sizeof(arr));
amx_Push(amx, amx_addr);
amx_Exec(amx, &ret, idx);
amx_Release(amx, addr);
}
}
Last edited by zgintasz; 09/07/2012 at 09:20 AM. |
|
|
|
|
|
#58 |
|
Big Clucker
![]() ![]() Join Date: Mar 2012
Posts: 60
Reputation: 57
|
@Rancho
use amx_PushString, you can get working examples in some of plugins(just look up some with callbacks that receive strings) @zgintasz You must amx_Push all values in reverse order(right-to-left), push theirs' amx addr of course. |
|
|
|
|
|
#59 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Oct 2011
Posts: 357
Reputation: 14
|
Can you give me a fixed code? I'm just trying to learn it.
|
|
|
|
|
|
#60 |
|
Big Clucker
![]() ![]() Join Date: Mar 2012
Posts: 60
Reputation: 57
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Question] Plugin Load Failed : Plugin Does not conform to architecture. | Gamer_Z | Plugin Development | 2 | 09/06/2011 06:42 AM |
| SA-MP 0.3c in development | Kalcor | News and Updates | 886 | 23/04/2011 06:18 AM |
| 0.3b Development bar gone | WackoX | General | 94 | 02/08/2010 10:17 PM |
| A guide to install Jacob's IRC plugin? | Celson | Server Support | 5 | 09/06/2009 07:06 AM |