╝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
╝Restart Server ╝ShutDown Server ╝Change Host Name ╝Change GameMode Text ╝Change MapName ╝Change Website ╝Change Weather ╝Change gravity ╝Ban Ip ╝UnBan Ip
/*===================================================
#
# 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
#
#====================================================
[Configrations] Host = 127.0.0.1 User = root Password = None Database = samp
/*=============================================================================
# #
# 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;
}
<?php
$adminpass = "admin";// just change it and save
?>
$mysql_host = 'localhost';//host name
$mysql_user = 'root';//user name
$mysql_pass = '';//password
$mysql_db = 'samp';//database
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
|
[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 код:
|
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 .
|
Why just dont create rcon commands and execute them with Westie Rcon Api
![]() |