Discord Integration
- Server <> Discord chat - Player commands - Admin commands
This commit is contained in:
parent
306f1b01d5
commit
fc49cca074
@ -422,7 +422,7 @@ thread OnPlayerUnbanIP( playerid, irc, address[ ] )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DCC_SendChannelMessageFormatted( discordGeneralChan, "**(UNBANNED)** IP %s has been un-banned from the server.", address );
|
DCC_SendChannelMessageFormatted( discordLogChan, "**Command Success:** IP %s has been un-banned from the server.", address );
|
||||||
}
|
}
|
||||||
format( szNormalString, sizeof( szNormalString ), "DELETE FROM `BANS` WHERE `IP` = '%s'", mysql_escape( address ) );
|
format( szNormalString, sizeof( szNormalString ), "DELETE FROM `BANS` WHERE `IP` = '%s'", mysql_escape( address ) );
|
||||||
mysql_single_query( szNormalString );
|
mysql_single_query( szNormalString );
|
||||||
@ -461,8 +461,8 @@ thread OnPlayerUnbanPlayer( playerid, irc, player[ ] )
|
|||||||
if ( !irc ) AddAdminLogLineFormatted( "%s(%d) has un-banned %s", ReturnPlayerName( playerid ), playerid, player );
|
if ( !irc ) AddAdminLogLineFormatted( "%s(%d) has un-banned %s", ReturnPlayerName( playerid ), playerid, player );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
format(szNormalString, sizeof(szNormalString),"**(UNBANNED)** %s has been un-banned from the server.", player);
|
format(szNormalString, sizeof(szNormalString),"**[DISCORD LOG]** %s has been un-banned from the server.", player);
|
||||||
DCC_SendChannelMessage( discordGeneralChan, szNormalString );
|
DCC_SendChannelMessage( discordLogChan, szNormalString );
|
||||||
}
|
}
|
||||||
format(szNormalString, sizeof(szNormalString), "DELETE FROM `BANS` WHERE `NAME` = '%s'", mysql_escape( player ) );
|
format(szNormalString, sizeof(szNormalString), "DELETE FROM `BANS` WHERE `NAME` = '%s'", mysql_escape( player ) );
|
||||||
mysql_single_query( szNormalString );
|
mysql_single_query( szNormalString );
|
||||||
|
@ -1,129 +1,86 @@
|
|||||||
/*
|
/*
|
||||||
* Irresistible Gaming (c) 2018
|
* Irresistible Gaming (c) 2018
|
||||||
* Developed by Lorenc
|
* Developed by Lorenc and Night
|
||||||
* Module: cnr\discord\discord_commands.pwn
|
* Module: cnr\discord\discord_commands.pwn
|
||||||
* Purpose: commands that can be used on the discord channel
|
* Purpose: commands that can be used on the discord channel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ** Error Checking ** */
|
/* ** Includes ** */
|
||||||
#if defined DISCORD_DISABLED
|
#include < YSI\y_hooks >
|
||||||
#endinput
|
#include < discord-command >
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ** Definitions ** */
|
/* ** Commands ** */
|
||||||
DQCMD:lastlogged( DCC_Channel: channel, DCC_User: user, params[ ] )
|
DISCORD:commands( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
if (channel != discordCmdsChan) {
|
||||||
bool: hasPermission;
|
DCC_SendChannelMessageFormatted(channel, "**[ERROR]** You can only use this command in <#%s> channel!", DISCORD_COMMANDS_CHAN);
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleVoice, hasPermission );
|
|
||||||
|
|
||||||
if ( hasPermission )
|
|
||||||
{
|
|
||||||
static
|
|
||||||
player[ MAX_PLAYER_NAME ];
|
|
||||||
|
|
||||||
if ( sscanf( params, "s[24]", player ) ) return 0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
format( szNormalString, sizeof( szNormalString ), "SELECT `LASTLOGGED` FROM `USERS` WHERE `NAME` = '%s' LIMIT 0,1", mysql_escape( player ) );
|
|
||||||
mysql_function_query( dbHandle, szNormalString, true, "OnPlayerLastLogged", "iis", INVALID_PLAYER_ID, 1, player );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else DCC_SendUserMessage( user, "**Error:** This command requires voice." );
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:weeklytime( DCC_Channel: channel, DCC_User: user, params[ ] )
|
|
||||||
{
|
|
||||||
new
|
new
|
||||||
bool: hasPermission;
|
bool: hasMember;
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleVoice, hasPermission );
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleMember, hasMember );
|
||||||
|
|
||||||
if ( hasPermission )
|
if ( hasMember )
|
||||||
{
|
{
|
||||||
static
|
DCC_SendChannelMessage(channel, "**Commands:**\n**!stats** - Displays the statistics of a user.\n**!say** - Sends a message to in-game chat.\n**!players** - Displays the current online players.\
|
||||||
player[ MAX_PLAYER_NAME ]
|
\n**!admins** - Displays the current online administrators.\n**!weeklytime** - Shows the weekly time of a player.\n**!lastlogged** - Shows the last played time of a user." );
|
||||||
;
|
|
||||||
|
|
||||||
if ( sscanf( params, "s[24]", player ) ) return 0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
format( szNormalString, sizeof( szNormalString ), "SELECT `UPTIME`,`WEEKEND_UPTIME` FROM `USERS` WHERE `NAME` = '%s' LIMIT 0,1", mysql_escape( player ) );
|
|
||||||
mysql_function_query( dbHandle, szNormalString, true, "OnPlayerWeeklyTime", "iis", INVALID_PLAYER_ID, 1, player );
|
|
||||||
}
|
}
|
||||||
}
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate role to use this command." );
|
||||||
else DCC_SendUserMessage( user, "**Error:** This command requires voice." );
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:idof( DCC_Channel: channel, DCC_User: user, params[ ] )
|
DISCORD:say( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
if (channel != discordChatChan) {
|
||||||
bool: hasPermission;
|
DCC_SendChannelMessageFormatted(channel, "**[ERROR]** You can only use this command in <#%s> channel!", DISCORD_CHAT_CHAN);
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleVoice, hasPermission );
|
|
||||||
|
|
||||||
if ( hasPermission )
|
|
||||||
{
|
|
||||||
new pID;
|
|
||||||
if ( sscanf( params, "u", pID ) ) return 0;
|
|
||||||
if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return 0;
|
|
||||||
format( szNormalString, sizeof( szNormalString ), "**In-game ID of %s:** %d", ReturnPlayerName( pID ), pID );
|
|
||||||
DCC_SendChannelMessage( discordGeneralChan, szNormalString );
|
|
||||||
}
|
|
||||||
else DCC_SendUserMessage( user, "**Error:** This command requires voice." );
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:say( DCC_Channel: channel, DCC_User: user, params[ ] )
|
|
||||||
{
|
|
||||||
new
|
new
|
||||||
bool: hasPermission;
|
bool: hasMember;
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleVoice, hasPermission );
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleMember, hasMember );
|
||||||
|
|
||||||
if ( hasPermission )
|
if ( hasMember )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
szAntispam[ 64 ];
|
szAntispam[ 64 ];
|
||||||
printf("SAY %s", params);
|
|
||||||
if ( !isnull( params ) && !textContainsIP( params ) )
|
if ( !isnull( params ) && !textContainsIP( params ) )
|
||||||
{
|
{
|
||||||
format( szAntispam, 64, "!say_%s", ReturnDiscordName( user ) );
|
format( szAntispam, 64, "!say_%s", ReturnDiscordName( author ) );
|
||||||
if ( GetGVarInt( szAntispam ) < g_iTime )
|
if ( GetGVarInt( szAntispam ) < g_iTime )
|
||||||
{
|
{
|
||||||
new
|
if ( hasMember )
|
||||||
bool: hasAdmin;
|
SetGVarInt( szAntispam, g_iTime + 10 );
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleLead, hasAdmin );
|
|
||||||
|
|
||||||
if ( hasAdmin )
|
|
||||||
SetGVarInt( szAntispam, g_iTime + 2 );
|
|
||||||
|
|
||||||
// send message
|
// send message
|
||||||
SendClientMessageToAllFormatted( -1, "{4DFF88}(Discord %s) {00CD45}%s:{FFFFFF} %s", discordLevelToString( user ), ReturnDiscordName( user ), params );
|
SendClientMessageToAllFormatted( -1, "{7289DA}(Discord %s) {FFFFFF}%s:{99AAB5} %s", discordLevelToString( author ), ReturnDiscordName( author ), params );
|
||||||
DCC_SendChannelMessageFormatted( discordGeneralChan, "**(Discord %s) %s:** %s", discordLevelToString( user ), ReturnDiscordName( user ), params );
|
DCC_SendChannelMessageFormatted( discordChatChan, "**(Discord %s) %s:** %s", discordLevelToString( author ), ReturnDiscordName( author ), params );
|
||||||
}
|
}
|
||||||
else DCC_SendUserMessage( user, "You must wait 2 seconds before speaking again." );
|
else DCC_SendChannelMessage( channel, "You must wait 10 seconds before speaking again." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else DCC_SendUserMessage( user, "**Error:** This command requires voice." );
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate role to use this command." );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:players( DCC_Channel: channel, DCC_User: user, params[ ] )
|
DISCORD:players( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
{
|
{
|
||||||
|
if (channel != discordCmdsChan) {
|
||||||
|
DCC_SendChannelMessageFormatted(channel, "**[ERROR]** You can only use this command in <#%s> channel!", DISCORD_COMMANDS_CHAN);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
new
|
new
|
||||||
bool: hasPermission;
|
bool: hasMember;
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleVoice, hasPermission );
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleMember, hasMember );
|
||||||
|
|
||||||
print("Called players");
|
if ( hasMember )
|
||||||
if ( hasPermission )
|
|
||||||
{
|
{
|
||||||
print("Has permission");
|
|
||||||
new
|
new
|
||||||
iPlayers = Iter_Count(Player);
|
iPlayers = Iter_Count(Player);
|
||||||
|
|
||||||
@ -132,140 +89,250 @@ DQCMD:players( DCC_Channel: channel, DCC_User: user, params[ ] )
|
|||||||
{
|
{
|
||||||
foreach(new i : Player) {
|
foreach(new i : Player) {
|
||||||
if ( IsPlayerConnected( i ) ) {
|
if ( IsPlayerConnected( i ) ) {
|
||||||
format( szLargeString, sizeof( szLargeString ), "%s%s(%d), ", szLargeString, ReturnPlayerName( i ), i );
|
format( szLargeString, sizeof( szLargeString ), "There are **%d** player(s) online.", iPlayers );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
format( szLargeString, sizeof( szLargeString ), "%sThere are %d player(s) online.", szLargeString, iPlayers );
|
format( szLargeString, sizeof( szLargeString ), "There are **%d** player(s) online.", iPlayers );
|
||||||
DCC_SendChannelMessage( discordGeneralChan, szLargeString );
|
DCC_SendChannelMessage( discordCmdsChan, szLargeString );
|
||||||
}
|
}
|
||||||
else DCC_SendUserMessage( user, "**Error:** This command requires voice." );
|
else DCC_SendChannelMessage( discordCmdsChan, "**[ERROR]** You don't have an appropriate role to use this command." );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:admins( DCC_Channel: channel, DCC_User: user, params[ ] )
|
DISCORD:admins( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
{
|
{
|
||||||
|
if (channel != discordCmdsChan) {
|
||||||
|
DCC_SendChannelMessageFormatted(channel, "**[ERROR]** You can only use this command in <#%s> channel!", DISCORD_COMMANDS_CHAN);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
new
|
new
|
||||||
bool: hasPermission;
|
bool: hasMember;
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleVoice, hasPermission );
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleMember, hasMember );
|
||||||
|
|
||||||
if ( hasPermission )
|
if ( hasMember )
|
||||||
{
|
{
|
||||||
new count = 0;
|
new count = 0;
|
||||||
szBigString[ 0 ] = '\0';
|
szBigString[ 0 ] = '\0';
|
||||||
|
|
||||||
foreach(new i : Player) {
|
foreach(new i : Player) {
|
||||||
if ( IsPlayerConnected( i ) && p_AdminLevel[ i ] > 0 ) {
|
if ( IsPlayerConnected( i ) && p_AdminLevel[ i ] > 0 ) {
|
||||||
format( szBigString, sizeof( szBigString ), "%s%s(%d), ", szBigString, ReturnPlayerName( i ), i );
|
format( szBigString, sizeof( szBigString ), "%s**%s** (**ID: %d**)\n", szBigString, ReturnPlayerName( i ), i );
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
format( szBigString, sizeof( szBigString ), "%sThere are %d admin(s) online.", szBigString, count );
|
format( szBigString, sizeof( szBigString ), "%sThere are **%d** admin(s) online.", szBigString, count );
|
||||||
DCC_SendChannelMessage( discordGeneralChan, szBigString );
|
DCC_SendChannelMessage( discordCmdsChan, szBigString );
|
||||||
}
|
}
|
||||||
else DCC_SendUserMessage( user, "**Error:** This command requires voice." );
|
else DCC_SendChannelMessage( discordCmdsChan, "**[ERROR]** You don't have an appropriate role to use this command." );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HALF OP */
|
DISCORD:stats( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
DQCMD:acmds( DCC_Channel: channel, DCC_User: user, params[ ] )
|
|
||||||
{
|
{
|
||||||
new
|
if (channel != discordCmdsChan) {
|
||||||
bool: hasPermission;
|
DCC_SendChannelMessageFormatted(channel, "**[ERROR]** You can only use this command in <#%s> channel!", DISCORD_COMMANDS_CHAN);
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleLead, hasPermission );
|
|
||||||
if ( hasPermission )
|
|
||||||
{
|
|
||||||
DCC_SendUserMessage( user, "__**Lead Admin:**__ !kick, !ban, !suspend, !warn, !jail, !getip, !(un)mute\n"\
|
|
||||||
"__**Admin:**__ !unban, !unbanip" );
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:kick( DCC_Channel: channel, DCC_User: user, params[ ] )
|
|
||||||
{
|
|
||||||
new
|
new
|
||||||
bool: hasPermission;
|
bool: hasMember;
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleLead, hasPermission );
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleMember, hasMember );
|
||||||
if ( hasPermission )
|
|
||||||
|
if ( isnull( params ) || strlen( params ) > 24 ) return DCC_SendChannelMessage( discordCmdsChan, "**[USAGE]** !stats [PLAYER_NAME]" );
|
||||||
|
|
||||||
|
if ( hasMember )
|
||||||
{
|
{
|
||||||
new pID, reason[64];
|
format( szNormalString, sizeof( szNormalString ), "SELECT * FROM `USERS` WHERE `NAME`='%s' LIMIT 0,1", mysql_escape( params ) );
|
||||||
if (sscanf( params, "uS(No reason)[64]", pID, reason)) return DCC_SendUserMessage( user, "**Usage:** !kick [PLAYER_ID] [REASON]" );
|
mysql_tquery( dbHandle, szNormalString, "OnPlayerDiscordStats", "ds", INVALID_PLAYER_ID, params );
|
||||||
if (IsPlayerConnected(pID))
|
|
||||||
{
|
|
||||||
DCC_SendChannelMessageFormatted( discordAdminChan, "**Command Success:** %s(%d) has been kicked.", ReturnPlayerName( pID ), pID );
|
|
||||||
SendGlobalMessage( -1, ""COL_PINK"[DISCORD ADMIN]{FFFFFF} %s(%d) has been kicked by %s "COL_GREEN"[REASON: %s]", ReturnPlayerName(pID), pID, ReturnDiscordName( user ), reason);
|
|
||||||
KickPlayerTimed( pID );
|
|
||||||
}
|
|
||||||
else DCC_SendUserMessage( user, "**Command Error:** Player is not connected!" );
|
|
||||||
}
|
}
|
||||||
|
else DCC_SendChannelMessage( discordCmdsChan, "**[ERROR]** You don't have an appropriate role to use this command." );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:ban( DCC_Channel: channel, DCC_User: user, params[ ] )
|
thread OnPlayerDiscordStats( playerid, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
bool: hasPermission;
|
iScore, iDeaths, iKills, iVIP,
|
||||||
|
rows, fields;
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleLead, hasPermission );
|
cache_get_data( rows, fields );
|
||||||
if ( hasPermission )
|
|
||||||
|
if ( rows )
|
||||||
{
|
{
|
||||||
new pID, reason[64];
|
iScore = cache_get_field_content_int( 0, "SCORE", dbHandle );
|
||||||
if (sscanf( params, "uS(No reason)[64]", pID, reason)) return DCC_SendUserMessage( user, "**Usage:** !ban [PLAYER_ID] [REASON]" );
|
iKills = cache_get_field_content_int( 0, "KILLS", dbHandle );
|
||||||
if (IsPlayerConnected(pID))
|
iDeaths = cache_get_field_content_int( 0, "DEATHS", dbHandle );
|
||||||
{
|
iVIP = cache_get_field_content_int( 0, "VIP_PACKAGE", dbHandle );
|
||||||
DCC_SendChannelMessageFormatted( discordAdminChan, "**Command Success:** %s(%d) has been banned.", ReturnPlayerName( pID ), pID );
|
|
||||||
SendGlobalMessage( -1, ""COL_PINK"[DISCORD ADMIN]{FFFFFF} %s has banned %s(%d) "COL_GREEN"[REASON: %s]", ReturnDiscordName( user ), ReturnPlayerName( pID ), pID, reason );
|
DCC_SendChannelMessageFormatted( discordCmdsChan, "__**%s**__ - **Score:** %d, **Kills:** %d, **Deaths:** %d, **Ratio:** %0.2f, **VIP:** %s", params, iScore, iKills, iDeaths, floatdiv( iKills, iDeaths ), VIPToString( iVIP ) );
|
||||||
AdvancedBan( pID, "Discord Administrator", reason, ReturnPlayerIP( pID ) );
|
|
||||||
}
|
|
||||||
else DCC_SendUserMessage( user, "**Command Error:** Player is not connected!" );
|
|
||||||
}
|
}
|
||||||
|
else DCC_SendChannelMessage( discordCmdsChan, "**[ERROR]** This player doesn't exist." );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:suspend( DCC_Channel: channel, DCC_User: user, params[ ] )
|
DISCORD:weeklytime( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
if (channel != discordCmdsChan) {
|
||||||
bool: hasPermission;
|
DCC_SendChannelMessageFormatted(channel, "**[ERROR]** You can only use this command in <#%s> channel!", DISCORD_COMMANDS_CHAN);
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleLead, hasPermission );
|
|
||||||
if ( hasPermission )
|
|
||||||
{
|
|
||||||
new pID, reason[50], hours, days;
|
|
||||||
if ( sscanf( params, "uddS(No Reason)[50]", pID, hours, days, reason ) ) return DCC_SendUserMessage( user, "**Usage:** !suspend [PLAYER_ID] [HOURS] [DAYS] [REASON]" );
|
|
||||||
if ( hours < 0 || hours > 24 ) return DCC_SendUserMessage( user, "**Command Error:** Please specify an hour between 0 and 24." );
|
|
||||||
if ( days < 0 || days > 60 ) return DCC_SendUserMessage( user, "**Command Error:** Please specifiy the amount of days between 0 and 60." );
|
|
||||||
if ( days == 0 && hours == 0 ) return DCC_SendUserMessage( user, "**Command Error:** Invalid time specified." );
|
|
||||||
if ( IsPlayerConnected( pID ) )
|
|
||||||
{
|
|
||||||
DCC_SendChannelMessageFormatted( discordAdminChan, "**Command Success:** %s(%d) has been suspended for %d hour(s) and %d day(s).", ReturnPlayerName( pID ), pID, hours, days );
|
|
||||||
SendGlobalMessage( -1, ""COL_PINK"[DISCORD ADMIN]{FFFFFF} %s has suspended %s(%d) for %d hour(s) and %d day(s) "COL_GREEN"[REASON: %s]", ReturnDiscordName( user ), ReturnPlayerName( pID ), pID, hours, days, reason );
|
|
||||||
new time = g_iTime + ( hours * 3600 ) + ( days * 86400 );
|
|
||||||
AdvancedBan( pID, "Discord Administrator", reason, ReturnPlayerIP( pID ), time );
|
|
||||||
}
|
|
||||||
else DCC_SendUserMessage( user, "**Command Error:** Player is not connected!" );
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:warn( DCC_Channel: channel, DCC_User: user, params[ ] )
|
new
|
||||||
|
bool: hasMember;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleMember, hasMember );
|
||||||
|
|
||||||
|
if ( isnull( params ) || strlen( params ) > 24 ) return DCC_SendChannelMessage( discordCmdsChan, "**[USAGE]** !weeklytime [PLAYER_NAME]" );
|
||||||
|
|
||||||
|
if ( hasMember )
|
||||||
|
{
|
||||||
|
format( szNormalString, sizeof( szNormalString ), "SELECT `UPTIME`,`WEEKEND_UPTIME` FROM `USERS` WHERE `NAME` = '%s' LIMIT 0,1", mysql_escape( params ) );
|
||||||
|
mysql_tquery( dbHandle, szNormalString, "OnPlayerDiscordWeekly", "is", INVALID_PLAYER_ID, params );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage( discordCmdsChan, "**[ERROR]** You don't have an appropriate role to use this command." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
thread OnPlayerDiscordWeekly( playerid, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
bool: hasPermission;
|
rows, fields,
|
||||||
|
iCurrentUptime, iLastUptime
|
||||||
|
;
|
||||||
|
cache_get_data( rows, fields );
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleLead, hasPermission );
|
if ( rows )
|
||||||
if ( hasPermission )
|
{
|
||||||
|
iCurrentUptime = cache_get_field_content_int( 0, "UPTIME", dbHandle );
|
||||||
|
iLastUptime = cache_get_field_content_int( 0, "WEEKEND_UPTIME", dbHandle );
|
||||||
|
|
||||||
|
DCC_SendChannelMessageFormatted( discordCmdsChan, "**%s's** weekly time is **%s**.", params, secondstotime( iCurrentUptime - iLastUptime ) );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage( discordCmdsChan, "**[ERROR]** This player doesn't exist." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
DISCORD:lastlogged( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
|
{
|
||||||
|
if (channel != discordCmdsChan) {
|
||||||
|
DCC_SendChannelMessageFormatted(channel, "**[ERROR]** You can only use this command in <#%s> channel!", DISCORD_COMMANDS_CHAN);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
bool: hasMember;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleMember, hasMember );
|
||||||
|
|
||||||
|
if ( isnull( params ) || strlen( params ) > 24 ) return DCC_SendChannelMessage( discordCmdsChan, "**[USAGE]** !lastlogged [PLAYER_NAME]" );
|
||||||
|
|
||||||
|
if ( hasMember )
|
||||||
|
{
|
||||||
|
format( szNormalString, sizeof( szNormalString ), "SELECT `LASTLOGGED` FROM `USERS` WHERE `NAME` = '%s' LIMIT 0,1", mysql_escape( params ) );
|
||||||
|
mysql_tquery( dbHandle, szNormalString, "OnPlayerDiscordLastLogged", "is", INVALID_PLAYER_ID, params );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage( discordCmdsChan, "**[ERROR]** You don't have an appropriate role to use this command." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
thread OnPlayerDiscordLastLogged( playerid, params[ ] )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
rows, fields,
|
||||||
|
time, Field[ 50 ]
|
||||||
|
;
|
||||||
|
cache_get_data( rows, fields );
|
||||||
|
|
||||||
|
if ( rows )
|
||||||
|
{
|
||||||
|
cache_get_field_content( 0, "LASTLOGGED", Field );
|
||||||
|
|
||||||
|
time = g_iTime - strval( Field );
|
||||||
|
if ( time > 86400 )
|
||||||
|
{
|
||||||
|
time /= 86400;
|
||||||
|
format( Field, sizeof( Field ), "%d day(s) ago.", time );
|
||||||
|
}
|
||||||
|
else if ( time > 3600 )
|
||||||
|
{
|
||||||
|
time /= 3600;
|
||||||
|
format( Field, sizeof( Field ), "%d hour(s) ago.", time );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
time /= 60;
|
||||||
|
format( Field, sizeof( Field ), "%d minute(s) ago.", time );
|
||||||
|
}
|
||||||
|
|
||||||
|
DCC_SendChannelMessageFormatted( discordCmdsChan, "**%s** last logged **%s**", params, Field );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage( discordCmdsChan, "**[ERROR]** This player doesn't exist." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Level 1+ */
|
||||||
|
DISCORD:acmds( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
|
{
|
||||||
|
if (channel != discordAdminChan) {
|
||||||
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
bool: hasExec, bool: hasDev, bool: hasCouncil,
|
||||||
|
bool: hasLead, bool: hasSenior, bool: hasGeneral, bool: hasTrial;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleGeneral, hasGeneral );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleTrial, hasTrial );
|
||||||
|
|
||||||
|
if ( hasExec || hasDev || hasCouncil || hasLead || hasSenior || hasGeneral || hasTrial )
|
||||||
|
{
|
||||||
|
DCC_SendChannelMessage( discordAdminChan, "**Commands:**\n**!kick** - Kicking a player from the server.\n**!mute** - Muting a player.\n**!unmute** - Un-muting a player.\n**!suspend** - Suspending a player.\
|
||||||
|
\n**!ban** - Banning a player.\n**!unban** - Unban a player from the server.\n**!jail** - Jailing a player.\n**!unjail** - Un-jailing a player\
|
||||||
|
\n**!getip** - Getting IP of a player.\n**!warn** - Warning a player.\n**!ans** - Answering a question.");
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
DISCORD:warn( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
|
{
|
||||||
|
if (channel != discordAdminChan) {
|
||||||
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
bool: hasExec, bool: hasDev, bool: hasCouncil,
|
||||||
|
bool: hasLead, bool: hasSenior, bool: hasGeneral, bool: hasTrial;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleGeneral, hasGeneral );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleTrial, hasTrial );
|
||||||
|
|
||||||
|
if ( hasExec || hasDev || hasCouncil || hasLead || hasSenior || hasGeneral || hasTrial )
|
||||||
{
|
{
|
||||||
new pID, reason[50];
|
new pID, reason[50];
|
||||||
if ( sscanf( params, "uS(No Reason)[32]", pID, reason ) ) return DCC_SendUserMessage( user, "**Usage:** !warn [PLAYER_ID] [REASON]" );
|
if ( sscanf( params, "uS(No Reason)[32]", pID, reason ) ) DCC_SendChannelMessage( discordAdminChan, "**[USAGE]** !warn [PLAYER_ID] [REASON]" );
|
||||||
if ( IsPlayerConnected( pID ) )
|
if ( IsPlayerConnected( pID ) )
|
||||||
{
|
{
|
||||||
p_Warns[ pID ] ++;
|
p_Warns[ pID ] ++;
|
||||||
DCC_SendChannelMessageFormatted( discordAdminChan, "**Command Success:** %s(%d) has been warned [%d/3].", ReturnPlayerName( pID ), pID, p_Warns[ pID ] );
|
DCC_SendChannelMessageFormatted( discordLogChan, "**[DISCORD LOG]** **%s** has warned **%s(%d) [%d/3]** **[REASON: %s]**.", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID,p_Warns[ pID ], reason );
|
||||||
SendGlobalMessage( -1, ""COL_PINK"[ADMIN]"COL_WHITE" %s(%d) has been warned by %s "COL_GREEN"[REASON: %s]", ReturnPlayerName( pID ), pID, ReturnDiscordName( user ), reason );
|
SendGlobalMessage( -1, "{7289DA}[DISCORD]{FFFFFF} %s {99AAB5}has warned {FFFFFF}%s(%d) [%d/3] "COL_GREEN"[REASON: %s]", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID,p_Warns[ pID ], reason );
|
||||||
|
|
||||||
if ( p_Warns[ pID ] >= 3 )
|
if ( p_Warns[ pID ] >= 3 )
|
||||||
{
|
{
|
||||||
@ -275,187 +342,370 @@ DQCMD:warn( DCC_Channel: channel, DCC_User: user, params[ ] )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else DCC_SendUserMessage( user, "**Command Error:** Player is not connected!" );
|
else DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Player is not connected!" );
|
||||||
}
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:jail( DCC_Channel: channel, DCC_User: user, params[ ] )
|
DISCORD:jail( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
if (channel != discordAdminChan) {
|
||||||
bool: hasPermission;
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleLead, hasPermission );
|
new
|
||||||
if ( hasPermission )
|
bool: hasExec, bool: hasDev, bool: hasCouncil,
|
||||||
|
bool: hasLead, bool: hasSenior, bool: hasGeneral, bool: hasTrial;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleGeneral, hasGeneral );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleTrial, hasTrial );
|
||||||
|
|
||||||
|
if ( hasExec || hasDev || hasCouncil || hasLead || hasSenior || hasGeneral || hasTrial )
|
||||||
{
|
{
|
||||||
new pID, reason[50], Seconds;
|
new pID, reason[50], Seconds;
|
||||||
if ( sscanf( params, "udS(No Reason)[32]", pID, Seconds, reason ) ) return DCC_SendUserMessage( user, "**Usage:** !jail [PLAYER_ID] [SECONDS] [REASON]" );
|
if ( sscanf( params, "udS(No Reason)[32]", pID, Seconds, reason ) ) return DCC_SendChannelMessage( discordAdminChan, "**[USAGE]** !jail [PLAYER_ID] [SECONDS] [REASON]" );
|
||||||
if ( Seconds > 20000 || Seconds < 1 ) return DCC_SendUserMessage( user, "**Command Error:** You're misleading the seconds limit! ( 0 - 20000 )");
|
if ( Seconds > 20000 || Seconds < 1 ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** You're misleading the seconds limit! ( 0 - 20000 )" );
|
||||||
if ( IsPlayerConnected( pID ) )
|
if ( IsPlayerConnected( pID ) )
|
||||||
{
|
{
|
||||||
DCC_SendChannelMessageFormatted( discordAdminChan, "**Command Success:** %s(%d) has been jailed for %d seconds.", ReturnPlayerName( pID ), pID, Seconds );
|
DCC_SendChannelMessageFormatted( discordLogChan, "**[DISCORD LOG]** **%s** has sent **%s(%d)** to jail for **%d** seconds. **[REASON: %s]**", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID, Seconds, reason );
|
||||||
SendGlobalMessage( -1, ""COL_GOLD"[DISCORD JAIL]{FFFFFF} %s(%d) has been sent to jail for %d seconds by %s "COL_GREEN"[REASON: %s]", ReturnPlayerName( pID ), pID, Seconds, ReturnDiscordName( user ), reason );
|
SendGlobalMessage( -1, "{7289DA}[DISCORD]{FFFFFF} %s {99AAB5}has sent {FFFFFF}%s(%d) {99AAB5}to jail for {FFFFFF}%d seconds. "COL_GREEN"[REASON: %s]", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID, Seconds, reason );
|
||||||
JailPlayer( pID, Seconds, 1 );
|
JailPlayer( pID, Seconds, 1 );
|
||||||
}
|
}
|
||||||
else DCC_SendUserMessage( user, "**Command Error:** Player is not connected!" );
|
else DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Player is not connected!" );
|
||||||
}
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:mute( DCC_Channel: channel, DCC_User: user, params[ ] )
|
DISCORD:unjail( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
|
{
|
||||||
|
if (channel != discordAdminChan) {
|
||||||
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
bool: hasExec, bool: hasDev, bool: hasCouncil,
|
||||||
|
bool: hasLead, bool: hasSenior, bool: hasGeneral, bool: hasTrial;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleGeneral, hasGeneral );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleTrial, hasTrial );
|
||||||
|
|
||||||
|
if ( hasExec || hasDev || hasCouncil || hasLead || hasSenior || hasGeneral || hasTrial )
|
||||||
{
|
{
|
||||||
new
|
new
|
||||||
bool: hasPermission;
|
pID
|
||||||
|
;
|
||||||
|
if ( sscanf( params, "u", pID ) ) return DCC_SendChannelMessage( discordAdminChan, "**[USAGE]** !unjail [PLAYER_ID]" );
|
||||||
|
if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Invalid Player ID." );
|
||||||
|
if ( !IsPlayerJailed( pID ) ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** The player is not jailed." );
|
||||||
|
if ( IsPlayerConnected( pID ) )
|
||||||
|
{
|
||||||
|
DCC_SendChannelMessageFormatted( discordLogChan, "**[DISCORD LOG]** **%s** has unjailed **%s(%d)**.", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID );
|
||||||
|
SendGlobalMessage( -1, "{7289DA}[DISCORD]{FFFFFF} %s {99AAB5}has unjailed{FFFFFF} %s(%d).", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID );
|
||||||
|
CallLocalFunction( "OnPlayerUnjailed", "dd", pID, 3 );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Player is not connected!" );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
DISCORD:ans( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
|
{
|
||||||
|
if (channel != discordAdminChan) {
|
||||||
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleLead, hasPermission );
|
new
|
||||||
if ( hasPermission )
|
bool: hasExec, bool: hasDev, bool: hasCouncil,
|
||||||
|
bool: hasLead, bool: hasSenior, bool: hasGeneral, bool: hasTrial;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleGeneral, hasGeneral );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleTrial, hasTrial );
|
||||||
|
|
||||||
|
if ( hasExec || hasDev || hasCouncil || hasLead || hasSenior || hasGeneral || hasTrial )
|
||||||
|
{
|
||||||
|
new
|
||||||
|
pID, msg[ 90 ]
|
||||||
|
;
|
||||||
|
if ( sscanf( params, "us[90]", pID, msg ) ) return DCC_SendChannelMessage( discordAdminChan, "**[USAGE]** !ans [PLAYER_ID] [ANSWER]" );
|
||||||
|
if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Invalid Player ID." );
|
||||||
|
if ( IsPlayerConnected( pID ) )
|
||||||
|
{
|
||||||
|
SendClientMessageToAdmins( -1, "{7289DA}[DISCORD]{99AAB5} ({FFFFFF}%s{99AAB5} >> {FFFFFF}%s{99AAB5}):{FFFFFF} %s", ReturnDiscordName( author ), ReturnPlayerName( pID ), msg );
|
||||||
|
SendClientMessageFormatted( pID, -1, "{7289DA}[DISCORD ANSWER] {FFFFFF}%s:{99AAB5} %s", ReturnDiscordName( author ), msg );
|
||||||
|
DCC_SendChannelMessageFormatted( discordLogChan, "**[DISCORD LOG]** **%s** has answered **%s(%d)'s** question.", ReturnDiscordName( author ), ReturnPlayerName(pID), pID );
|
||||||
|
Beep( pID );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Player is not connected!" );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Level 2+ */
|
||||||
|
DISCORD:kick( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
|
{
|
||||||
|
if (channel != discordAdminChan) {
|
||||||
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
bool: hasExec, bool: hasDev, bool: hasCouncil,
|
||||||
|
bool: hasLead, bool: hasSenior, bool: hasGeneral;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleGeneral, hasGeneral );
|
||||||
|
|
||||||
|
if ( hasExec || hasDev || hasCouncil || hasLead || hasSenior || hasGeneral )
|
||||||
|
{
|
||||||
|
new pID, reason[64];
|
||||||
|
|
||||||
|
if (sscanf( params, "uS(No reason)[64]", pID, reason)) return DCC_SendChannelMessage( discordAdminChan, "**[USAGE]** !kick [PLAYER_ID] [REASON]" );
|
||||||
|
if (IsPlayerConnected(pID))
|
||||||
|
{
|
||||||
|
DCC_SendChannelMessageFormatted( discordLogChan, "**[DISCORD LOG]** **%s** has kicked **%s(%d)**. **[REASON: %s]**", ReturnDiscordName( author ), ReturnPlayerName(pID), pID, reason );
|
||||||
|
SendGlobalMessage( -1, "{7289DA}[DISCORD]{FFFFFF} %s {99AAB5}has kicked {FFFFFF}%s(%d) "COL_GREEN"[REASON: %s]", ReturnDiscordName( author ), ReturnPlayerName(pID), pID, reason );
|
||||||
|
KickPlayerTimed( pID );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Player is not connected!" );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
DISCORD:mute( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
|
{
|
||||||
|
if (channel != discordAdminChan) {
|
||||||
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
bool: hasExec, bool: hasDev, bool: hasCouncil,
|
||||||
|
bool: hasLead, bool: hasSenior, bool: hasGeneral;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleGeneral, hasGeneral );
|
||||||
|
|
||||||
|
if ( hasExec || hasDev || hasCouncil || hasLead || hasSenior || hasGeneral )
|
||||||
{
|
{
|
||||||
new pID, seconds, reason[ 32 ];
|
new pID, seconds, reason[ 32 ];
|
||||||
|
|
||||||
if ( sscanf( params, "udS(No Reason)[32]", pID, seconds, reason ) ) return DCC_SendUserMessage( user, "**Usage:** !amute [PLAYER_ID] [SECONDS] [REASON]");
|
if ( sscanf( params, "udS(No Reason)[32]", pID, seconds, reason ) ) return DCC_SendChannelMessage( discordAdminChan, "**[USAGE]** !mute [PLAYER_ID] [SECONDS] [REASON]" );
|
||||||
else if ( !IsPlayerConnected( pID ) ) DCC_SendUserMessage( user, "**Command Error:** Invalid Player ID.");
|
else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Invalid Player ID." );
|
||||||
else if ( p_AdminLevel[ pID ] > 4 ) return DCC_SendUserMessage( user, "**Command Error:** No sexy head admin targetting!");
|
else if ( p_AdminLevel[ pID ] > 4 ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** You cannot use this command on admins higher than level 4.");
|
||||||
else if ( seconds < 0 || seconds > 10000000 ) return DCC_SendUserMessage( user, "**Command Error:** Specify the amount of seconds from 1 - 10000000." );
|
else if ( seconds < 0 || seconds > 10000000 ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Specify the amount of seconds from 1 - 10000000." );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendGlobalMessage( -1, ""COL_PINK"[DISCORD ADMIN]{FFFFFF} %s has been muted by %s for %d seconds "COL_GREEN"[REASON: %s]", ReturnPlayerName( pID ), ReturnDiscordName( user ), seconds, reason );
|
DCC_SendChannelMessageFormatted( discordLogChan, "**[DISCORD LOG]** **%s** has muted **%s(%d)** for **%d** seconds. **[REASON: %s]**", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID, seconds, reason );
|
||||||
|
SendGlobalMessage( -1, "{7289DA}[DISCORD]{FFFFFF} %s {99AAB5}has muted{FFFFFF} %s(%d) {99AAB5}for {FFFFFF}%d {99AAB5}seconds "COL_GREEN"[REASON: %s]", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID, seconds, reason );
|
||||||
GameTextForPlayer( pID, "~r~Muted!", 4000, 4 );
|
GameTextForPlayer( pID, "~r~Muted!", 4000, 4 );
|
||||||
p_Muted{ pID } = true;
|
p_Muted{ pID } = true;
|
||||||
p_MutedTime[ pID ] = g_iTime + seconds;
|
p_MutedTime[ pID ] = g_iTime + seconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:unmute( DCC_Channel: channel, DCC_User: user, params[ ] )
|
DISCORD:unmute( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
if (channel != discordAdminChan) {
|
||||||
bool: hasPermission;
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleLead, hasPermission );
|
new
|
||||||
if ( hasPermission )
|
bool: hasExec, bool: hasDev, bool: hasCouncil,
|
||||||
|
bool: hasLead, bool: hasSenior, bool: hasGeneral;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleGeneral, hasGeneral );
|
||||||
|
|
||||||
|
if ( hasExec || hasDev || hasCouncil || hasLead || hasSenior || hasGeneral )
|
||||||
{
|
{
|
||||||
new pID;
|
new pID;
|
||||||
if ( sscanf( params, "u", pID )) return DCC_SendUserMessage( user, "/mute [PLAYER_ID]");
|
if ( sscanf( params, "u", pID )) return DCC_SendChannelMessage( discordAdminChan, "**[USAGE]** !unmute [PLAYER_ID]");
|
||||||
else if ( !IsPlayerConnected( pID ) ) return DCC_SendUserMessage( user, "**Command Error:** Invalid Player ID");
|
else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Invalid Player ID." );
|
||||||
else if ( !p_Muted{ pID } ) return DCC_SendUserMessage( user, "**Command Error:** This player isn't muted" );
|
else if ( !p_Muted{ pID } ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** This player isn't muted" );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendGlobalMessage( -1, ""COL_PINK"[DISCORD ADMIN]{FFFFFF} %s has been un-muted by %s.", ReturnPlayerName( pID ), ReturnDiscordName( user ) );
|
DCC_SendChannelMessageFormatted( discordLogChan, "**[DISCORD LOG]** **%s** has un-muted **%s(%d)**.", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID );
|
||||||
|
SendGlobalMessage( -1, "{7289DA}[DISCORD]{FFFFFF} %s {99AAB5}has un-muted{FFFFFF} %s(%d).", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID );
|
||||||
GameTextForPlayer( pID, "~g~Un-Muted!", 4000, 4 );
|
GameTextForPlayer( pID, "~g~Un-Muted!", 4000, 4 );
|
||||||
p_Muted{ pID } = false;
|
p_Muted{ pID } = false;
|
||||||
p_MutedTime[ pID ] = 0;
|
p_MutedTime[ pID ] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:getip( DCC_Channel: channel, DCC_User: user, params[ ] )
|
DISCORD:suspend( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
{
|
{
|
||||||
new
|
if (channel != discordAdminChan) {
|
||||||
bool: hasPermission;
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleLead, hasPermission );
|
new
|
||||||
if ( hasPermission )
|
bool: hasExec, bool: hasDev, bool: hasCouncil,
|
||||||
|
bool: hasLead, bool: hasSenior, bool: hasGeneral;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleGeneral, hasGeneral );
|
||||||
|
|
||||||
|
if ( hasExec || hasDev || hasCouncil || hasLead || hasSenior || hasGeneral )
|
||||||
{
|
{
|
||||||
new pID;
|
new pID, reason[50], hours, days;
|
||||||
if ( sscanf( params, "u", pID ) ) return DCC_SendUserMessage( user, "**Usage:** !warn [PLAYER_ID] [REASON]" );
|
if ( sscanf( params, "uddS(No Reason)[50]", pID, hours, days, reason ) ) return DCC_SendChannelMessage( discordAdminChan, "**[USAGE]** !suspend [PLAYER_ID] [HOURS] [DAYS] [REASON]" );
|
||||||
|
if ( hours < 0 || hours > 24 ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Please specify an hour between 0 and 24." );
|
||||||
|
if ( days < 0 || days > 60 ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Please specifiy the amount of days between 0 and 60." );
|
||||||
|
if ( days == 0 && hours == 0 ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Invalid time specified." );
|
||||||
|
|
||||||
if ( IsPlayerConnected( pID ) )
|
if ( IsPlayerConnected( pID ) )
|
||||||
{
|
{
|
||||||
if ( p_AdminLevel[ pID ] > 4 ) return DCC_SendUserMessage( user, "**Command Error:** No sexy head admin targetting!");
|
DCC_SendChannelMessageFormatted( discordLogChan, "**[DISCORD LOG]** **%s** has suspended **%s(%d)** for **%d hour(s)** and **%d day(s)** **[REASON: %s]**", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID, hours, days, reason );
|
||||||
DCC_SendChannelMessageFormatted( discordAdminChan, "**Command Success:** %s(%d)'s IP is 14%s", ReturnPlayerName( pID ), pID, ReturnPlayerIP( pID ) );
|
SendGlobalMessage( -1, "{7289DA}[DISCORD]{FFFFFF} %s {99AAB5}has suspended {FFFFFF}%s(%d) {99AAB5}for {FFFFFF}%d {99AAB5}hour(s) and {FFFFFF}%d {99AAB5}day(s).", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID, hours, days );
|
||||||
|
new time = g_iTime + ( hours * 3600 ) + ( days * 86400 );
|
||||||
|
AdvancedBan( pID, "DISCORDistrator", reason, ReturnPlayerIP( pID ), time );
|
||||||
}
|
}
|
||||||
else DCC_SendUserMessage( user, "**Command Error:** Player is not connected!" );
|
else DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Player is not connected!" );
|
||||||
}
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OP */
|
/* Level 3+ */
|
||||||
DQCMD:unban( DCC_Channel: channel, DCC_User: user, params[ ] )
|
DISCORD:ban( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
{
|
{
|
||||||
|
if (channel != discordAdminChan) {
|
||||||
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
bool: hasExec, bool: hasDev, bool: hasCouncil,
|
||||||
|
bool: hasLead, bool: hasSenior;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
|
||||||
|
if ( hasExec || hasDev || hasCouncil || hasLead || hasSenior )
|
||||||
|
{
|
||||||
|
new pID, reason[64];
|
||||||
|
if (sscanf( params, "uS(No reason)[64]", pID, reason)) return DCC_SendChannelMessage( discordAdminChan, "**[USAGE]** !ban [PLAYER_ID] [REASON]" );
|
||||||
|
if (IsPlayerConnected(pID))
|
||||||
|
{
|
||||||
|
if ( p_AdminLevel[ pID ] >= 3 ) return DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** You can't use this on higher level admins." );
|
||||||
|
DCC_SendChannelMessageFormatted( discordLogChan, "**[DISCORD LOG]** **%s** has banned **%s(%d)**. **[REASON: %s]**", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID, reason );
|
||||||
|
SendGlobalMessage( -1, "{7289DA}[DISCORD]{FFFFFF} %s {99AAB5}has banned{FFFFFF} %s(%d) "COL_GREEN"[REASON: %s]", ReturnDiscordName( author ), ReturnPlayerName( pID ), pID, reason );
|
||||||
|
AdvancedBan( pID, "DISCORDistrator", reason, ReturnPlayerIP( pID ) );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Player is not connected!" );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
DISCORD:getip( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
|
{
|
||||||
|
if (channel != discordAdminChan) {
|
||||||
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
new
|
||||||
|
bool: hasExec, bool: hasDev, bool: hasCouncil,
|
||||||
|
bool: hasLead, bool: hasSenior;
|
||||||
|
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
|
||||||
|
if ( hasExec || hasDev || hasCouncil || hasLead || hasSenior )
|
||||||
|
{
|
||||||
|
new pID;
|
||||||
|
if ( sscanf( params, "u", pID ) ) return DCC_SendChannelMessage( discordAdminChan, "**[USAGE]** !getip [PLAYER_ID]" );
|
||||||
|
if ( IsPlayerConnected( pID ) )
|
||||||
|
{
|
||||||
|
if ( p_AdminLevel[ pID ] >= 5 || IsPlayerServerMaintainer( pID ) ) return DCC_SendChannelMessage( discordAdminChan, "I love this person so much that I wont give you his IP :)");
|
||||||
|
DCC_SendChannelMessageFormatted( discordAdminChan, "**[DISCORD LOG]** **%s(%d)'s** IP is **%s**", ReturnPlayerName( pID ), pID, ReturnPlayerIP( pID ) );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage( discordAdminChan, "**[ERROR]** Player is not connected!" );
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Level 5+ */
|
||||||
|
DISCORD:unban( DCC_Channel: channel, DCC_User: author, params[ ] )
|
||||||
|
{
|
||||||
|
if (channel != discordAdminChan) {
|
||||||
|
DCC_SendChannelMessage(channel, "**[ERROR]** You can only use this command in admin channel!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
new
|
new
|
||||||
player[24],
|
player[24],
|
||||||
Query[70],
|
Query[70],
|
||||||
bool: hasPermission
|
bool: hasCouncil, bool: hasExec, bool: hasDev
|
||||||
;
|
;
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleHead, hasPermission );
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
|
|
||||||
if ( ! hasPermission ) return 0;
|
if ( hasCouncil || hasExec || hasDev )
|
||||||
else if ( sscanf( params, "s[24]", player ) ) return DCC_SendUserMessage( user, "**Usage:** !unban [PLAYER]" );
|
{
|
||||||
|
if ( sscanf( params, "s[24]", player ) ) return DCC_SendChannelMessage( discordAdminChan, "**[USAGE]** !unban [PLAYER_ID]" );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
format( Query, sizeof( Query ), "SELECT `NAME` FROM `BANS` WHERE `NAME` = '%s'", mysql_escape( player ) );
|
format( Query, sizeof( Query ), "SELECT `NAME` FROM `BANS` WHERE `NAME` = '%s'", mysql_escape( player ) );
|
||||||
mysql_function_query( dbHandle, Query, true, "OnPlayerUnbanPlayer", "dds", INVALID_PLAYER_ID, 1, player );
|
mysql_function_query( dbHandle, Query, true, "OnPlayerUnbanPlayer", "dds", INVALID_PLAYER_ID, 1, player );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else DCC_SendChannelMessage(channel, "**[ERROR]** You don't have an appropriate administration role to use this command." );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DQCMD:unbanip( DCC_Channel: channel, DCC_User: user, params[ ] )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
address[16],
|
|
||||||
Query[70],
|
|
||||||
bool: hasPermission
|
|
||||||
;
|
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleHead, hasPermission );
|
|
||||||
|
|
||||||
if ( ! hasPermission ) return 0;
|
|
||||||
else if (sscanf(params, "s[16]", address)) return DCC_SendUserMessage( user, "**Usage:** !unbanip [IP]" );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
format( Query, sizeof( Query ), "SELECT `IP` FROM `BANS` WHERE `IP` = '%s'", mysql_escape( address ) );
|
|
||||||
mysql_function_query( dbHandle, Query, true, "OnPlayerUnbanIP", "dds", INVALID_PLAYER_ID, 0, address );
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Executive */
|
|
||||||
DQCMD:kickall( DCC_Channel: channel, DCC_User: user, params[ ] )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
bool: hasPermission;
|
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleExecutive, hasPermission );
|
|
||||||
if ( hasPermission )
|
|
||||||
{
|
|
||||||
SendGlobalMessage( -1, ""COL_PINK"[ADMIN]"COL_WHITE" Everyone has been kicked from the server due to a server update." );
|
|
||||||
for( new i, g = GetMaxPlayers( ); i < g; i++ )
|
|
||||||
{
|
|
||||||
if ( IsPlayerConnected( i ) )
|
|
||||||
{
|
|
||||||
Kick( i );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DCC_SendChannelMessage( discordAdminChan, "**Command Success:** All users have been kicked from the server." );
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
DQCMD:rcon( DCC_Channel: channel, DCC_User: user, params[ ] )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
bool: hasPermission;
|
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleExecutive, hasPermission );
|
|
||||||
|
|
||||||
if ( hasPermission )
|
|
||||||
{
|
|
||||||
if ( ! isnull( params ) )
|
|
||||||
{
|
|
||||||
if ( strcmp( params, "exit", true ) != 0 )
|
|
||||||
{
|
|
||||||
DCC_SendChannelMessageFormatted( discordAdminChan, "RCON command **%s** has been executed.", params );
|
|
||||||
SendRconCommand( params );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ** In-Game Discord Commands * **/
|
|
||||||
CMD:discord( playerid, params[ ] )
|
|
||||||
{
|
|
||||||
return SendServerMessage( playerid, "You can access our Discord server at {7289da}sfcnr.com/discord" );
|
|
||||||
}
|
|
@ -5,38 +5,55 @@
|
|||||||
* Purpose: discord implementation in-game
|
* Purpose: discord implementation in-game
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DISCORD_DISABLED // !!!! DISABLED BY DEFAULT !!!!
|
//#define DISCORD_DISABLED // !!!! DISABLED BY DEFAULT !!!!
|
||||||
|
|
||||||
/* ** Includes ** */
|
/* ** Includes ** */
|
||||||
#include < YSI\y_hooks >
|
#include < YSI\y_hooks >
|
||||||
//#include < discord-connector >
|
#include < discord-connector >
|
||||||
|
|
||||||
/* ** Definitions ** */
|
/* ** Definitions ** */
|
||||||
#define DISCORD_GENERAL "191078670360641536"
|
/* Guild */
|
||||||
#define DISCORD_ADMINISTRATION "191078670360641536"
|
#define DISCORD_GUILD "571071428921655348"
|
||||||
#define DISCORD_SPAM "364725535256870913"
|
|
||||||
|
|
||||||
#define DISCORD_ROLE_EXEC "191727949404176384"
|
/* Channels */
|
||||||
#define DISCORD_ROLE_HEAD "191134988354191360"
|
#define DISCORD_ADMIN_CHAN "578879515552382986"
|
||||||
#define DISCORD_ROLE_LEAD "191080382689443841"
|
#define DISCORD_LOG_CHAN "578879541838348308"
|
||||||
#define DISCORD_ROLE_VIP "191180697547833344"
|
#define DISCORD_CHAT_CHAN "578879608032722944"
|
||||||
#define DISCORD_ROLE_VOICE "364678874681966592"
|
#define DISCORD_COMMANDS_CHAN "578879719571849217"
|
||||||
|
#define DISCORD_ASK_CHAN "582137050602405918"
|
||||||
|
|
||||||
/* ** Macros ** */
|
/* Roles */
|
||||||
#define DQCMD:%1(%2) forward discord_%1(%2); public discord_%1(%2)
|
#define DISCORD_ROLE_EXEC "571072485617827870"
|
||||||
|
#define DISCORD_ROLE_DEV "578885173555232789"
|
||||||
|
#define DISCORD_ROLE_COUNCIL "571073680059269193"
|
||||||
|
#define DISCORD_ROLE_LEAD "571073881733857302"
|
||||||
|
#define DISCORD_ROLE_SENIOR "578885422822850560"
|
||||||
|
#define DISCORD_ROLE_GENERAL "578885496655052820"
|
||||||
|
#define DISCORD_ROLE_TRIAL "578885593988202496"
|
||||||
|
#define DISCORD_ROLE_SUPPORT "578885684979302419"
|
||||||
|
#define DISCORD_ROLE_VIP "571073955138502656"
|
||||||
|
#define DISCORD_ROLE_MEMBER "578886006783213597"
|
||||||
|
|
||||||
/* ** Variables ** */
|
/* ** Variables ** */
|
||||||
new stock
|
new stock
|
||||||
DCC_Guild: discordGuild,
|
DCC_Guild: discordGuild,
|
||||||
DCC_Channel: discordGeneralChan,
|
|
||||||
DCC_Channel: discordAdminChan,
|
|
||||||
DCC_Channel: discordSpamChan,
|
|
||||||
|
|
||||||
DCC_Role: discordRoleExecutive,
|
DCC_Channel: discordAdminChan,
|
||||||
DCC_Role: discordRoleHead,
|
DCC_Channel: discordLogChan,
|
||||||
|
DCC_Channel: discordChatChan,
|
||||||
|
DCC_Channel: discordCmdsChan,
|
||||||
|
DCC_Channel: discordAskChan,
|
||||||
|
|
||||||
|
DCC_Role: discordRoleExec,
|
||||||
|
DCC_Role: discordRoleDev,
|
||||||
|
DCC_Role: discordRoleCouncil,
|
||||||
DCC_Role: discordRoleLead,
|
DCC_Role: discordRoleLead,
|
||||||
|
DCC_Role: discordRoleSenior,
|
||||||
|
DCC_Role: discordRoleGeneral,
|
||||||
|
DCC_Role: discordRoleTrial,
|
||||||
|
DCC_Role: discordRoleSupport,
|
||||||
DCC_Role: discordRoleVIP,
|
DCC_Role: discordRoleVIP,
|
||||||
DCC_Role: discordRoleVoice
|
DCC_Role: discordRoleMember
|
||||||
;
|
;
|
||||||
|
|
||||||
stock DCC_SendChannelMessageFormatted( DCC_Channel: channel, const format[ ], va_args< > ) {
|
stock DCC_SendChannelMessageFormatted( DCC_Channel: channel, const format[ ], va_args< > ) {
|
||||||
@ -50,9 +67,9 @@ stock DCC_SendChannelMessageFormatted( DCC_Channel: channel, const format[ ], va
|
|||||||
#pragma unused message
|
#pragma unused message
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
stock DCC_SendUserMessage( DCC_User: user, const message[ ] )
|
stock DCC_SendUserMessage( DCC_User: author, const message[ ] )
|
||||||
{
|
{
|
||||||
#pragma unused user
|
#pragma unused author
|
||||||
#pragma unused message
|
#pragma unused message
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -60,104 +77,93 @@ stock DCC_SendChannelMessageFormatted( DCC_Channel: channel, const format[ ], va
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ** Hooks ** */
|
/* ** Hooks ** */
|
||||||
hook OnScriptInit( )
|
hook OnGameModeInit( )
|
||||||
{
|
{
|
||||||
discordGuild = DCC_FindGuildById( DISCORD_GENERAL );
|
discordGuild = DCC_FindGuildById( DISCORD_GUILD );
|
||||||
discordGeneralChan = DCC_FindChannelById( DISCORD_GENERAL );
|
|
||||||
discordSpamChan = DCC_FindChannelById( DISCORD_SPAM );
|
|
||||||
|
|
||||||
discordRoleExecutive = DCC_FindRoleById( DISCORD_ROLE_EXEC );
|
discordAdminChan = DCC_FindChannelById( DISCORD_ADMIN_CHAN );
|
||||||
discordRoleHead = DCC_FindRoleById( DISCORD_ROLE_HEAD );
|
discordLogChan = DCC_FindChannelById( DISCORD_LOG_CHAN );
|
||||||
|
discordChatChan = DCC_FindChannelById( DISCORD_CHAT_CHAN );
|
||||||
|
discordCmdsChan = DCC_FindChannelById( DISCORD_COMMANDS_CHAN );
|
||||||
|
discordAskChan = DCC_FindChannelById( DISCORD_ASK_CHAN );
|
||||||
|
|
||||||
|
discordRoleExec = DCC_FindRoleById ( DISCORD_ROLE_EXEC );
|
||||||
|
discordRoleDev = DCC_FindRoleById ( DISCORD_ROLE_DEV );
|
||||||
|
discordRoleCouncil = DCC_FindRoleById ( DISCORD_ROLE_COUNCIL );
|
||||||
discordRoleLead = DCC_FindRoleById ( DISCORD_ROLE_LEAD );
|
discordRoleLead = DCC_FindRoleById ( DISCORD_ROLE_LEAD );
|
||||||
|
discordRoleSenior = DCC_FindRoleById ( DISCORD_ROLE_SENIOR );
|
||||||
|
discordRoleGeneral = DCC_FindRoleById ( DISCORD_ROLE_GENERAL );
|
||||||
|
discordRoleTrial = DCC_FindRoleById ( DISCORD_ROLE_TRIAL );
|
||||||
|
discordRoleSupport = DCC_FindRoleById ( DISCORD_ROLE_SUPPORT );
|
||||||
discordRoleVIP = DCC_FindRoleById ( DISCORD_ROLE_VIP );
|
discordRoleVIP = DCC_FindRoleById ( DISCORD_ROLE_VIP );
|
||||||
discordRoleVoice = DCC_FindRoleById( DISCORD_ROLE_VOICE );
|
discordRoleMember = DCC_FindRoleById ( DISCORD_ROLE_MEMBER );
|
||||||
|
|
||||||
DCC_SendChannelMessage( discordGeneralChan, "**The discord plugin has been initiaized.**" );
|
DCC_SendChannelMessage( discordChatChan, "**Stephanie v1.0 is here.**" );
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ** Commands ** */
|
|
||||||
CMD:discordpm( playerid, params[ ] )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
msg[ 128 ];
|
|
||||||
|
|
||||||
if ( sscanf( params, "s[100]", msg ) ) SendUsage( playerid, "/discordpm [message]" );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Beep( playerid );
|
|
||||||
format( msg, sizeof( msg ), "__[Discord PM]__ **%s(%d):** %s", ReturnPlayerName( playerid ), playerid, msg );
|
|
||||||
DCC_SendChannelMessage( discordGeneralChan, msg );
|
|
||||||
SendServerMessage( playerid, "Your typed message has been sent to the Discord #sfcnr channel!" );
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ** Functions ** */
|
/* ** Functions ** */
|
||||||
hook DCC_OnChannelMessage( DCC_Channel: channel, DCC_User: author, const message[ ] )
|
stock ReturnDiscordName( DCC_User: author ) {
|
||||||
{
|
|
||||||
// ignore outside of #sfcnr and #admin
|
|
||||||
if ( channel != discordGeneralChan && channel != discordAdminChan )
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
// process commands
|
|
||||||
if ( message[ 0 ] == '!' )
|
|
||||||
{
|
|
||||||
new
|
|
||||||
functiona[ 32 ], posi = 0;
|
|
||||||
|
|
||||||
while ( message[ ++posi ] > ' ' ) {
|
|
||||||
functiona[ posi - 1 ] = tolower( message[ posi ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
format( functiona, sizeof( functiona ), "discord_%s", functiona );
|
|
||||||
|
|
||||||
while ( message[ posi ] == ' ' ) {
|
|
||||||
posi++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! message[ posi ] ) {
|
|
||||||
CallLocalFunction( functiona, "dds", _: channel, _: author, "\1" );
|
|
||||||
} else {
|
|
||||||
CallLocalFunction( functiona, "dds", _: channel, _: author, message[ posi ] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
stock ReturnDiscordName( DCC_User: user ) {
|
|
||||||
static
|
static
|
||||||
name[ 32 ];
|
name[ 32 ];
|
||||||
|
|
||||||
DCC_GetUserName( user, name, sizeof( name ) );
|
DCC_GetUserName( author, name, sizeof( name ) );
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock discordLevelToString( DCC_User: user )
|
stock discordLevelToString( DCC_User: author )
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
szRank[ 12 ], bool: hasExecutive, bool: hasHead, bool: hasLead, bool: hasVIP;
|
szRank[ 15 ],
|
||||||
|
bool: hasExec, bool: hasDev, bool: hasCouncil, bool: hasLead, bool: hasSenior,
|
||||||
|
bool: hasGeneral, bool: hasTrial, bool: hasSupport, bool: hasVIP, bool: hasMember;
|
||||||
|
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleExecutive, hasExecutive );
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleExec, hasExec );
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleHead, hasHead );
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleDev, hasDev );
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleLead, hasLead );
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleCouncil, hasCouncil );
|
||||||
DCC_HasGuildMemberRole( discordGuild, user, discordRoleVIP, hasVIP );
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleLead, hasLead );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSenior, hasSenior );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleGeneral, hasGeneral );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleTrial, hasTrial );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleSupport, hasSupport );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleVIP, hasVIP );
|
||||||
|
DCC_HasGuildMemberRole( discordGuild, author, discordRoleMember, hasMember );
|
||||||
|
|
||||||
if ( hasExecutive ) szRank = "Executive";
|
if ( hasExec ) szRank = "Executive";
|
||||||
else if ( hasHead ) szRank = "Head Admin";
|
else if ( hasDev ) szRank = "Developer";
|
||||||
|
else if ( hasCouncil ) szRank = "Council";
|
||||||
else if ( hasLead ) szRank = "Lead Admin";
|
else if ( hasLead ) szRank = "Lead Admin";
|
||||||
|
else if ( hasSenior ) szRank = "Senior Admin";
|
||||||
|
else if ( hasGeneral ) szRank = "General Admin";
|
||||||
|
else if ( hasTrial ) szRank = "Trial Admin";
|
||||||
|
else if ( hasSupport ) szRank = "Supporter";
|
||||||
else if ( hasVIP ) szRank = "VIP";
|
else if ( hasVIP ) szRank = "VIP";
|
||||||
else szRank = "Voice";
|
else if ( hasMember ) szRank = "Member";
|
||||||
|
|
||||||
return szRank;
|
return szRank;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock DCC_SendUserMessage( DCC_User: user, const message[ ] )
|
stock DCC_SendUserUsage( DCC_User: author, const message[ ] )
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
user_id[ 64 ];
|
user_id[ 64 ];
|
||||||
|
|
||||||
DCC_GetUserId( user, user_id, sizeof( user_id ) );
|
DCC_GetUserId( author, user_id, sizeof( user_id ) );
|
||||||
format( szBigString, sizeof( szBigString ), "<@%s> ... %s", user_id, message );
|
format( szBigString, sizeof( szBigString ), "<@%s> %s", user_id, message );
|
||||||
return DCC_SendChannelMessage( discordSpamChan, szBigString );
|
return DCC_SendChannelMessage( discordCmdsChan, szBigString );
|
||||||
|
}
|
||||||
|
|
||||||
|
public OnDiscordCommandPerformed(DCC_Channel: channel, DCC_User: author, bool: success)
|
||||||
|
{
|
||||||
|
if (!success) {
|
||||||
|
return DCC_SendChannelMessage(channel, "**[ERROR]** You have entered an invalid command. To display the command list type !commands.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DCC_OnGuildMemberAdd(DCC_Guild:guild, DCC_User:user)
|
||||||
|
{
|
||||||
|
DCC_SendUserUsage(user, "Hey there! I am **Stephanie**, i am here to help you out!\nUse **!commands** to see all commands i offer.\nYou need to have **member** role trough to use them, so first verify your account!");
|
||||||
|
return 1;
|
||||||
}
|
}
|
@ -457,8 +457,8 @@ public OnLookupComplete( playerid, success )
|
|||||||
SendClientMessage( i, COLOR_CONNECT, szNormalString );
|
SendClientMessage( i, COLOR_CONNECT, szNormalString );
|
||||||
}
|
}
|
||||||
|
|
||||||
format( szNormalString, sizeof( szNormalString ), "*%s*", szNormalString );
|
//format( szNormalString, sizeof( szNormalString ), "*%s*", szNormalString );
|
||||||
DCC_SendChannelMessage( discordGeneralChan, szNormalString );
|
//DCC_SendChannelMessage( discordGeneralChan, szNormalString );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -628,8 +628,8 @@ public OnPlayerDisconnect( playerid, reason )
|
|||||||
p_BlockedPM[ playerid ] [ i ] = false;
|
p_BlockedPM[ playerid ] [ i ] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
format( string, sizeof( string ), "*%s*", string );
|
//format( string, sizeof( string ), "*%s*", string );
|
||||||
DCC_SendChannelMessage( discordGeneralChan, string );
|
//DCC_SendChannelMessage( discordGeneralChan, string );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1243,7 +1243,7 @@ public OnPlayerDeath( playerid, killerid, reason )
|
|||||||
|
|
||||||
SendDeathMessage( killerid, playerid, reason );
|
SendDeathMessage( killerid, playerid, reason );
|
||||||
|
|
||||||
DCC_SendChannelMessageFormatted( discordGeneralChan, "*%s(%d) has killed %s(%d) - %s!*", ReturnPlayerName( killerid ), killerid, ReturnPlayerName( playerid ), playerid, ReturnWeaponName( reason ) );
|
//DCC_SendChannelMessageFormatted( discordGeneralChan, "*%s(%d) has killed %s(%d) - %s!*", ReturnPlayerName( killerid ), killerid, ReturnPlayerName( playerid ), playerid, ReturnWeaponName( reason ) );
|
||||||
|
|
||||||
if ( !IsPlayerAdminOnDuty( killerid ) )
|
if ( !IsPlayerAdminOnDuty( killerid ) )
|
||||||
{
|
{
|
||||||
@ -1388,7 +1388,7 @@ public OnPlayerDeath( playerid, killerid, reason )
|
|||||||
else if ( IsPlayerNPC( killerid ) ) SendDeathMessage( killerid, playerid, reason );
|
else if ( IsPlayerNPC( killerid ) ) SendDeathMessage( killerid, playerid, reason );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DCC_SendChannelMessageFormatted( discordGeneralChan, "*%s(%d) has committed suicide!*", ReturnPlayerName( playerid ), playerid );
|
//DCC_SendChannelMessageFormatted( discordGeneralChan, "*%s(%d) has committed suicide!*", ReturnPlayerName( playerid ), playerid );
|
||||||
SendDeathMessage( INVALID_PLAYER_ID, playerid, 53 );
|
SendDeathMessage( INVALID_PLAYER_ID, playerid, 53 );
|
||||||
DeletePVar( playerid, "used_cmd_kill" );
|
DeletePVar( playerid, "used_cmd_kill" );
|
||||||
}
|
}
|
||||||
@ -1574,7 +1574,7 @@ public OnPlayerText( playerid, text[ ] )
|
|||||||
{
|
{
|
||||||
if ( p_VIPLevel[ playerid ] > 0 )
|
if ( p_VIPLevel[ playerid ] > 0 )
|
||||||
{
|
{
|
||||||
DCC_SendChannelMessageFormatted( discordGeneralChan, "__**(VIP) %s(%d):**__ %s", ReturnPlayerName( playerid ), playerid, text[ 1 ] );
|
DCC_SendChannelMessageFormatted( discordChatChan, "**[%s] (VIP) %s(%d):** %s", getCurrentTime(), ReturnPlayerName( playerid ), playerid, text[ 1 ] );
|
||||||
SendClientMessageToAllFormatted( 0x3eff3eff, "[VIP] %s(%d):{9ec34f} %s", ReturnPlayerName( playerid ), playerid, text[ 1 ] );
|
SendClientMessageToAllFormatted( 0x3eff3eff, "[VIP] %s(%d):{9ec34f} %s", ReturnPlayerName( playerid ), playerid, text[ 1 ] );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1591,7 +1591,7 @@ public OnPlayerText( playerid, text[ ] )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DCC_SendChannelMessageFormatted( discordGeneralChan, "**%s(%d):** %s", ReturnPlayerName( playerid ), playerid, text ); // p_Class[ playerid ] == CLASS_POLICE ? 12 : 4
|
DCC_SendChannelMessageFormatted( discordChatChan, "**[%s] %s(%d):** %s", getCurrentTime(), ReturnPlayerName( playerid ), playerid, text ); // p_Class[ playerid ] == CLASS_POLICE ? 12 : 4
|
||||||
|
|
||||||
// custom player id setting
|
// custom player id setting
|
||||||
foreach ( new iPlayer : Player ) {
|
foreach ( new iPlayer : Player ) {
|
||||||
@ -2207,7 +2207,7 @@ CMD:vsay( playerid, params[ ] )
|
|||||||
return SendError( playerid, "You cannot speak as you are muted for %s.", secondstotime( p_MutedTime[ playerid ] - time ) );
|
return SendError( playerid, "You cannot speak as you are muted for %s.", secondstotime( p_MutedTime[ playerid ] - time ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
DCC_SendChannelMessageFormatted( discordGeneralChan, "__**(VIP) %s(%d):**__ %s", ReturnPlayerName( playerid ), playerid, msg );
|
DCC_SendChannelMessageFormatted( discordChatChan, "**[%s] (VIP) %s(%d):** %s", getCurrentTime(), ReturnPlayerName( playerid ), playerid, msg );
|
||||||
SendClientMessageToAllFormatted( 0x3eff3eff, "[VIP] %s(%d):{9ec34f} %s", ReturnPlayerName( playerid ), playerid, msg );
|
SendClientMessageToAllFormatted( 0x3eff3eff, "[VIP] %s(%d):{9ec34f} %s", ReturnPlayerName( playerid ), playerid, msg );
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -2486,6 +2486,7 @@ CMD:ask( playerid, params[ ] )
|
|||||||
Beep( playerid );
|
Beep( playerid );
|
||||||
SendClientMessageToAdmins( -1, "{FE5700}[QUESTION] %s(%d):{FFFFFF} %s", ReturnPlayerName( playerid ), playerid, szMessage );
|
SendClientMessageToAdmins( -1, "{FE5700}[QUESTION] %s(%d):{FFFFFF} %s", ReturnPlayerName( playerid ), playerid, szMessage );
|
||||||
SendClientMessageFormatted( playerid, -1, "{FE5700}[QUESTION]"COL_WHITE" You've asked \"%s\".", szMessage );
|
SendClientMessageFormatted( playerid, -1, "{FE5700}[QUESTION]"COL_WHITE" You've asked \"%s\".", szMessage );
|
||||||
|
DCC_SendChannelMessageFormatted( discordAskChan, "**[QUESTION]** __**%s(%d)**__: %s", ReturnPlayerName( playerid ), playerid, szMessage );
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2601,10 +2602,6 @@ thread OnPlayerLastLogged( playerid, irc, player[ ] )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !irc ) SendClientMessageFormatted( playerid, COLOR_GREY, "[SERVER]"COL_RED" %s:"COL_WHITE" Last Logged: %s", player, Field );
|
if ( !irc ) SendClientMessageFormatted( playerid, COLOR_GREY, "[SERVER]"COL_RED" %s:"COL_WHITE" Last Logged: %s", player, Field );
|
||||||
else {
|
|
||||||
format( szNormalString, sizeof( szNormalString ),"7LAST LOGGED OF '%s': %s", player, Field );
|
|
||||||
DCC_SendChannelMessage( discordGeneralChan, szNormalString );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( !irc ) SendError( playerid, "Player not found." );
|
if ( !irc ) SendError( playerid, "Player not found." );
|
||||||
@ -2640,11 +2637,6 @@ thread OnPlayerWeeklyTime( playerid, irc, player[ ] )
|
|||||||
iLastUptime = cache_get_field_content_int( 0, "WEEKEND_UPTIME", dbHandle );
|
iLastUptime = cache_get_field_content_int( 0, "WEEKEND_UPTIME", dbHandle );
|
||||||
|
|
||||||
if ( !irc ) SendClientMessageFormatted( playerid, COLOR_GREY, "[SERVER]"COL_GREY" %s:"COL_WHITE" %s", player, secondstotime( iCurrentUptime - iLastUptime ) );
|
if ( !irc ) SendClientMessageFormatted( playerid, COLOR_GREY, "[SERVER]"COL_GREY" %s:"COL_WHITE" %s", player, secondstotime( iCurrentUptime - iLastUptime ) );
|
||||||
else
|
|
||||||
{
|
|
||||||
format( szNormalString, sizeof( szNormalString ),"7WEEKLY TIME OF '%s': %s", player, secondstotime( iCurrentUptime - iLastUptime ) );
|
|
||||||
DCC_SendChannelMessage( discordGeneralChan, szNormalString );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3342,7 +3334,7 @@ CMD:me( playerid, params[ ] )
|
|||||||
else if ( sscanf( params, "s[70]", action ) ) return SendUsage( playerid, "/me [ACTION]" );
|
else if ( sscanf( params, "s[70]", action ) ) return SendUsage( playerid, "/me [ACTION]" );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DCC_SendChannelMessageFormatted( discordGeneralChan, "** * * * %s(%d) %s **", ReturnPlayerName( playerid ), playerid, action );
|
//DCC_SendChannelMessageFormatted( discordGeneralChan, "** * * * %s(%d) %s **", ReturnPlayerName( playerid ), playerid, action );
|
||||||
SendClientMessageToAllFormatted( GetPlayerColor( playerid ), "*** %s(%d) %s", ReturnPlayerName( playerid ), playerid, action );
|
SendClientMessageToAllFormatted( GetPlayerColor( playerid ), "*** %s(%d) %s", ReturnPlayerName( playerid ), playerid, action );
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -5794,7 +5786,7 @@ stock SendGlobalMessage( colour, const format[ ], va_args<> )
|
|||||||
strreplace( out, #COL_PINK, "**" );
|
strreplace( out, #COL_PINK, "**" );
|
||||||
strreplace( out, #COL_GREY, "**" );
|
strreplace( out, #COL_GREY, "**" );
|
||||||
strreplace( out, #COL_WHITE, "**" );
|
strreplace( out, #COL_WHITE, "**" );
|
||||||
DCC_SendChannelMessage( discordGeneralChan, out );
|
//DCC_SendChannelMessage( discordGeneralChan, out );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6210,7 +6202,7 @@ stock AddAdminLogLine( szMessage[ sizeof( log__Text[ ] ) ] )
|
|||||||
memcpy( log__Text[ iPos ], log__Text[ iPos + 1 ], 0, sizeof( log__Text[ ] ) * 4 );
|
memcpy( log__Text[ iPos ], log__Text[ iPos + 1 ], 0, sizeof( log__Text[ ] ) * 4 );
|
||||||
|
|
||||||
strcpy( log__Text[ 4 ], szMessage );
|
strcpy( log__Text[ 4 ], szMessage );
|
||||||
DCC_SendChannelMessage( discordAdminChan, szMessage );
|
DCC_SendChannelMessageFormatted( discordLogChan, "**[SERVER LOG]** %s" ,szMessage );
|
||||||
|
|
||||||
format( szLargeString, 500, "%s~n~%s~n~%s~n~%s~n~%s", log__Text[ 0 ], log__Text[ 1 ], log__Text[ 2 ], log__Text[ 3 ], log__Text[ 4 ] );
|
format( szLargeString, 500, "%s~n~%s~n~%s~n~%s~n~%s", log__Text[ 0 ], log__Text[ 1 ], log__Text[ 2 ], log__Text[ 3 ], log__Text[ 4 ] );
|
||||||
return TextDrawSetString( g_AdminLogTD, szLargeString );
|
return TextDrawSetString( g_AdminLogTD, szLargeString );
|
||||||
|
Loading…
Reference in New Issue
Block a user