[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
#2

Have something more to do sorry
6/10
Reply
#3

Quote:
Originally Posted by [BP]Tony
Посмотреть сообщение
Have something more to do sorry
6/10
Have any suggested? post here,I'll add in next version...
Reply
#4

wow nice idea, I tested it in localhost works perfect

rep+
Reply
#5

Quote:
Originally Posted by iRana
Посмотреть сообщение
wow nice idea, I tested it in localhost works perfect

rep+
Thanks for liking
Reply
#6

its really fun slaping and sending pm to a freind when i am offline . Lol he thoughs it was a random thing. Can you please add freeze,unfreeze and givemoney features
Reply
#7

Quote:
Originally Posted by iRana
Посмотреть сообщение
its really fun slaping and sending pm to a freind when i am offline . Lol he thoughs it was a random thing. Can you please add freeze,unfreeze and givemoney features
May be in next version.......
Reply
#8

Nice one !
could be improved alot
Reply
#9

Quote:
Originally Posted by Niko_boy
Посмотреть сообщение
Nice one !
could be improved alot
Thanks , Punjab de sheera :P
Reply
#10

Quote:
Originally Posted by Shabi RoxX
Посмотреть сообщение
[CENTER]
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 
?>
Use sessions so there is no need to login for every action. I din't check total script tough. Good luck.
Reply
#11

Nice One Man
Reply
#12

with mysql is more better than with normaly functions ?
Reply
#13

Why just dont create rcon commands and execute them with Westie Rcon Api
Reply
#14

Wow Awesome Script!! Keep It Up !!
Reply
#15

I did everything and I can not run it
How to connect?
Reply
#16

Quote:
Originally Posted by BabyMan
Посмотреть сообщение
I did everything and I can not run it
How to connect?
After running server you got(will create auto) tables in your database ? If not check your mysql setting.... Show mysql debug
Reply
#17

can you make it for .ini files?? bcoz mine is not sql based
Reply
#18

Not bad, good job,
I don't like the way that you check the server stats, you know, gravity, etc.
You made a basic design, and yeah, good commands. Of course, the design can be improved. And the mysql.cfg in scriptfiles is a waste of time, you could define the configuration into the FS, anyway, it looks more organized as you made it.
4/5. Good job.
Reply
#19

Quote:
Originally Posted by Xtreme Brotherz
Посмотреть сообщение
can you make it for .ini files?? bcoz mine is not sql based
.ini file ? But i don't known that if PHP supports data from .ini .
Reply
#20

This panel is too vulnerable to injections and attack (XSS and CSRF <3). Please learn PHP properly before you develop something which is directly put into production by novice server owners. Also your code is mess learn some indentation styles...

Quote:
Originally Posted by Shabi RoxX
Посмотреть сообщение
.ini file ? But i don't known that if PHP supports data from .ini .
Please learn PHP D:!


Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
Why just dont create rcon commands and execute them with Westie Rcon Api
This!
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)