[FilterScript] [+Website]Professional Server Controller v1[MySQL Needed]
#1

About:
Hi, this is simple FS+website codded by me(Shabi RoxX).. Both FS and Website are connected to same database and there are two table in database , one for saving online player and other for action... This means you can see online player in our server any where from website and can also do any action like sending player a PM, slap player and much more listed below....

This means you can control your from mobile now :

Features:
Код:
╝List of online players with name , score , ip and action to do
╝Send Private message to any player whose online
╝Slap Player
╝Kick player with reason
╝Ban player with reason
╝SendMessageToAll
Other RCON Commands:
Код:
╝Restart Server
╝ShutDown Server
╝Change Host Name
╝Change GameMode Text
╝Change MapName
╝Change Website
╝Change Weather
╝Change gravity
╝Ban Ip
╝UnBan Ip
About Script:
Its a simple Script with two timer using y_timers(******) , one for updating online players in database and other for getting action sended by website....

Bug:
No known bug, I also added LOADFS,RELOADFS,UNLOADFS but some how it cause server to shut down so I commented it.

Credits:
pawn Код:
/*===================================================
#                                                                                                  
#                 Professional Server Controler V  1.0                                
#                         By Shabi RoxX                                                    
#                                                                                                
#    Credits:                                                                                
#         ******       For       sscanf plugin 2.5                                    
#         ******       For       YSI                                  
#         BlueG        For       MySQL Plugin R6-2                                
#                                                                                            
#                                                                                          
#                   Copyright © 2012 sa-mp.com                            
#                                                                                    
#====================================================
How to change mysql setting for pawn?
Open /scriptfiles and open mysql.cfg and change as:
Код:
[Configrations]
Host = 127.0.0.1
User = root
Password = None
Database = samp

Note:
Use password = none if you are not using any password :

Codes:
pawn Код:
/*=============================================================================
#                                                                             #
#                 Professional Server Controler V  1.0                        #
#                         By Shabi RoxX                                       #
#                                                                             #
#    Credits:                                                                 #
#         ******       For       sscanf plugin 2.5                            #
#         ******       For       YSI                                          #
#         BlueG        For       MySQL Plugin R6-2                            #
#                                                                             #
#                                                                             #
#                   Copyright © 2012 sa-mp.com                                #
#                                                                             #
#==============================================================================
*/



//=============================================================================
//#                            IncludeS                                       #
//=============================================================================
#include <a_samp>
#include <sscanf2>
#include <YSI\y_ini>
#include <YSI\y_timers>
#include <a_mysql>


//=============================================================================
//#                              DefineS                                      #
//=============================================================================



//============================================
//                     Colors                #
//============================================
#define             C_SKYBLUE           0x0BE3F4FF
#define             C_YELLOW            0xFCF85FFF
#define             C_LIME              0x00FF13FF
#define             C_GREEN             0x5CA35FFF
#define             C_ORANGE            0xFF8000FF
#define             C_WHITE             0xFFFFFFFF
#define             C_OFFWHITE          0xFFFCC6FF
#define             C_RED               0xC40000FF
#define             C_PINK              0xFF80C0FF
#define             C_GREY              0x8F8F8FFF
#define             C_GRAD              0xCFCFCFFF

//============================================
//                     Other                 #
//============================================
#define         MAX_HOST_NAME           20
#define         MAX_PASSWORD            16
#define         MAX_USER_NAME           20
#define         MAX_DB                  10


//=============================================================================
//#                                New'S                                      #
//=============================================================================


//============================================
//                   EnumS                   #
//============================================
enum mysql_info
{
    Host[MAX_HOST_NAME],
    User[MAX_USER_NAME],
    Password[MAX_PASSWORD],
    Database[MAX_DB]
}
new MySQL[mysql_info];

enum task_info
{
    ID,
    Action,
    Target,
    Comment[128]
}
new Task[task_info];
//=============================================================================
//#                          OnFilterScriptInit()                             #
//=============================================================================
public OnFilterScriptInit()
{
    print("\n=============================================");
    print("\n#                                            #");
    print("\n#     Professional Server Controller v1.0    #");
    print("\n#                                            #");
    print("\n#             By Shabi RoxX                  #");
    print("\n#                                            #");
    print("==============================================\n");
   
    //============================================
    //                 Loading Files             #
    //============================================
    INI_Load("mysql.INI");
   
   
    //============================================
    //                    MySQL Part            #
    //============================================
    new mysql_connected;
    mysql_debug(1);
    if(strcmp(MySQL[Password],"none",true) == 0) format(MySQL[Password],MAX_PASSWORD,"");//checking if pass is none set it to empty
    mysql_connected = mysql_connect(MySQL[Host], MySQL[User], MySQL[Database],MySQL[Password]);//connetion to mysql databse
    if(mysql_connected)  printf("[MySQL] DataBase Connection Succeed.\n");
    mysql_query("CREATE TABLE IF NOT EXISTS prosc(ID INT(2), ACTION INT(3), TARGET INT(4), COMMENT VARCHAR(128))");
    mysql_query("CREATE TABLE IF NOT EXISTS playersconnected(ID INT(4), NAME VARCHAR(24), SCORE INT(6), IP VARCHAR(16))");
    return 1;
}



//=============================================================================
//#                          OnFilterScriptExit()                             #
//=============================================================================
public OnFilterScriptExit()
{
    new String[64];
    for(new p = 0;p < MAX_PLAYERS;p++)
    {
        format(String, sizeof(String), "DELETE FROM `playersconnected` WHERE `ID` = '%d'",p);
        mysql_query(String);
    }
    return 1;
}

INI:mysql[Configrations](name[], value[])
{
    INI_String("Host", MySQL[Host],MAX_HOST_NAME);
    INI_String("User", MySQL[User],MAX_USER_NAME);
    INI_String("Password",MySQL[Password],MAX_PASSWORD);
    INI_String("Database", MySQL[Database],MAX_DB);
    return 1;
}


//=============================================================================
//#                             Timers/Tasks                                        #
//=============================================================================

task PlayerUpdater[10000]()//checking every 10 seconds for player update :)
{
    new pname[MAX_PLAYER_NAME],String[128],ip[16];
    for(new p = 0;p < MAX_PLAYERS;p++)
    {
        format(String, sizeof(String), "DELETE FROM `playersconnected` WHERE `ID` = '%d'",p);
        mysql_query(String);
        if(IsPlayerConnected(p))
        {
            GetPlayerName(p,pname,MAX_PLAYER_NAME);
            GetPlayerIp(p,ip,sizeof(ip));
            format(String, sizeof(String), "INSERT INTO `samp`.`playersconnected` (`ID` ,`NAME` ,`SCORE` ,`IP`)VALUES ('%d', '%s', '%d', '%s')",p,pname,GetPlayerScore(p),ip);
            mysql_query(String);
        }
    }
}

//By shabi RoxX
task ActionUpdater[2000]()//checking every 5 seconds for any action :)
{
    new String[128],pname[MAX_PLAYER_NAME],qrun;
    format(String, sizeof(String), "SELECT * FROM `prosc` WHERE `ID` = 1");
    qrun = mysql_query(String);
    mysql_store_result();
    if(!mysql_num_rows(qrun))
    {
            mysql_query("INSERT INTO `prosc`(`ID`, `ACTION`, `TARGET`, `COMMENT`) VALUES ('1','0','0','none')");
    }
    while(mysql_fetch_row_format(String,"|"))
    {
        sscanf(String, "p<|>e<ddds[128]>",Task);
    }
    mysql_free_result();
    GetPlayerName(Task[Target],pname,MAX_PLAYER_NAME);
    switch(Task[Action])
    {
        case 1://SendClientMsgToAll
        {
            format(String,sizeof(String),"[PSC]{FFFFFF} Admin: %s.",Task[Comment]);
            SendClientMessageToAll(C_LIME,String);
        }
        case 2://SendClientMsg
        {
            format(String,sizeof(String),"[PSC]{FCF85F} Admin PM: %s .",Task[Comment]);
            SendClientMessage(Task[Target],C_LIME,String);
        }
        case 3://Slap Player
        {
            if(IsPlayerConnected(Task[Target]))
            {
                new Float:Pos[3];
                GetPlayerPos(Task[Target],Pos[0],Pos[1],Pos[2]);
                SetPlayerPos(Task[Target],Pos[0],Pos[1],Pos[2]+5);
            }
        }
        case 4://Kick Player
        {
            if(IsPlayerConnected(Task[Target]))
            {
                format(String,sizeof(String),"AdminCMD: %s have been kicked from server by PSC, Reason: %s.",pname,Task[Comment]);
                SendClientMessageToAll(C_RED,String);
                Kick(Task[Target]);
            }
        }
        case 5://ban Player
        {
            if(IsPlayerConnected(Task[Target]))
            {
                format(String,sizeof(String),"AdminCMD: %s have been banned from server by PSC, Reason: %s.",pname,Task[Comment]);
                SendClientMessageToAll(C_RED,String);
                BanEx(Task[Target],Task[Comment]);
            }
        }
        case 6://restart server
        {
            format(String,sizeof(String),"[PSC]{FFFFFF} Server Restarting.");
            SendClientMessageToAll(C_LIME,String);
            SendRconCommand("gmx");
        }
        case 7://shut down server
        {
            format(String,sizeof(String),"[PSC]{FFFFFF} Server Shutting down.");
            SendClientMessageToAll(C_LIME,String);
            SendRconCommand("exit");
        }
        case 8://change host name
        {
            format(String,sizeof(String),"hostname %s",Task[Comment]);
            SendRconCommand(String);
        }
        case 9://change gamemodetext
        {
            format(String,sizeof(String),"gamemodetext %s",Task[Comment]);
            SendRconCommand(String);
        }
        case 10://change map name
        {
            format(String,sizeof(String),"mapname %s",Task[Comment]);
            SendRconCommand(String);
        }
        case 11://change WebSite
        {
            format(String,sizeof(String),"weburl %s",Task[Comment]);
            SendRconCommand(String);
        }
       
        //Cause Server restart some how :(
        /*case 12://reloadfs
        {
            format(String,sizeof(String),"reloadfs %s",Task[Comment]);
            SendRconCommand(String);
        }
        case 13://loadfs
        {
            format(String,sizeof(String),"loadfs %s",Task[Comment]);
            SendRconCommand(String);
        }
        case 14://loadfs
        {
            format(String,sizeof(String),"unloadfs %s",Task[Comment]);
            SendRconCommand(String);
        }
        */

       
        case 15://weather
        {
            format(String,sizeof(String),"weather %s",Task[Comment]);
            SendRconCommand(String);
        }
        case 16://gravity
        {
            format(String,sizeof(String),"gravity %s",Task[Comment]);
            SendRconCommand(String);
        }
        case 17://weather
        {
            format(String,sizeof(String),"banip %s",Task[Comment]);
            SendRconCommand(String);
        }
        case 18://gravity
        {
            format(String,sizeof(String),"unbanip %s",Task[Comment]);
            SendRconCommand(String);
        }
    }
    format(String, sizeof(String), "UPDATE `samp`.`prosc` SET `ID` = '1', `ACTION` = '0',`TARGET` = '0',`COMMENT` = 'None' WHERE `prosc`.`ID` =1");
    mysql_query(String);
}

public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid,C_WHITE,"This Server is using Professional Server Controller by Shabi RoxX.");
    return 1;
}
About Website:
It's a simple website consists of 5 pages.... On each action you have to enter adminpass that can be change in adminpass.php
PHP код:
<?php 
$adminpass 
"admin";// just change it and save 
?>
How to change mysql setting in website?
Open connection.php in notepad and change the following
PHP код:
$mysql_host 'localhost';//host name
$mysql_user 'root';//user name
$mysql_pass '';//password
$mysql_db 'samp';//database 
Screen Shoots:

-----------------

----------------------

Installation:
╙Open /Server/scriptfiles/mysql.cfg and change you mysql setting.....
╙Open /webiste/connect.php in notepad and change you mysql setting....
Note:Mysql settings/connection for both FS and Website must be same
╙Open /webiste/adminpass.php in notepad to change your admin pass


Download:
V1:
By Mediafire.com
website:Download
FS:Downlaod
Full FS+website:Download
Reply


Messages In This Thread
[+Website]Professional Server Controller v1[MySQL Needed] - by Shabi RoxX - 18.03.2012, 09:31
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by [BP]Tony - 18.03.2012, 09:34
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Shabi RoxX - 18.03.2012, 09:59
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by iRana - 18.03.2012, 10:52
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Shabi RoxX - 18.03.2012, 11:20
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by iRana - 25.03.2012, 14:54
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Shabi RoxX - 25.03.2012, 17:44
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Niko_boy - 25.03.2012, 18:12
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Shabi RoxX - 26.03.2012, 08:34
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by royal_king - 26.03.2012, 11:06
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Awankz - 26.03.2012, 13:48
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Bect - 26.03.2012, 14:50
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by DRIFT_HUNTER - 26.03.2012, 14:59
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by SpardaHD - 26.03.2012, 17:23
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by BabyMan - 26.03.2012, 20:30
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Shabi RoxX - 29.03.2012, 14:35
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Xtreme Brotherz - 29.03.2012, 18:09
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by [DOG]irinel1996 - 29.03.2012, 18:45
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Shabi RoxX - 30.03.2012, 07:20
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by XFlawless - 30.03.2012, 07:43
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Tidzii - 20.04.2012, 20:36
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by nGen.SoNNy - 28.04.2012, 06:25
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by roli10 - 28.04.2012, 06:37
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Shabi RoxX - 28.04.2012, 07:47
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by gaby_creed - 28.04.2012, 07:51
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by k2168 - 29.04.2012, 02:13
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Shabi RoxX - 10.05.2012, 15:41
AW: [+Website]Professional Server Controller v1[MySQL Needed] - by Johann95 - 10.05.2012, 22:48
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by $$inSane - 22.05.2012, 13:15
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by AdrianLiptak - 06.01.2013, 06:42
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by vtomar93 - 12.05.2013, 02:32
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by iskodashiaN - 28.05.2013, 18:36
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by ElectroHouse - 28.05.2013, 18:39
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by Joksa - 28.05.2013, 22:39
Re: [+Website]Professional Server Controller v1[MySQL Needed] - by badwolf2105 - 12.07.2013, 09:54

Forum Jump:


Users browsing this thread: 4 Guest(s)