18/07/2022, 10:07 PM
Buenas, tengo este plugin en mi comunidad LvS, pero me da este error al compilar:
Error: Undefined symbol "PugGetRoundWinTeam" on line 208
Error: Undefined symbol "PugGetRoundWinTeam" on line 209
Les dejo el code, agradecería la ayuda de antemano!:
Error: Undefined symbol "PugGetRoundWinTeam" on line 208
Error: Undefined symbol "PugGetRoundWinTeam" on line 209
Les dejo el code, agradecería la ayuda de antemano!:
Código PHP:
#include <amxmodx>
#include <csx>
#include <pug>
#include <hamsandwich>
#include <fakemeta>
#include <sqlx>
#include <steamdata>
#define SQLX_DATABASE "pug_mod"
#define SQLX_TABLA "statspug"
#define COLUMN_AUTHID "authid"
#define COLUMN_NAME "name"
#define COLUMN_KILLS "Kills"
#define COLUMN_DEATHS "deaths"
#define COLUMN_HEADSHOTS "headshots"
#define COLUMN_BOMBPLANTEDS "bombplanteds"
#define COLUMN_BOMBDEFUSED "bombdefuseds"
#define COLUMN_DAMAGES "damages"
#define COLUMN_ROUNDS "rounds"
#define COLUMN_PUGS "pugs"
#define TOP_STYLE "<style>@import url(^"http://cs-lgesport.tk/css/style_cs/csstats_style.css^");</style>"
enum _:DATA_PLAYERS {
Kills,
Deaths,
HeadShots,
BombPlanteds,
BombDefuseds,
Float:Damages,
Rounds,
Pugs
}
enum _:ADV_DATA {
iniciar = 0,
Cargar,
Guardar
};
new g_szTag[]="^4[TAG]^1";
new g_szPlayerName[MAX_PLAYERS+1][32];
new g_szPlayerAuthdID[MAX_PLAYERS+1][64];
new g_PlayerData[MAX_PLAYERS+1][DATA_PLAYERS];
new g_iMaxPlayers;
new Float:g_flHealth;
new Handle:g_query;
new Handle:g_tuple;
public plugin_init() {
register_plugin("AMXX - Stats Pug", "v1.3", "Alejandro-.");
register_clcmd("say", "hooksay");
RegisterHamPlayer(Ham_TakeDamage, "OnPlayerTakeDamage_Pre", .Post = false);
RegisterHamPlayer(Ham_TakeDamage, "OnPlayerTakeDamage_Post", .Post = true);
register_event("DeathMsg", "DeathMsg", "a");
register_pug_event(ROUND_START, "EventPugRoundStart");
register_pug_event(PUG_END, "EventPugEnd");
register_pug_event(PUG_START, "EventPugStart");
g_iMaxPlayers = get_maxplayers();
SQLXInit();
}
public hooksay(index) {
static said[192];
read_args(said, charsmax(said));
remove_quotes(said);
if (equal(said, ".top")) {
CmdTop(index);
return PLUGIN_HANDLED;
}
else if (equal(said, ".stats")) {
DisplayMenuStats(index);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public DisplayMenuStats(index) {
if (!is_user_connected(index))
return ;
new menu = menu_create(fmt("[LvS]\w Lista de Jugadores"), "h_listplayers");
menu_additem(menu, "\yVer mis estadisticas^n", fmt("%d", index));
for(new i = 1; i <=g_iMaxPlayers; i++) {
if (is_user_bot(i))
continue;
if (is_user_hltv(i))
continue;
if (is_user_connected(i) && index != i) {
new szName[32];
get_user_name(i, szName, charsmax(szName));
menu_additem(menu, szName, fmt("%d", i));
}
}
menu_setprop(menu, MPROP_NEXTNAME, "Siguiente");
menu_setprop(menu, MPROP_BACKNAME, "Anterior");
menu_setprop(menu, MPROP_EXITNAME, "Salit");
menu_display(index, menu);
}
public h_listplayers(index, menu, item) {
if (item == MENU_EXIT) {
menu_destroy(menu);
return PLUGIN_HANDLED;
}
if (item != 0) {
new szInfo[5];
menu_item_getinfo(menu, item, _, szInfo, charsmax(szInfo), _);
new target = str_to_num(szInfo);
if (!is_user_connected(target)) {
client_print_color(0, print_team_default, "%s El jugador no esta conectado", g_szTag);
return PLUGIN_HANDLED;
}
client_print_color(0, print_team_default, "%s ^3%n^1 esta viendo las estadisticas de ^3%n", g_szTag, index, target);
DisplayPlayerStats(index, target);
} else {
DisplayPlayerStats(index, index);
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
public client_putinserver(index) {
if (!is_user_connected(index))
return;
for(new i = 0; i <sizeof(g_PlayerData[]); i++) {
g_PlayerData[index][i] = EOS;
}
get_user_authid(index, g_szPlayerAuthdID[index], charsmax(g_szPlayerAuthdID[]));
get_user_name(index, g_szPlayerName[index], charsmax(g_szPlayerName[]))
PlayerRegister(index);
}
public OnPlayerTakeDamage_Pre( v, i, a, Float:flDamage, iDamageBits ) {
if (pug_get_state() != ALIVE)
return;
pev(v, pev_health, g_flHealth);
}
public OnPlayerTakeDamage_Post( v, i, a, Float:flDamage, iDamageBits ) {
if (pug_get_state() != ALIVE)
return;
new Float:flDmgTake;
pev(v, pev_dmg_take, flDmgTake);
new Float:flRealDamage = floatmin(flDmgTake, g_flHealth);
g_PlayerData[a][Damages] += flRealDamage;
}
public DeathMsg() {
new Attack = read_data(1);
new Victim = read_data(2);
new Headshot = read_data(3);
if (!is_user_connected(Attack) || !is_user_connected(Victim))
return;
if (Attack == Victim) {
g_PlayerData[Attack][Kills]--;
g_PlayerData[Attack][Deaths]++;
return;
}
if (Headshot) {
g_PlayerData[Attack][HeadShots]++;
}
g_PlayerData[Attack][Kills]++;
g_PlayerData[Victim][Deaths]++;
}
public bomb_planted(index) {
if (!is_user_connected(index))
return;
g_PlayerData[index][BombPlanteds]++;
}
public bomb_defused(index) {
if (!is_user_connected(index))
return;
g_PlayerData[index][BombDefuseds]++;
}
/************************* EVENTOS DEL PUG *************************/
public EventPugRoundStart() {
if (pug_get_state() != ALIVE)
return;
for(new index = 1; index <=g_iMaxPlayers; index++) {
if (is_user_connected(index) && (1<=get_user_team(index)<=2)) {
g_PlayerData[index][Rounds]++;
}
}
}
public EventPugStart() {
for(new index = 1; index <=g_iMaxPlayers; index++) {
for(new i = 0; i <sizeof(g_PlayerData[]); i++) {
if (is_user_connected(index) && (1<=get_user_team(index)<=2)) {
g_PlayerData[index][i] = EOS;
}
}
}
}
public EventPugEnd(WinState) {
new szMotd[2000], szMapName[64], iLen, iPosition;
new iRoundsCT = PugGetRoundWinTeam(CS_TEAM_CT);
new iRoundsTT = PugGetRoundWinTeam(CS_TEAM_T);
switch (WinState) {
case 1: {
iRoundsTT++;
}
case 2: {
iRoundsCT++;
}
}
get_mapname(szMapName, charsmax(szMapName));
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen,
"<body>%s\
<h4>Estadisticas | %s</h>\
<h3 class=ct>Counter-Terroristas: <span>%i</span></h3><table>\
<tr>\
<th width=5%%>#\
<th width=30%%>Nombre\
<th width=10%%>K\
<th width=10%%>HS\
<th width=10%%>D", TOP_STYLE, szMapName, iRoundsCT);
new szAuthID[64];
new players[32], iPlayers;
get_players(players, iPlayers, "e", "CT");
for(new index = 0; index <iPlayers; index++) {
get_user_authid(index, szAuthID, charsmax(szAuthID));
replace_all(szAuthID, charsmax(szAuthID), ":", "_");
iPosition++;
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<tr align=center>" );
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", iPosition );
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%n", players[index]);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", g_PlayerData[players[index]][Kills]);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", g_PlayerData[players[index]][HeadShots]);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", g_PlayerData[players[index]][Deaths]);
}
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen,
"</table><h3 class=tt>Terroristas: <span>%i</span></h3><table>\
<tr class=rtt>\
<th width=5%%>#\
<th width=30%%>Nombre\
<th width=10%%>K\
<th width=10%%>HS\
<th width=10%%>D", iRoundsTT);
iPosition = 0;
get_players(players, iPlayers, "e", "TERRORIST");
for(new index = 0; index <iPlayers; index++) {
get_user_authid(index, szAuthID, charsmax(szAuthID));
replace_all(szAuthID, charsmax(szAuthID), ":", "_");
iPosition++;
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<tr align=center>" );
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", iPosition );
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%n", players[index]);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", g_PlayerData[players[index]][Kills]);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", g_PlayerData[players[index]][HeadShots]);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", g_PlayerData[players[index]][Deaths]);
}
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "</table></body>" );
for(new index = 1; index <=g_iMaxPlayers; index++) {
if (is_user_connected(index) && (1<=get_user_team(index)<=2)) {
g_PlayerData[index][Pugs]++;
SaveGlobalPlayerData(index);
show_motd(index, szMotd, "Mod PUG v1.1 | Estadisticas de mapa");
}
}
}
/********************* SQLX GUARD ***********************************/
public SQLXInit()
{
new get_type[12]
SQL_SetAffinity("sqlite")
SQL_GetAffinity(get_type, sizeof(get_type))
if (!equali(get_type, "sqlite"))
{
log_to_file("SQLX.log", "Driver no encontrado")
pause("a")
}
else
{
static error, szError[300]
g_query = SQL_MakeDbTuple("", "", "", SQLX_DATABASE)
g_tuple = SQL_Connect(g_query, error, szError, 300)
if (strlen(szError))
{
log_to_file("ErrorSQL.log", szError)
pause("a")
}
CheckTabla();
}
}
public CheckTabla() {
new szTemp[768]
formatex(szTemp, charsmax(szTemp), "\
CREATE TABLE IF NOT EXISTS %s (`%s` varchar(33) NOT NULL default '' PRIMARY KEY, `%s` varchar(33),`%s` int,`%s` int,`%s` int,`%s` int,`%s` int,`%s` float, `%s` int, `%s` int)",
SQLX_TABLA, COLUMN_AUTHID, COLUMN_NAME, COLUMN_KILLS, COLUMN_DEATHS, COLUMN_HEADSHOTS, COLUMN_BOMBPLANTEDS, COLUMN_BOMBDEFUSED, COLUMN_DAMAGES, COLUMN_ROUNDS, COLUMN_PUGS)
g_query = SQL_PrepareQuery(g_tuple, szTemp)
if (SQL_Execute(g_query)) {
server_print("Se realizo el registro")
}
else server_print("Error en el registro")
}
public PlayerRegister(index) {
if(!is_user_connected(index) || is_user_bot(index) || is_user_hltv(index))
return;
new szTemp[2048];
formatex(szTemp, charsmax(szTemp), "INSERT INTO %s (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) VALUES ('%s','%s','0','0','0','0','0','0.0','0','0')",
SQLX_TABLA,
COLUMN_AUTHID,
COLUMN_NAME,
COLUMN_KILLS,
COLUMN_DEATHS,
COLUMN_HEADSHOTS,
COLUMN_BOMBPLANTEDS,
COLUMN_BOMBDEFUSED,
COLUMN_DAMAGES,
COLUMN_ROUNDS,
COLUMN_PUGS,
g_szPlayerAuthdID[index],
g_szPlayerName[index]);
g_query = SQL_PrepareQuery(g_tuple, szTemp);
if (SQL_Execute(g_query)){
console_print(index, "No se encontro resultados, creando nuevos datos...");
} else console_print(index, "Error al registrar");
}
public SaveGlobalPlayerData(index) {
if(!is_user_connected(index) || is_user_bot(index) || is_user_hltv(index))
return;
new szTemp[256];
formatex(szTemp, charsmax(szTemp), "SELECT * FROM %s WHERE ^"%s^" = ^"%s^"", SQLX_TABLA, COLUMN_AUTHID, g_szPlayerAuthdID[index]);
g_query = SQL_PrepareQuery(g_tuple,szTemp);
if (SQL_Execute(g_query)) {
new iKills = SQL_ReadResult(g_query, 2);
new iDeaths = SQL_ReadResult(g_query, 3);
new iHeadShots = SQL_ReadResult(g_query, 4);
new iBombPlanteds = SQL_ReadResult(g_query, 5);
new iBombDefused = SQL_ReadResult(g_query, 6);
new Float:flDamage;
SQL_ReadResult(g_query, 7, flDamage);
new iRounds = SQL_ReadResult(g_query, 8);
new iPugs = SQL_ReadResult(g_query, 9);
formatex(szTemp, charsmax(szTemp), "UPDATE %s SET `%s`=^"%s^",`%s`=^"%i^",`%s`=^"%i^",`%s`=^"%i^",`%s`=^"%i^",`%s`=^"%i^",`%s`=^"%0.02f^",`%s`=^"%i^", `%s`=^"%i^" WHERE %s = ^"%s^"",
SQLX_TABLA,
COLUMN_NAME,
g_szPlayerName[index],
COLUMN_KILLS,
iKills + g_PlayerData[index][Kills],
COLUMN_DEATHS,
iDeaths + g_PlayerData[index][Deaths],
COLUMN_HEADSHOTS,
iHeadShots + g_PlayerData[index][HeadShots],
COLUMN_BOMBPLANTEDS,
iBombPlanteds + g_PlayerData[index][BombPlanteds],
COLUMN_BOMBDEFUSED,
iBombDefused + g_PlayerData[index][BombDefuseds],
COLUMN_DAMAGES,
flDamage + g_PlayerData[index][Damages],
COLUMN_ROUNDS,
iRounds + g_PlayerData[index][Rounds],
COLUMN_PUGS,
iPugs + g_PlayerData[index][Pugs],
COLUMN_AUTHID,
g_szPlayerAuthdID[index]);
g_query = SQL_PrepareQuery(g_tuple, szTemp);
if(SQL_Execute(g_query)) console_print(index, "Datos Actualizados");
else console_print(index, "Error Actualizar datos");
}
}
public CmdTop(index) {
new szTemp[256];
formatex(szTemp, charsmax(szTemp), "SELECT * FROM %s ORDER BY `%s`-`%s` DESC LIMIT 10", SQLX_TABLA, COLUMN_KILLS, COLUMN_DEATHS);
g_query = SQL_PrepareQuery(g_tuple, szTemp);
if (SQL_Execute(g_query)) {
if(SQL_NumResults(g_query)) {
new szMotd[1800], iLen, iPosition;
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen,
"<body>%s\
<h4>GOT Pug | Top 10</h4>\
<table>\
<tr>\
<th width=5%%>#\
<th width=30%%>Nombre\
<th width=10%%>K\
<th width=10%%>HS\
<th width=10%%>D\
<th width=20%%>DMG\
<th width=20%%>ADR", TOP_STYLE);
while(SQL_MoreResults(g_query)) {
new szName[32], szAuthID[64];
SQL_ReadResult(g_query, 0, szAuthID, charsmax(szAuthID));
SQL_ReadResult(g_query, 1, szName, charsmax(szName));
new iKills = SQL_ReadResult(g_query, 2);
new iDeaths = SQL_ReadResult(g_query, 3);
new iHeadShots = SQL_ReadResult(g_query, 4);
new Float:flDamage;
SQL_ReadResult(g_query, 7, flDamage);
new iRounds = SQL_ReadResult(g_query, 8);
replace_all(szAuthID, charsmax(szAuthID), ":", "_");
iPosition++;
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<tr align=center>" );
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", iPosition );
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%s", szName);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", iKills);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", iHeadShots);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%i", iDeaths);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%0.02f", flDamage);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "<td>%0.02f", flDamage / float(iRounds));
SQL_NextRow(g_query);
}
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "</table></body>" );
show_motd(index, szMotd, "Mod PUG v1.1 | TOP 10");
}
}
}
public DisplayPlayerStats(index, target) {
if (!is_user_connected(index))
return;
if (!is_user_connected(target)) {
client_print_color(index, print_team_default, "%s El usuario no esta conectado", g_szTag);
return;
}
new szTemp[256]
formatex(szTemp, charsmax(szTemp), "SELECT * FROM %s WHERE ^"%s^" = ^"%s^"", SQLX_TABLA, COLUMN_AUTHID, g_szPlayerAuthdID[target]);
g_query = SQL_PrepareQuery(g_tuple,szTemp);
if (SQL_Execute(g_query)) {
new iKills = SQL_ReadResult(g_query, 2);
new iDeaths = SQL_ReadResult(g_query, 3);
new iHeadShots = SQL_ReadResult(g_query, 4);
new iBombPlanteds = SQL_ReadResult(g_query, 5);
new iBombDefused = SQL_ReadResult(g_query, 6);
new Float:flDamage;
SQL_ReadResult(g_query, 7, flDamage);
new iRounds = SQL_ReadResult(g_query, 8);
new iPlayingPugs = SQL_ReadResult(g_query, 9);
new szAvatar[130];
get_steamdata(target, szAvatar, charsmax(szAvatar), STD_AVATAR_FULL)
new szMotd[1836], iLen = 0;
iLen += formatex(szMotd[iLen], sizeof szMotd - iLen, "<body>%s", TOP_STYLE);
iLen += formatex(szMotd[iLen], sizeof szMotd - iLen, "<div class=top><h1>PERFIL</h1></br><img src=%s class=av2><h4>%n</h4>", szAvatar, target);
iLen += formatex(szMotd[iLen], sizeof szMotd - iLen, "</div><div class=bottom>\
<h1>ESTADISTICAS</h1>\
</br>\
<table width=100%%>\
<tr align=center>\
<th width=33%%>Kills\
<th width=33%%>HeadShots\
<th width=33%%>Deaths");
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "\
<tr align=center>\
<td>%i\
<td>%i\
<td>%i", iKills, iHeadShots, iDeaths);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "</table><table width=100%%>\
<tr align=center>\
<th width=25%%>BP\
<th width=25%%>BD\
<th width=20%%>Damage\
<th width=30%%>ADR");
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "\
<tr align=center>\
<td>%i\
<td>%i\
<td>%0.02f\
<td>%0.02f", iBombPlanteds, iBombDefused, flDamage, flDamage / float(iRounds));
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "</table><table width=100%%>\
<tr align=center>\
<th width=25%%>Pugs Jugados:" );
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "\
<tr align=center>\
<td>%i</table>", iPlayingPugs);
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "</div></br>" );
iLen += formatex( szMotd[ iLen ], sizeof szMotd - iLen, "</body>" );
show_motd( index, szMotd, fmt( "AMXX-STATS | %n", target));
}
}