PDA

View Full Version : rdm report


BraveFox
07-25-2016, 02:10
Hey,
I need a plugin for my ttt server that if on client get killed he can do /rdm to report his killer but if his killer was a traitor he will be not allowed to report and he will get a message like this "You can't report traitor for rdm" or something like this.
thx

BraveFox
07-26-2016, 03:29
help please

good_live
07-26-2016, 04:08
What do you mean with report?
You could easily modify calladmin to do this job.

BraveFox
07-26-2016, 04:18
what do you mean with report?
You could easily modify calladmin to do this job.

no!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!
I want when player will do /rdm if his killer wasn't a t it will send the admins a message like /fk!!

shanapu
07-26-2016, 07:47
no!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!
I want when player will do /rdm if his killer wasn't a t it will send the admins a message like /fk!!

for sure
You could easily modify calladmin/playerreport/"!fk"/"!rdm" to do this job.

A good start yould be to tell us which report plugin you use/wanna use.

Please don't bump you threads after one day and dont use more than one "!" in a line...

good_live
07-26-2016, 08:56
This is how i would do it:

#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "good_live"
#define PLUGIN_VERSION "1.00"

#include <sourcemod>
#include <sdktools>
#include <ttt>
#include <multicolors>

#pragma newdecls required

public Plugin myinfo =
{
name = "TTT - Report RDM",
author = PLUGIN_AUTHOR,
description = "Allows a client to report a RDM to an admin.",
version = PLUGIN_VERSION,
url = "painlessgaming.eu"
};

bool g_bAllowReport[MAXPLAYERS + 1] = {false, ...};
int g_iAttacker[MAXPLAYERS + 1];
char g_sTeam[MAXPLAYERS + 1][16];
char g_sAttackerTeam[MAXPLAYERS + 1][16];

public void OnPluginStart()
{
RegConsoleCmd("sm_rdm", CMD_RDM, "Use this to report a RDM");
HookEvent("player_death", Event_PlayerDeath);
LoadTranslations("ttt_report_rdm.phrases");
}

public Action CMD_RDM(int client, int args)
{
if(!TTT_IsClientValid(client))
return Plugin_Handled;

if(!g_bAllowReport[client])
{
CPrintToChat(client, "%T", "Not allowed to report", client);
return Plugin_Handled;
}
int iAttacker = GetClientOfUserId(g_iAttacker[client]);
if(!TTT_IsClientValid(iAttacker))
{
CPrintToChat(client, "%T", "Attacker is not valid", client);
return Plugin_Handled;
}

for (int i = 1; i <= MaxClients; i++)
if(TTT_IsClientValid(i) && CheckCommandAccess(i, "ttt_rdm_admin", ADMFLAG_GENERIC, true))
CPrintToChat(i, "%T", "Report", i, client, g_sTeam[client], iAttacker, g_sAttackerTeam[client]);

g_bAllowReport[client] = false;

return Plugin_Handled;
}

public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
int iAttacker = GetClientOfUserId(event.GetInt("attacker"));
if(TTT_GetClientRole(iAttacker) != TTT_TEAM_TRAITOR)
{
g_bAllowReport[client] = true;
g_iAttacker[client] = event.GetInt("attacker");
GetClientTeam_TTT(g_sTeam[client], 16, client);
GetClientTeam_TTT(g_sAttackerTeam[client], 16, iAttacker);
}
return Plugin_Continue;
}

public Action Event_PlayerSpawnPre(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
g_bAllowReport[client] = false;
}

stock bool GetClientTeam_TTT(char[] sClientTeam, int length, int client)
{
if(!TTT_IsClientValid(client))
return false;

switch(TTT_GetClientRole(client))
{
case TTT_TEAM_INNOCENT:
{
Format(sClientTeam, length, "Innocent");
}
case TTT_TEAM_DETECTIVE:
{
Format(sClientTeam, length, "Detective");
}
case TTT_TEAM_TRAITOR:
{
Format(sClientTeam, length, "Traitor");
}
default:
{
return false;
}
}
return true;
}
(Completely untested + needs a translation)

However u should provide more information on how it should work.

BraveFox
07-29-2016, 16:20
This is how i would do it:

#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "good_live"
#define PLUGIN_VERSION "1.00"

#include <sourcemod>
#include <sdktools>
#include <ttt>
#include <multicolors>

#pragma newdecls required

public Plugin myinfo =
{
name = "TTT - Report RDM",
author = PLUGIN_AUTHOR,
description = "Allows a client to report a RDM to an admin.",
version = PLUGIN_VERSION,
url = "painlessgaming.eu"
};

bool g_bAllowReport[MAXPLAYERS + 1] = {false, ...};
int g_iAttacker[MAXPLAYERS + 1];
char g_sTeam[MAXPLAYERS + 1][16];
char g_sAttackerTeam[MAXPLAYERS + 1][16];

public void OnPluginStart()
{
RegConsoleCmd("sm_rdm", CMD_RDM, "Use this to report a RDM");
HookEvent("player_death", Event_PlayerDeath);
LoadTranslations("ttt_report_rdm.phrases");
}

public Action CMD_RDM(int client, int args)
{
if(!TTT_IsClientValid(client))
return Plugin_Handled;

if(!g_bAllowReport[client])
{
CPrintToChat(client, "%T", "Not allowed to report", client);
return Plugin_Handled;
}
int iAttacker = GetClientOfUserId(g_iAttacker[client]);
if(!TTT_IsClientValid(iAttacker))
{
CPrintToChat(client, "%T", "Attacker is not valid", client);
return Plugin_Handled;
}

for (int i = 1; i <= MaxClients; i++)
if(TTT_IsClientValid(i) && CheckCommandAccess(i, "ttt_rdm_admin", ADMFLAG_GENERIC, true))
CPrintToChat(i, "%T", "Report", i, client, g_sTeam[client], iAttacker, g_sAttackerTeam[client]);

g_bAllowReport[client] = false;

return Plugin_Handled;
}

public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
int iAttacker = GetClientOfUserId(event.GetInt("attacker"));
if(TTT_GetClientRole(iAttacker) != TTT_TEAM_TRAITOR)
{
g_bAllowReport[client] = true;
g_iAttacker[client] = event.GetInt("attacker");
GetClientTeam_TTT(g_sTeam[client], 16, client);
GetClientTeam_TTT(g_sAttackerTeam[client], 16, iAttacker);
}
return Plugin_Continue;
}

public Action Event_PlayerSpawnPre(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
g_bAllowReport[client] = false;
}

stock bool GetClientTeam_TTT(char[] sClientTeam, int length, int client)
{
if(!TTT_IsClientValid(client))
return false;

switch(TTT_GetClientRole(client))
{
case TTT_TEAM_INNOCENT:
{
Format(sClientTeam, length, "Innocent");
}
case TTT_TEAM_DETECTIVE:
{
Format(sClientTeam, length, "Detective");
}
case TTT_TEAM_TRAITOR:
{
Format(sClientTeam, length, "Traitor");
}
default:
{
return false;
}
}
return true;
}
(Completely untested + needs a translation)

However u should provide more information on how it should work.

ty bro!!!!