|
Member
|

02-07-2017
, 16:12
Re: Check if admin online & antispam
|
#7
|
Here we are:
.sma:
PHP Code:
// Big thanks to Black Rose for this plugin #include <amxmodx> #include <amxmisc>
new Float:gNextCall[33];
new gpcvarCooldown; new gpcvarURL;
public plugin_init() {
register_plugin("Call admin", "1.0", "Lawnmoverman & Black Rose")
register_clcmd("say", "clcmdSay", 0, "")
gpcvarCooldown = register_cvar("calladmin_cooldown", "10.0"); // Set anti flood protection in minutes gpcvarURL = register_cvar("calladmin_url", "http://www.nozgaming.eu/calladmin.php?token=1234567890123&message="); // Edit your url & token }
public clcmdSay(id) {
new Message[64]; read_args(Message, charsmax(Message)); remove_quotes(Message); Message[10] = 0;
if ( ! equali(Message[1], "calladmin") ) return PLUGIN_CONTINUE;
new Float:GameTime = get_gametime();
if ( gNextCall[id] > GameTime ) { client_printc(id, "!t[Call Admin] !gYou used this command recently. Please wait %.0fm, %ds to use this command again.", (gNextCall[id] - GameTime) / 60.0, floatround(gNextCall[id] - GameTime) % 60); return PLUGIN_HANDLED; }
gNextCall[id] = GameTime + get_pcvar_float(gpcvarCooldown) * 60;
new Admins[32], Adminsnum = OnlineAdmins(Admins);
if ( Adminsnum ) {
new PlayerName[32]; get_user_name(id, PlayerName, charsmax(PlayerName));
for ( new i ; i < Adminsnum ; i++ ) { client_printc(Admins[i], "!t[Call Admin]!g %s called an admin with the following message:", PlayerName); client_printc(Admins[i], "!t[Call Admin]!g %s", Message[11]); }
client_printc(id, "!t[Call Admin]!g An admin is online and has been notified."); return PLUGIN_HANDLED; }
new URL[192]; get_pcvar_string(gpcvarURL, URL, charsmax(URL)); add(URL, charsmax(URL), Message[11]); show_motd(id, URL)
return PLUGIN_HANDLED; }
stock OnlineAdmins(Admins[32]="") {
new Players[32], Playersnum, Adminsnum; get_players(Players, Playersnum);
for ( new i ; i < Playersnum ; i++ ) { if ( is_user_admin(Players[i]) ) { Admins[Adminsnum] = Players[i]; Adminsnum++; } }
return Adminsnum; }
// Colour Chat client_printc(index, const text[], any:...) { new szMsg[128]; vformat(szMsg, sizeof(szMsg) - 1, text, 3); replace_all(szMsg, sizeof(szMsg) - 1, "!g", "^x04"); replace_all(szMsg, sizeof(szMsg) - 1, "!n", "^x01"); replace_all(szMsg, sizeof(szMsg) - 1, "!t", "^x03"); message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, index); write_byte(index); write_string(szMsg); message_end(); }
.php:
PHP Code:
<?php // CallAdmin.php // Edit and upload this file to your web host, and use with 'Call admin' AMX Mod X plugin by Lawnmoverman & Black Rose
// Admin emails ( note the commas ) $to = '[email protected], [email protected], [email protected]';
// Subject $subject = 'cs.nozgaming.eu - calladmin';
// From ( we don't want our messages to get in spam folder ) $headers[] = 'From: NOZGAMING.EU - DAEMON <[email protected]>';
// We are using html, do not chnage these, unless you want to use a plain text in your emails $headers[] = 'MIME-Version: 1.0'; $headers[] = 'Content-type: text/html; charset=utf-8';
// Use your unique value, specify it also in .sma script, along with url, and recompile! ( !!!It is important to change this!!! ) $check_token = '1234567890123';
// Edit messages to fit your needs // Remember that gmail supports almost nothing for css ( it is better to use div for all content, to give 100% support ) // You can also decide to use plain text // Note the structure:
// - EMAIL START > // $message_top // MESSAGE SENT BY PLAYER // $message_bottom // < EMAIL END -
$message_top = ' <html> <head> <title>NIGHT OVER ZERO CS 1.6 [PUB] - CALLADMIN</title> </head> <body> <div style="margin: 0; background-color: #6d6a5a; font-family: Verdana; font-size: 12px; color: #ffffff;"> <br> <center><img src="http://www.nozgaming.eu/motd/logo.gif"><br> <b><font color="#ff9138">NIGHT OVER ZERO CS 1.6 [PUB] - CALLADMIN</font></b><br><br> Admin assistance required on server!<br> Calladmin function were executed on server.<br>Please join the server as soon as you can!<br><br> Player sent the following message:<br><br> -x-x-x-<br> ';
$message_bottom = ' <br>-x-x-x-<br><br> This message is sent from automatic daemon! Please, do not reply to this address!<br> <a href="http://www.nozgaming.eu" target="_blank" style="color: #6ebcff;">© www.nozgaming.eu</a><br><br> </div> </center> </body> </html> ';
// Confirm page ( will be showed in players motd on server, use html here ) $confirm_page = ' <html> <head> <style type="text/css"> body { margin: 0; background-color: #6d6a5a; font-family: Verdana; font-size: 12px; color: #ffffff; } a, a:active, a:visited { color: #6ebcff; text-decoration: none; } a:hover { color: #ff9138; text-decoration: underline; } </style> </head> <body> <center><img src="http://www.nozgaming.eu/motd/logo.gif" /><br> <b><font color="#ff9138">NIGHT OVER ZERO CS 1.6 [PUB] - CALLADMIN</font></b><br><br> -x-x-x-<br> <font color="#6ebcff"><b>[Call Admin]</b></font> All admins have been alerted, someone will join as soon as he can! :P<br> -x-x-x-<br><br> © nozgaming.eu<br> <a href="http://www.nozgaming.eu" target="_blank">www.nozgaming.eu</a><br><br> </center> </body> </html> ';
// Error page ( if someone calls this script from browser, use html here ) $error_page = ' <html> <head> <meta http-equiv="refresh" content="10; url=http://www.nozgaming.eu/" /> <title>NIGHT OVER ZERO CS 1.6 [PUB] - CALLADMIN</title> <style type="text/css"> body { margin: 0; background-color: #6d6a5a; font-family: Verdana; font-size: 12px; color: #ffffff; } a, a:active, a:visited { color: #6ebcff; text-decoration: none; } a:hover { color: #ff9138; text-decoration: underline; } </style> </head> <body> <center><img src="http://www.nozgaming.eu/motd/logo.gif" /><br> <b><font color="#ff9138">NIGHT OVER ZERO CS 1.6 [PUB] - CALLADMIN</font></b><br><br> -x-x-x-<br> <font color="#6ebcff"><b>ERROR:</b></font> You can not execute this function outside of server! :P<br> -x-x-x-<br><br> © nozgaming.eu<br> <a href="http://www.nozgaming.eu" target="_blank">www.nozgaming.eu</a><br><br> </center> </body> </html> ';
// There is nothing to edit below if( isset( $_GET['token'] ) && ( $_GET['token'] == $check_token ) ) { $message_player = $_GET['message']; mail( $to, $subject, $message_top . $message_player . $message_bottom, implode( "\r\n", $headers ) ); print $confirm_page; } else { print $error_page; die; } ?>
Works good, all tested!
Last edited by Lawnmoverman; 02-07-2017 at 16:50.
|
|