SA-MP Forums Archive
[Tutorial] Plugin development guide - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Tutorial] Plugin development guide (/showthread.php?tid=295798)

Pages: 1 2 3 4 5 6 7 8 9


Re: Plugin development guide - Yaa - 05.12.2016

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);




Re: Plugin development guide - ODINA - 19.12.2017

This code make me crazy! 😵😵


Re: Plugin development guide - DJefferson - 24.01.2018

keep it up!


Re: Plugin development guide - GuyYahood1 - 25.01.2018

Thanks!


Re: Plugin development guide - dani18 - 12.02.2018

good tutorial and the best explication.