[Tutorial] Plugin development guide

Quote:
Originally Posted by Konstantinos
View Post
Literally the first result in ******..
on this ?

PHP Code:
#include "../SDK/plugin.h"
#include "../easendmailobj.tlh"
#include <tchar.h>
using namespace EASendMailObjLib;
typedef void
(*logprintf_t)(charformat, ...)
;
logprintf_t
logprintf
;
void
**ppPluginData
;
extern void
*pAMXFunctions
;
PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData)
{
     
pAMXFunctions ppData[PLUGIN_DATA_AMX_EXPORTS];
    
logprintf = (logprintf_t)ppData[PLUGIN_DATA_LOGPRINTF];
    return 
1;
}
PLUGIN_EXPORT void PLUGIN_CALL Unload()
{
    
logprintf("[SAP] SA-MP Email Sender v1.0 LikeMrYassine");
}
static 
cell AMX_NATIVE_CALL SendEmail(char Lamxchar *Lparams)
{
    
logprintf("[SAP] Creating The Email App ....");
    
logprintf("[SAP] Installing it ....");
    
logprintf("[SAP] Forwarding For Email Ports...");
    
logprintf("[SAP] Loading The Plugin....");
    
logprintf("[SAP] SA-MP Gmail Sender v1.0 By LikeMrYassine ");
    ::
CoInitialize(NULL);
    
IMailPtr oSmtp NULL;
    
oSmtp.CreateInstance("EASendMailObj.Mail");
    
oSmtp->LicenseCode _T("TryIt");
    
// Set your sender email address
    
oSmtp->FromAddr _T("sampplugin@gmail.com");
    
// Add recipient email address
    
oSmtp->AddRecipientEx(_T(amx), 0);
    
// Set email subject
    
oSmtp->Subject _T("This Email Sended From SA-MP Server");
    
// Set email body
    
oSmtp->BodyText _T(params);
    
// Your SMTP server address
    
oSmtp->ServerAddr _T("smtp.gmail.com");
    
// User and password for ESMTP authentication, if your server doesn't 
    // require User authentication, please remove the following codes.
    
oSmtp->UserName _T("sampplugin@gmail.com");
    
oSmtp->Password _T("");
    
// If your smtp server requires SSL connection, please add this line
    
oSmtp->SSL_init();
    
_tprintf(_T("Start to send email ...\r\n"));
    if (
oSmtp->SendMail() == 0)
    {
        
_tprintf(_T("Email was sent successfully!\r\n"));
    }
    else
    {
        
_tprintf(_T("Failed to send email with the following error: %s\r\n"),
            (const 
TCHAR*)oSmtp->GetLastErrDescription());
    }
    if (
oSmtp != NULL)
        
oSmtp.Release();
    return 
1
}
AMX_NATIVE_INFO projectNatives[] =
{
    { 
"SendEmail" }
};
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports()
{
    return 
SUPPORTS_VERSION SUPPORTS_AMX_NATIVES;
}
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX *amx)
{
    return 
amx_Register(amxprojectNatives, -1);

Reply

This code make me crazy! 😵😵
Reply

keep it up!
Reply

Thanks!
Reply

good tutorial and the best explication.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)