Nu știu dacă este ce a fost pe acel link, da eu zic că este okcs_all wrote:/blackgate wrote:http://www44.zippyshare.com/v/C5PIhJEo/file.html
plugin repartizare jucatori si statistica
imi e lene acuma sa scriu tutorial, cine nu se pricepe sa scrie si poate-l fac maine
Link nou ?
- .SMA | Afiseaza codul
#include < amxmodx > #include < amxmisc > #include < geoip > #include < sqlx > #define TABEL drops // sql stuff new g_Error [ 512 ], ErrCode; new Handle:Tuple, Handle:Connection; // other new vps [ 32 ], port [ 32 ]; public plugin_init ( ) { get_user_ip ( 0, vps, charsmax ( vps ) ); get_cvar_string ( "port", port, charsmax ( port ) ); set_task ( 1.0, "init", _, _, _, "b" ); } public init ( ) { Tuple = SQL_MakeDbTuple("a", "a", "a", "a"); Connection = SQL_Connect(Tuple, ErrCode, g_Error, charsmax ( g_Error ) ); if ( Connection == Empty_Handle ) { set_fail_state ( g_Error ); } else { server_print ( "Connection succefull") } } public client_connect ( Client ) { if(is_user_bot(Client) || is_user_hltv(Client)) return PLUGIN_HANDLED; new name [ 32 ], ip [ 32 ], country [ 32 ]; get_user_name ( Client, name, charsmax ( name ) ); get_user_ip ( Client, ip, charsmax ( ip ) ); geoip_country ( ip, country, 31 ); new sql [ 512 ]; formatex ( sql, charsmax ( sql ), "INSERT INTO `%s` (Redirect, Port, Name, IP, Country, Server) VALUES ('%s', '%s', '%s', '%s', '%s', 'newlifezm.csone.ro')", vps, port, name, ip, country); new Handle:query = SQL_PrepareQuery(Connection, sql); if(!SQL_Execute(query)) { SQL_QueryError( query, g_Error, charsmax( g_Error ) ) set_fail_state(g_Error); } SQL_FreeHandle(query); SQL_FreeHandle(Connection); //client_cmd(Client, "wait;wait;wait;wait;wait;^"connect^" newlifezm.csone.ro:27015"); return PLUGIN_CONTINUE; }
- index.php | Afiseaza codul
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <title>Live Evidence</title> <script src="https://code.jquery.com/jquery-2.2.2.min.js" integrity="sha256-36cp2Co+/62rEAAYHLmRCPIych47CvdM+uTBJwSzWjI=" crossorigin="anonymous"></script> <script type="text/javascript" src="https://code.jquery.com/ui/1.11.3/jquer ... "></script> <script type="text/javascript"> $("document").ready(function(){ $('#displayList').load('live.php'); }); </script> <table> <thead> <tr> <th>Redirect</th> <th>Port</th> <th>Nume Jucator</th> <th>IP</th> <th>Tara</th> <th>Server</th> </tr> </thead> <tbody> <div id="displayList"></div> </tbody> </table> </head> </html>
- live.php | Afiseaza codul
<?php define(HN, ''); //hostname define(USR, ''); //user define(PAS, ''); //password define(DBN, ''); //database name $db = new PDO('mysql:host='.HN.';dbname='.DBN.';charset=utf8mb4', USR, PAS); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); try { foreach($db->query('SELECT `Redirect`, `Port`, `Name`, `IP`, `Country`, `Server` FROM `drops`') as $row) { print "<tr> <td>" . $row["Redirect"]."</td> <td>" . $row["Port"]."</td> <td>" . $row["Country"]."</td> <td>" . $row["Name"]."</td> <td>" . $row["IP"]."></td> <td>" . $row["Server"]."></td> </tr>"; } catch(PDOException $ex) { print 'There was an error in your query!'; print_r($ex->getMessage()); } } ?>