#include "main.h" SAMPFUNCS * SF = new SAMPFUNCS ( ) ; void CALLBACK cmd_setclass ( std :: string param ) { BitStream bsClass ; bsClass . Write ( std :: stoi ( param ) ) ; SF -> getRakNet ( ) -> SendRPC ( RPC_RequestClass , & bsClass ) ; } ; void CALLBACK mainloop ( ) { static bool init { } ; if ( ! init ) { if ( GAME != nullptr && GAME -> GetSystemState ( ) == eSystemState :: GS_PLAYING_GAME && SF -> getSAMP ( ) -> IsInitialized ( ) ) { SF -> getSAMP ( ) -> registerChatCommand ( "setclass" , cmd_setclass ) ; SF -> getSAMP ( ) -> getChat ( ) -> AddChatMessage ( - 1 , "{FF0000}SFPlugin" ) ; init = true ; } } else { } } BOOL WINAPI DllMain ( HINSTANCE hinstDLL , DWORD fdwReason , LPVOID lpReserved ) { if ( fdwReason == DLL_PROCESS_ATTACH ) SF -> initPlugin ( mainloop , hinstDLL ) ; return TRUE ; }
#include "main.h" SAMPFUNCS * SF = new SAMPFUNCS ( ) ; void CALLBACK testing2 ( std :: string params ) { BitStream bsClass ; // объявляем объект класса BitStream, в котором хранятся пакетные данные. bsClass . Write ( std :: stoi ( params ) ) ; // записываем в него ID переданный в команду. SF -> getRakNet ( ) -> emulateRecvRPC ( RPC_RequestClass , & bsClass ) ; // эмулируем RPC } ; void CALLBACK mainloop ( ) { static bool init { } ; if ( ! init ) { if ( GAME != nullptr && GAME -> GetSystemState ( ) == eSystemState :: GS_PLAYING_GAME && SF -> getSAMP ( ) -> IsInitialized ( ) ) { SF -> getSAMP ( ) -> registerChatCommand ( "skkk" , testing2 ) ; SF -> getSAMP ( ) -> getChat ( ) -> AddChatMessage ( - 1 , "{FF0000}SFPlugin Testing Two - Loaded" ) ; init = true ; } } else { } } BOOL WINAPI DllMain ( HINSTANCE hinstDLL , DWORD fdwReason , LPVOID lpReserved ) { if ( fdwReason == DLL_PROCESS_ATTACH ) SF -> initPlugin ( mainloop , hinstDLL ) ; return TRUE ; }