Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //****************************************************************
- //****************************************************************
- //** Server Monitoring System v2.0 by Skylive77 **
- //** **
- //** Release 2.0 : **
- //** -RCON Chating **
- //** -SeeIp Option **
- //** -Help Command **
- //** -Monitor Command **
- //** -Monitor new Fonction **
- //** **
- //** **
- //****************************************************************
- //****************************************************************
- #include <a_samp>
- #define FILTERSCRIPT
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_MONITOR 0xB0C4DEFF
- #define COLOR_MONITOR1 0xCDFF00FF
- #define COLOR_MONITOR2 0x91FF00FF
- #define COLOR_CHAT 0x00FFE632
- #define COLOR_ALERTE 0xFF5A0093
- #define MAX_STRING 255
- #define COLOR_GRAD2 0xBFC0C2FF
- forward SendServerMessage(color,const string[]);
- forward SendRCONMessage(color,const string[]);
- new playername[MAX_PLAYER_NAME];
- new sendername[MAX_PLAYER_NAME];
- new playerip[64];
- new MaxP;
- new totalon;
- new TotalConnections;
- new TotalTimeouts;
- new TotalKicks;
- new TotalCommands;
- new TotalChatMessages;
- new COKRCON;
- new CECHRCON;
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Server Monitoring by Skylive77 loaded");
- print("--------------------------------------\n");
- MaxP = GetMaxPlayers();
- new stringload[256];
- format(stringload, sizeof(stringload), "Server Monitoring chargé avec succès!");
- SendRCONMessage(COLOR_MONITOR1,stringload);
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print(" Server Monitoring by Skylive77 unloaded");
- print("--------------------------------------\n");
- new stringunload[256];
- format(stringunload, sizeof(stringunload), "Server Monitoring tué avec succès!");
- SendRCONMessage(COLOR_ALERTE,stringunload);
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" Server Monitoring by Skylive77");
- print("----------------------------------\n");
- }
- #endif
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- TotalCommands++;
- new idx;
- new string[256];
- new cmd[256];
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmdtext, "/allplayersip", true) == 0)
- {
- if (IsPlayerAdmin(playerid))
- {
- for(new j = 0; j < MAX_PLAYERS; j++)
- {
- if(IsPlayerConnected(j))
- {
- GetPlayerIp(j,playerip,sizeof(playerip));
- GetPlayerName(j, playername, sizeof(playername));
- format(string, 256, "Player Detected !! IP : %s, Name : %s.", playerip, playername);
- SendClientMessage(playerid,COLOR_MONITOR,string);
- }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, "ERROR : Vous n'êtes pas Admin!");
- return 1;
- }
- return 1;
- }
- if(strcmp(cmdtext, "/mhelp", true) == 0)
- {
- if (IsPlayerAdmin(playerid))
- {
- SendClientMessage(playerid,COLOR_WHITE,"------------------------| Server Monitor Help Center |----------------------");
- SendClientMessage(playerid,COLOR_MONITOR,"Server Monitor HELP : /ssay /allplayersip /monitor.");
- SendClientMessage(playerid,COLOR_MONITOR,"Server Monitor HELP : /mc.");
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, "ERROR : Vous n'êtes pas Admin!");
- return 1;
- }
- return 1;
- }
- if(strcmp(cmdtext, "/monitor", true) == 0)
- {
- if (IsPlayerAdmin(playerid))
- {
- totalon = 0;
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(totalon == 0)
- {
- totalon = 1;
- }
- else if (totalon > 0)
- {
- totalon++;
- }
- }
- }
- SendClientMessage(playerid,COLOR_WHITE,"----------------| Server Monitor |----------------");
- format(string, 256, "Players Online : %i/%i.", totalon, MaxP);
- SendClientMessage(playerid,COLOR_MONITOR1,string);
- new restant = MaxP-totalon;
- format(string, 256, "Slots available : %i.", restant);
- SendClientMessage(playerid,COLOR_MONITOR1,string);
- format(string, 256, "Total Connection : %d.", TotalConnections);
- SendClientMessage(playerid,COLOR_MONITOR1,string);
- format(string, 256, "Total Players Crash : %d.", TotalTimeouts);
- SendClientMessage(playerid,COLOR_MONITOR1,string);
- format(string, 256, "Total Players Quit : %d.", TotalKicks);
- SendClientMessage(playerid,COLOR_MONITOR1,string);
- format(string, 256, "Total Commands Used : %d.", TotalCommands);
- SendClientMessage(playerid,COLOR_MONITOR1,string);
- format(string, 256, "Total Messages Send : %d.", TotalChatMessages);
- SendClientMessage(playerid,COLOR_MONITOR1,string);
- format(string, 256, "Conexions au RCON (Echec) : %d.", CECHRCON);
- SendClientMessage(playerid,COLOR_MONITOR1,string);
- format(string, 256, "Conexions au RCON (Réussie) : %d.", COKRCON);
- SendClientMessage(playerid,COLOR_MONITOR1,string);
- SendClientMessage(playerid,COLOR_WHITE,"--------------------------------");
- format(string, 256, "RCON Admins Online :");
- SendClientMessage(playerid,COLOR_MONITOR2,string);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(IsPlayerAdmin(i))
- {
- new ip[64];
- GetPlayerName(i, sendername, sizeof(sendername));
- GetPlayerIp(i,ip,sizeof(ip));
- format(string, 256, "Name : %s, IP : %s", sendername, ip);
- SendClientMessage(playerid, COLOR_MONITOR2, string);
- }
- }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, "ERROR : Vous n'êtes pas Admin!");
- return 1;
- }
- return 1;
- }
- if(strcmp(cmd,"/ssay",true)==0)
- {
- if (IsPlayerAdmin(playerid))
- {
- new length = strlen(cmdtext);
- while ((idx < length) && (cmdtext[idx] <= ' '))
- {
- idx++;
- }
- new offset = idx;
- new result[MAX_STRING];
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
- {
- result[idx - offset] = cmdtext[idx];
- idx++;
- }
- result[idx - offset] = EOS;
- if(!strlen(result))
- {
- SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /s(erver)say [message]");
- return 1;
- }
- format(string, sizeof(string), "Server: %s", result);
- SendServerMessage(COLOR_MONITOR,string);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, "ERROR : Vous n'êtes pas Admin!");
- return 1;
- }
- return 1;
- }
- if(strcmp(cmd,"/mc",true)==0)
- {
- if (IsPlayerAdmin(playerid))
- {
- new length = strlen(cmdtext);
- while ((idx < length) && (cmdtext[idx] <= ' '))
- {
- idx++;
- }
- new offset = idx;
- new result[MAX_STRING];
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
- {
- result[idx - offset] = cmdtext[idx];
- idx++;
- }
- result[idx - offset] = EOS;
- if(!strlen(result))
- {
- SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /mc [chat]");
- return 1;
- }
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "RCON Admin %s: %s", sendername,result);
- SendRCONMessage(COLOR_CHAT,string);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, "ERROR : Vous n'êtes pas Admin!");
- return 1;
- }
- return 1;
- }
- return 0;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- if(!success) //If the password was incorrect
- {
- CECHRCON++;
- }
- else
- {
- COKRCON++;
- }
- return 1;
- }
- public SendServerMessage(color,const string[])
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- SendClientMessage(i, color, string);
- }
- }
- }
- public OnPlayerText(playerid, text[])
- {
- TotalChatMessages++;
- return 1;
- }
- public SendRCONMessage(color,const string[])
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if (IsPlayerAdmin(i))
- {
- SendClientMessage(i, color, string);
- }
- }
- }
- }
- public OnPlayerConnect(playerid)
- {
- TotalConnections++;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- switch(reason)
- {
- case 0: { TotalTimeouts++; }
- case 2: { TotalKicks++; }
- }
- return 1;
- }
- strtok(const string[], &index,seperator=' ')
- {
- new length = strlen(string);
- new offset = index;
- new result[128];
- while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- if ((index < length) && (string[index] == seperator))
- {
- index++;
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment