int aux_RegisterNatives(AMX *amx) { #if defined CONSOLE extern AMX_NATIVE_INFO console_Natives[]; #endif #if defined DATETIME extern AMX_NATIVE_INFO time_Natives[]; #endif #if defined FIXEDPOINT extern AMX_NATIVE_INFO fixed_Natives[]; #endif #if defined FLOATPOINT extern AMX_NATIVE_INFO float_Natives[]; #endif extern AMX_NATIVE_INFO core_Natives[]; #if defined CONSOLE amx_Register(amx, console_Natives, -1); #endif #if defined DATETIME amx_Register(amx, time_Natives, -1); #endif #if defined FIXEDPOINT amx_Register(amx, fixed_Natives, -1); #endif #if defined FLOATPOINT amx_Register(amx, float_Natives, -1); #endif return amx_Register(amx, core_Natives, -1); }
int main(int argc,char *argv[]) { extern AMX_NATIVE_INFO console_Natives[]; extern AMX_NATIVE_INFO core_Natives[]; AMX amx; cell ret = 0; int err; if (argc != 2) PrintUsage(argv[0]); err = aux_LoadProgram(&amx, argv[1], NULL); if (err != AMX_ERR_NONE) ErrorExit(&amx, err); amx_Register(&amx, console_Natives, -1); err = amx_Register(&amx, core_Natives, -1); if (err != AMX_ERR_NONE) ErrorExit(&amx, err); err = amx_Exec(&amx, &ret, AMX_EXEC_MAIN); if (err != AMX_ERR_NONE) ErrorExit(&amx, err); printf("%s returns %ld\n", argv[1], (long)ret); aux_FreeProgram(&amx); return 0; }
int amxinit_fpga(AMX *amx) { static const AMX_NATIVE_INFO funcs[] = { {"fpga_load", amx_fpga_load}, {"fpga_config_outputs", amx_fpga_config_outputs}, {"fpga_read_pins", amx_fpga_read_pins}, {"fpga_write_pins", amx_fpga_write_pins}, {"fpga_read", amx_fpga_read}, {"fpga_write", amx_fpga_write}, {0, 0} }; if (have_custom_image) { uint8_t *buffer; if (amx_Allot(amx, 1024/sizeof(cell), (cell**)&buffer) != 0) return false; have_custom_image = false; fpga_configure(NULL, buffer); // Restore original FPGA image amx_Release(amx, (cell*)buffer); } set_port_directions(default_pins); return amx_Register(amx, funcs, -1); }
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX * amx) { Redirect(amx, "SetTimer", (ucell)n_SetTimer, 0); Redirect(amx, "KillTimer", (ucell)n_KillTimer, 0); Redirect(amx, "SetTimerEx", (ucell)n_SetTimerEx, 0); //Redirect(amx, "print", (ucell)n_print, 0); //Redirect(amx, "printf", (ucell)n_printf, 0); for (int i = 0; i != 17; ++i) { if (gAMXFiles[i] == 0) { gAMXFiles[i] = amx; int idx; if (amx_FindPublic(amx, "OnServerMessage", &idx)) { //printf("NO CALLBACK\n"); gAMXPtr[i] = -1; } else { //printf("GOT CALLBACK %d\n", idx); gAMXPtr[i] = idx; } break; } } return amx_Register(amx, sscanfNatives, -1); }
int amxinit_menu(AMX *amx) { static const AMX_NATIVE_INFO funcs[] = { {"draw_menubar", amx_draw_menubar}, {0, 0} }; if (amx_FindPublic(amx, "@button1", &b1_func) != 0) b1_func = -1; if (amx_FindPublic(amx, "@button2", &b2_func) != 0) b2_func = -1; if (amx_FindPublic(amx, "@button3", &b3_func) != 0) b3_func = -1; if (amx_FindPublic(amx, "@button4", &b4_func) != 0) b4_func = -1; if (amx_FindPublic(amx, "@scroll1", &s1_func) != 0) s1_func = -1; if (amx_FindPublic(amx, "@scroll2", &s2_func) != 0) s2_func = -1; return amx_Register(amx, funcs, -1); }
bool CNetwork::registerNatives(const AMX_NATIVE_INFO *list) { err = amx_Register(&inimod_amx,list,-1); int num = 0; amx_NumNatives(&inimod_amx,&num); printf("Registered %i native functions.\n",num); return true; }
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx ) { // Register the AMX CCallbackManager::RegisterAMX(amx); // Register the plugin natives for the amx instance return amx_Register(amx, PluginNatives, -1); }
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx ) { if (MainServer){if (MainServer->FuncProcessor) MainServer->FuncProcessor->Init(amx);} return amx_Register(amx,DotnetServerNatives,-1); }
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX * amx) { /*int num, idx; // Operate on the raw AMX file, don't use the amx_ functions to avoid issues // with the fact that we've not actually finished initialisation yet. Based // VERY heavilly on code from "amx.c" in the PAWN runtime library. AMX_HEADER * hdr = (AMX_HEADER *)amx->base; AMX_FUNCSTUB * func; num = NUMENTRIES(hdr, natives, libraries); for (idx = 0; idx != num; ++idx) { func = GETENTRY(hdr, natives, idx); if (!strcmp("SetPlayerName", GETENTRYNAME(hdr, func))) { // Intercept the call! SetPlayerName = (AMX_NATIVE)func->address; func->address = (ucell)n_SSCANF_SetPlayerName; break; } }*/ return amx_Register(amx, sscanfNatives, -1); }
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX *amx) { int error = CrashDetect::Create(amx)->Load(); if (error == AMX_ERR_NONE) { amx_SetCallback(amx, AmxCallback); amx_SetExecErrorHandler(amx, AmxExecError); return amx_Register(amx, natives::list, -1); } return error; }
int amx_PowerInit(AMX *amx) { static AMX_NATIVE_INFO power_Natives[] = { { "power", n_power }, { "sqroot", n_sqroot }, { 0, 0 } /* terminator */ }; return amx_Register(amx, power_Natives, -1); }
int amxinit_fourier(AMX *amx) { static const AMX_NATIVE_INFO funcs[] = { {"dft", amx_dft}, {"fft", amx_fft}, {0, 0} }; return amx_Register(amx, funcs, -1); }
void EXPORT dryon_Mini_Init(Script *_p) { SmallScript *p= (SmallScript*)_p; static AMX_NATIVE_INFO mini_Natives[] = { { "add_this", _add_this }, { 0, 0 } /* terminator */ }; amx_Register(p->getAMX(), mini_Natives, -1); Debug("**( Mini: loaded )**\n"); }
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX *amx) { int idx; if(amx_List[0].amx == NULL && amx_FindPublic(amx, "OnGameModeInit", &idx) == AMX_ERR_NONE) idx = 0; // if it's a gamemode AMX - make it first in list else idx = ++lastAMX;// else - put it to the end of list amx_List[idx].amx = amx; amx_FindPublic(amx, "OnPlayerCommandReceived", &amx_List[idx].OPCR); amx_FindPublic(amx, "OnPlayerCommandPerformed", &amx_List[idx].OPCP); return amx_Register(amx, PluginNatives, -1); }
int amxinit_device(AMX *amx) { static const AMX_NATIVE_INFO funcs[] = { {"set_backlight", amx_set_backlight}, {"set_powersave", amx_set_powersave}, {"beep", amx_beep}, {"battery_voltage", amx_battery_voltage}, {0, 0} }; return amx_Register(amx, funcs, -1); }
int AMXEXPORT AMXAPI amx_TimeInit(AMX *amx) { #if !defined AMXTIME_NOIDLE /* see whether there is a @timer() function */ if (amx_FindPublic(amx,"@timer",&idxTimer) == AMX_ERR_NONE) { if (amx_GetUserData(amx, AMX_USERTAG('I','d','l','e'), (void**)&PrevIdle) != AMX_ERR_NONE) PrevIdle = NULL; amx_SetUserData(amx, AMX_USERTAG('I','d','l','e'), (void*)amx_TimeIdle); } /* if */ #endif return amx_Register(amx, time_Natives, -1); }
void EXPORT dryon_Timers_Init(Script *_p) { SmallScript *p= (SmallScript*)_p; static AMX_NATIVE_INFO timers_Natives[] = { {"timer_add", _addTimedEvent}, {"timer_remove", _removeTimedEvent}, {"timer_valid", _isIDValid}, { 0, 0 } /* terminator */ }; AMX *amx= p->getAMX(); amx_Register(amx, timers_Natives, -1); func_timer= new Timer; func_timer->run(); }
void Shoebill::OnAmxLoad(AMX *amx) const { amx_Register(amx, PluginExports, -1); AmxInstanceManager::GetInstance().RegisterAmx(amx); if (!callbackHandlerObject) return; JNIEnv *env; jvm->AttachCurrentThread((void **) &env, NULL); static jmethodID jmid = env->GetMethodID(callbackHandlerClass, "onAmxLoad", "(I)V"); if (!jmid) return; env->CallVoidMethod(callbackHandlerObject, jmid, amx); jni_jvm_printExceptionStack(env); }
static int AMXAPI amx_RegisterHookProc(AMX *amx, const AMX_NATIVE_INFO *nativelist, int number) { amx_RegisterHook.Remove(); int error = amx_Register(amx, nativelist, number); for (int i = 0; nativelist[i].name != 0 && (i < number || number == -1); ++i) { sampgdk::Wrapper::GetInstance().SetNative(nativelist[i].name, nativelist[i].func); // Fix for funcidx() issue if (strcmp(nativelist[i].name, "funcidx") == 0) { SetJump((void*)nativelist[i].func, (void*)fixed_funcidx); } } amx_RegisterHook.Reinstall(); return error; }
int AMXEXPORT AMXAPI amx_DGramInit(AMX *amx) { dgramBound = 0; if (udp_Open()==-1) return AMX_ERR_GENERAL; /* see whether there is an @receivestring() function */ if (amx_FindPublic(amx,"@receivestring",&idxReceiveString)==AMX_ERR_NONE || amx_FindPublic(amx,"@receivepacket",&idxReceivePacket)==AMX_ERR_NONE) { if (amx_GetUserData(amx,AMX_USERTAG('I','d','l','e'),(void**)&PrevIdle)!=AMX_ERR_NONE) PrevIdle=NULL; amx_SetUserData(amx,AMX_USERTAG('I','d','l','e'),amx_DGramIdle); } /* if */ return amx_Register(amx,dgram_Natives,-1); }
void CPluginMngr::Finalize() { if (m_Finalized) return; pNatives = BuildNativeTable(); CPlugin *a = head; while (a) { if (a->getStatusCode() == ps_running) { amx_Register(a->getAMX(), pNatives, -1); a->Finalize(); } a = a->next; } m_Finalized = true; }
int amxinit_display(AMX *amx) { static const AMX_NATIVE_INFO funcs[] = { {"draw_text", amx_draw_text}, {"draw_flowtext", amx_draw_flowtext}, {"lcd_type", amx_lcd_type}, {"fill_rectangle", amx_fill_rectangle}, {"putpixel", amx_putpixel}, {"getpixel", amx_getpixel}, {"blend", amx_blend}, {"putcolumn", amx_putcolumn}, {"getcolumn", amx_getcolumn}, {"drawline_aa", amx_drawline_aa}, {"drawline", amx_drawline}, {"draw_rectangle", amx_draw_rectangle}, {"draw_bitmap", amx_draw_bitmap}, {"save_bitmap", amx_save_bitmap}, {0, 0} }; return amx_Register(amx, funcs, -1); }
void CPluginMngr::CPlugin::Finalize() { char buffer[128]; int old_status = status; if (CheckModules(&amx, buffer)) { if (amx_Register(&amx, core_Natives, -1) != AMX_ERR_NONE) { Handler *pHandler = (Handler *)amx.userdata[UD_HANDLER]; int res = 0; if (pHandler->IsNativeFiltering()) res = amx_CheckNatives(&amx, native_handler); if (!res) { status = ps_bad_load; sprintf(buffer, "Plugin uses an unknown function (name \"%s\") - check your modules.ini.", no_function); errorMsg = buffer; amx.error = AMX_ERR_NOTFOUND; } else { amx_RegisterToAny(&amx, invalid_native); } } } else { status = ps_bad_load; errorMsg = buffer; amx.error = AMX_ERR_NOTFOUND; } if (old_status != status) { AMXXLOG_Log("[AMXX] Plugin \"%s\" failed to load: %s", name.chars(), errorMsg.chars()); } }
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX *amx){ char t[256] = ""; AMX_NATIVE native = sampgdk::FindNative("SHA256_PassHash"); if (!native) sjs::logger::log("Could not find SHA256 Native"); else { sampgdk::InvokeNative(native, "ssS[256]", "Test", "Test", &t); printf("SHA256: %s", t); } int res = 0; if ((res = amx_Register(amx, PluginNatives, -1))){ printf("Failed to register samp.js natives.\n"); } if (!sampjs::SAMPJS::amx){ sampjs::SAMPJS::SetAMX(amx); sampjs::SAMPJS::Init(); if (js_scripts.size() > 0){ for (unsigned int i = 0; i < js_scripts.size(); i++){ sampjs::SAMPJS::CreateScript(js_scripts[i]); } std::cout << std::endl; sampjs::SAMPJS::ScriptInit(); } else { std::cout << "[samp.js] No JS Scripts configured. Add jsfiles to your server.cfg" << std::endl; } } /*int idx; if (!amx_FindPublic(amx, "SAMPJS_Init", &idx)){ sampjs::SAMPJS::SetAMX(amx); }*/ return 1; }
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX* amx) { // return pawn_natives::AmxLoad(amx); return amx_Register(amx, native_list, -1); }
int AMXEXPORT AMXAPI amx_ArgsInit(AMX *amx) { return amx_Register(amx, args_Natives, -1); }
int amx_initNatives(AMX *amx) { return amx_Register(amx, gamemode_Natives, -1); }
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX *amx) { return amx_Register( amx, PluginNatives, -1 ) ; }
int AMXEXPORT AMXAPI amxext_init(AMX *amx) { return amx_Register(amx, ext_Natives, -1); }
int AMXEXPORT AMXAPI amx_ProcessInit(AMX *amx) { return amx_Register(amx, process_Natives, -1); }