Raised This Month: $ Target: $400
 0% 

(Call admin via email) Add !admin and send message from players to ingame admins.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Goggen
New Member
Join Date: Jun 2007
Old 03-07-2009 , 17:54   (Call admin via email) Add !admin and send message from players to ingame admins.
Reply With Quote #1

I wonder if it is possible to add !admin say command and to post the message from the players to the ingame admins as well as email and to post a confirmation to the player that the admin have been notified?

PHP Code:
/***********************************************
EmailAdmin.sma
With this plugin ppl are able to conctact an admin via email ingame

(c) 2007 core | Greenberet :: [email protected]

> commands:
    admin_msg<text> 
        text + Username + Steamid will be sent to the admin
> cvars:
    amx_email_host
        your mailserver with port e.g. your.mailserver.com:25
    amx_email_admin
        email address of the admin e.g. [email protected]
    amx_email_from
        email address you want to have as sender. this email address could be everything so it doesnt really have to exist.
                [email protected]
    amx_email_subject
        email subject. I think i dont have to explain this

> Version 1.0
    Release

> modifiy this file like u want, but please give credits 
    and notify me about it.
***********************************************/

#include <amxmodx>
#include <sockets>

stock CVAR_HOST;
stock CVAR_ADMIN_MAIL;
stock CVAR_MAIL_FROM;
stock CVAR_SUBJECT;

public 
plugin_init()
{
    
register_plugin"Email Admin""1.0""Greenberet" );
    
register_clcmd"admin_msg""cmdEmail"_,  "<text> sends an email with ^"text^" to an admin" );
    
    
CVAR_HOST register_cvar"amx_email_host""your.mailserver.com:25"FCVAR_SERVER );
    
CVAR_ADMIN_MAIL register_cvar"amx_email_admin""[email protected]"FCVAR_SERVER );
    
CVAR_MAIL_FROM register_cvar"amx_email_from""[email protected]"FCVAR_SERVER );
    
CVAR_SUBJECT register_cvar"amx_email_subject""ADMIN CALL"FCVAR_SERVER );
}

public 
cmdEmailid )
{
    static 
errorhost[128], admin_mail[128],from[128], subject[128],text[600];

    
read_args(text,599);
    
    
//im abusing the variables host & from for username and steamid here, but, who cares^^
    
get_user_name(id,host,127);
    
get_user_authid(id,from,127);

    
format(text,599,"%s^r^nSender: %s^r^nSteamID: %s",text,host,from);

    
get_pcvar_stringCVAR_HOSThost127 );
    
get_pcvar_stringCVAR_ADMIN_MAILadmin_mail127 );
    
get_pcvar_stringCVAR_MAIL_FROMfrom127 );
    
get_pcvar_stringCVAR_SUBJECTsubject127 );
    
//im using the error variable here for the port, dont waste resources ;)
    
error strfind(host,":");
    if( 
error == -)
        
error 25;
    else
    {
        
host[error] = 0;
        
error str_to_num(host[error+1]);
    }
    
    
error sendMailhosterroradmin_mailfromsubjecttext );

    if( 
error )
        
client_printidprint_notify"Error on sending mail: error %i"error );
        
    return 
1;

}

sendMailserver[], portto[], from[], subject[], text[] )
{
    static 
buff[1024], socketerrorlen;
    
    
socket socket_openserver portSOCKET_TCPerror );
    if( 
error 
        return 
error;
    
    
// Always be polite and say helo
    
len formatexbuff1023"HELO Greenberets_Email_AMXX_CLIENT^r^n" );
    
socket_sendsocketbufflen );
    while(
socket_changesocket )) socket_recvsocketbuff1023);
    
    
// Now tell the server from which email address you want to sent the email
    
len formatexbuff1023"MAIL FROM:<%s>^r^n"from );
    
socket_sendsocketbufflen );
    while(
socket_changesocket )) socket_recvsocketbuff1023);
    
    
// tell the mailserver the email address of the admin. 
    // you can add more admins if you make more "RCPT TO:<%s>^r^n" lines
    
len formatexbuff1023"RCPT TO:<%s>^r^n"to );
    
socket_sendsocketbufflen );
    while(
socket_changesocket )) socket_recvsocketbuff1023);
    
    
// Begin the DATA segment
    
len formatexbuff1023"DATA^r^n" );
    
socket_sendsocketbufflen );
    while(
socket_changesocket )) socket_recvsocketbuff1023);
    
    
// subject and email text
    
len formatexbuff1023"SUBJECT: %s^r^nFrom:<%s>^r^nTo:<%s>^r^n%s^r^n.^r^n"subject,from,totext );
    
socket_sendsocketbufflen );
    while(
socket_changesocket )) socket_recvsocketbuff1023);
    
    
//quit the conversation with the server
    
len formatexbuff1023"QUIT" );
    
socket_sendsocketbufflen );
    while(
socket_changesocket )) socket_recvsocketbuff1023);
    
    
socket_close(socket);
    
    return 
0;

Greetings..

Last edited by Goggen; 03-10-2009 at 06:57.
Goggen is offline
Old 03-08-2009, 09:20
Goggen
This message has been deleted by YamiKaitou. Reason: bump
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode