Ayuda: Problema con un plugins tira error [No Solucionado]
#1
Buenas alguien me podría ayudar a solucionar este error de log que me tira el plugins de rango estoy usando versión de AmxModx 1.9:5241 y el compile igual

ERROR DE LOG
Código:
L 07/23/2019 - 22:12:41: Start of error session.
L 07/23/2019 - 22:12:41: Info (map "de_c4") (file "addons/amxmodx/logs/error_20190723.log")
L 07/23/2019 - 22:12:41: Invalid player id 0
L 07/23/2019 - 22:12:41: [AMXX] Displaying debug trace (plugin "PGS_Rango.amxx", version "1.1")
L 07/23/2019 - 22:12:41: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 07/23/2019 - 22:12:41: [AMXX]    [0] PGS_Rango.sma::Event_DeathMsg (line 216)

SMA
Código PHP:
/* ===============================
Version Con Guardado adv_vault
================================*/

/* ====================================
|=* [INCLUDES] *=|
=====================================*/ 
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <adv_vault>
#include <jctf>

/* ====================================
|=* [PLUGIN / VERSION / AUTHOR] *=|
=====================================*/ 
new const PLUGIN[] = "RangoS"
new const VERSION[] = "1.1"
new const AUTHOR[] = "kikizon"

/* =============================================
|=* [EMPIEZA SECCION MODIFICABLE] *=|
==============================================*/

/* ====================================
|=* [CONSTANTES] *=|
=====================================*/ 
new const Prefijo[] = "PGS"          // Prefijo en say
new const Sonido[] = "PGS_Rango/up.wav"   // Sonido Rango UP

/* ====================================
|=* [CONST NOMBRES DE RANGOS] *=|
=====================================*/
enum _:DATA {

   
NOMBRE[32],
   
FRAGS,
   
ADRENALINA
}

new const 
Rangos[][DATA] = {
    
"0.Novato"50 },
"1.Silver I"200 },
"2.Silver II"500 },
"3.Silver III"900 },
"4.Silver IV"1400 },
"5.Silver Elite"2000 },
"6.Silver Elite Master"2700 },
"7.Gold Nova I"3500 },
"8.Gold Nova II"4500 },
"9.Gold Nova III"6000 },
"10.Gold Nova Master"9000 },
"11.Master Guardian I",13000 },
"12.Master Guardian II"18000 },
"13.Master Guardian Elite"24000 },
"14.Master Guardian Pro"30000 },
"15.Legendary Eagle"35000 },
"16.Legendary Eagle Master"40000 },
"17.Supreme Master"45000 },
"18.The Global Elite"50000 },
"19.PGS Premium"99999 },
"20.Nivel Maximo"9999999999 }
}

/* ====================================
|=* [VARIABLES] *=|
=====================================*/
new g_rango[33], g_frags[33], g_playername[33][32], Data[255], Left[25], Right[50], configsdir[200], rangosfile[200]
new 
SyncHUDg_maxplayersg_msgTeamInfog_msgSayTextrangoscvar_Hudcvar_knifex2cvar_hsx2charnum;
new 
g_vault

/* ====================================
|=* [DEFINE] *=|
=====================================*/
#define TASK_HUD 2100
#define ID_HUD (taskid - TASK_HUD)

enum {
    
   
CAMPO_RANGO,
   
CAMPO_FRAG,
   
CAMPO_MAX
}

new 
g_campos[CAMPO_MAX]

/* ====================================
|=* [INIT] *=|
=====================================*/
public plugin_init() {
   
register_plugin(PLUGINVERSIONAUTHOR)

   
register_event("DeathMsg""Event_DeathMsg""a")
   
register_logevent("logevent_round_end"2"1=Round_End")

   
register_clcmd("say""message_saytext"
   
register_clcmd("say_team""message_sayteam")
   
register_clcmd("say /rangos""RangoSv")
   
register_clcmd("dar_frags""cmd_frags"ADMIN_RCON" ^"Nombre^" ^"Cantidad^"")

/* =============================================
|= [EMPIEZA SECCION MODIFICABLE] =|
==============================================*/
   
cvar_Hud register_cvar("rangos_hud""1")          // 1 - Mostrar HUD | 0 - No Mostrar
   
cvar_knifex2 register_cvar("rangos_knifex2""1")    // 1 - x2 frags con knife | 0 - NO :v
   
cvar_hsx2 register_cvar("rangos_hsx2""1")        // 1 - x2 frags de HeadShot | 0 - NO :v

/* =============================================
|=* [TERMINA SECCION MODIFICABLE] *=|
==============================================*/
   
SyncHUD CreateHudSyncObj()
   
g_maxplayers get_maxplayers()
   
g_msgTeamInfo get_user_msgid("TeamInfo")
   
g_msgSayText get_user_msgid("SayText")

   
g_vault adv_vault_open("data_rangos"false)
   
g_campos[CAMPO_RANGO] = adv_vault_register_field(g_vault"RANGOS")
   
g_campos[CAMPO_FRAG] = adv_vault_register_field(g_vault"FRAGS")
   
adv_vault_init(g_vault)

   
get_configsdir(configsdircharsmax(configsdir))
   
format(rangosfilecharsmax(rangosfile), "%s/PGS_rango.cfg"configsdir)
   
rangos file_size(rangosfile1)
 }

/* ====================================
|=* [PRECACHE] *=|
=====================================*/
public plugin_precache() 
   
precache_sound(Sonido)

/* ===================================
|=* [HUD] *=|
=====================================*/
public HUD(taskid
{
   new 
szMap21 ]; get_mapnameszMapcharsmaxszMap ) );
   
   new 
id ID_HUD
   
new name[33]
   
get_user_name(idnamecharsmax(name))
    
   if (!
is_user_alive(id)) {
   
id pev(idpev_iuser2)
   if (!
is_user_alive(id)) return;
 }

   if(
id != ID_HUD) {
       
set_hudmessage(242195430.00.1500.01.00.010.1)
ShowSyncHudMsg(ID_HUDSyncHUD"Nombre: %s^nFrags: %d^nRango: %s^n"nameg_frags[id], Rangos[g_rango[id]][NOMBRE])  
     
     } else {

set_hudmessage(24219543, -1.00.000.01.00.010.1)
ShowSyncHudMsg(ID_HUDSyncHUD"Frags: %d/%d || Adrenalina: %d || Rango: %s^nMapa: %s || Sig Rango: %s"
g_frags[id], Rangos[g_rango[id]][FRAGS] -  g_frags[id], jctf_get_adrenaline(id), Rangos[g_rango[id]][NOMBRE], szMapRangos[g_rango[id]+1][NOMBRE])
   }
}

public 
RangoSv(id)
{
    for(new 
irangosi++) {
        
   
read_file(rangosfileiDatacharsmax(Data), charnum)
   if(
strlen(Data) < || Data[0] == ';' || equali(Data"//"2))
   continue

   
argbreak(DataLeftcharsmax(Left), Rightcharsmax(Right))
   
remove_quotes(Left)
   
remove_quotes(Right)

   
client_print(idprint_console"%s [%s]"RightLeft)
    }
    
PrintText(id"!g[!t %s!g ] !yLa lista de !g/rangos !y se muestra en la !tconsola!g."Prefijo)
}

/* ==================================
|=* [PUTINSERVER] *=|
===================================*/
public client_putinserver(id) {
   
get_user_nameidg_playernameid ], charsmaxg_playername[ ] ) );
   
g_rango[id] = 0
   g_frags
[id] = 0

   Cargar
(id)

   if(
get_pcvar_num(cvar_Hud)) 
   
set_task(1.0"HUD"id+TASK_HUD__"b")
 }

/* ==================================
|=* [DISCONNECT] *=|
===================================*/
public client_disconnected(id) {
   
Guardar(id);

   
remove_task(id+TASK_HUD)
 }

/* ==================================
|=* [ROUND END] *=|
===================================*/
public logevent_round_end() {
   for(new 
id 1id <= g_maxplayersid++)
   
Guardar(id); 
 }
/* ==================================
|=* [DEATHMSG] *=|
===================================*/
public Event_DeathMsg() {
   new 
attacker read_data(1)
   new 
victim read_data(2)
   new 
hs read_data(3)
   new 
weaponid get_user_weapon(attacker)

   if(
victim == attacker) return;

   if(
is_user_alive(attacker)) {
   
g_frags[attacker]++

   if(
get_pcvar_num(cvar_knifex2)) {
   if(
weaponid == CSW_KNIFE
   
g_frags[attacker]++
  }
   if(
get_pcvar_num(cvar_hsx2)) {
   if(
hsg_frags[attacker]++
  }
   
AumentarRango(attacker)
 }
}

/* ================================
|=* [UPDATE RANGO] *=|
=================================*/
AumentarRango(id) {    
   new 
Aumento false

   
while(g_frags[id] >= Rangos[g_rango[id]][FRAGS]) {
   
Aumento true
   g_rango
[id]++
 }
   if(
Aumento) {
   
PrintText(id"!g[!t %s!g ] !yFelicidades subiste al rango!t: !g%s"PrefijoRangos[g_rango[id]][NOMBRE])
   
client_cmd(id"spk %s"Sonido)
   
Aumento false
 
}

/*=====================================
|=* [SAY] *=|
=====================================*/
public message_saytext(id) { 
   static 
said[192
   
read_args(saidcharsmax(said)) 
   
remove_quotes(said

   if (
said[0] == '@' || said[0] == '%' || said[0] == '.' || said[0] == '!' || equal (said""))
   return 
PLUGIN_HANDLED;

   if (!
ValidMessage(said1)) return PLUGIN_CONTINUE;

   static 
color[11], name[32], alive[11]
   
get_user_team(id,color,charsmax(color))
   
get_user_name(id,name,charsmax(name))
 
   if (
is_user_alive (id)) {
   
alive ""
     
} else {
   
alive "^1*Muerto*"
}

/*=====================================
*[ACTIVAR ADM]*
ADMIN_IMNUNITY = a DUEÑO
ADMIN_LEVEL_C = o DUEÑA
ADMIN_LEVEL_E = q SUB DUEÑO
ADMIN_LEVEL_D = p ADMIN-VIP
=====================================*/

   
if (is_user_admin(id)) {
if (
get_user_flags(id) & ADMIN_RESERVATION
format(saidcharsmax(said), "^4[^3 %s^4 ] ^4[^3*^1%s^3*^4] %s ^1(^4DUEÑ@^1) ^3%s ^4: %s"PrefijoRangos[g_rango[id]][NOMBRE], alivenamesaid)
if (
get_user_flags(id) & ADMIN_LEVEL_B
format(saidcharsmax(said), "^4[^3 %s^4 ] ^4[^3*^1%s^3*^4] %s ^1(^4ADMIN-SOCI@^1) ^3%s ^4: %s"PrefijoRangos[g_rango[id]][NOMBRE], alivenamesaid)
if (
get_user_flags(id) & ADMIN_LEVEL_C)
format(saidcharsmax(said), "^4[^3 %s^4 ] ^4[^3*^1%s^3*^4] %s ^1(^4DUEÑ@^1-^4GENERAL^1) ^3%s ^4: %s"PrefijoRangos[g_rango[id]][NOMBRE], alivenamesaid)
if (
get_user_flags(id) & ADMIN_LEVEL_D
format(saidcharsmax(said), "^4[^3 %s^4 ] ^4[^3*^1%s^3*^4] %s ^1(^4ADMIN-VIP^1) ^3%s ^4: %s"PrefijoRangos[g_rango[id]][NOMBRE], alivenamesaid)
if (
get_user_flags(id) & ADMIN_LEVEL_E
format(saidcharsmax(said), "^4[^3 %s^4 ] ^4[^3*^1%s^3*^4] %s ^1(^4SEXY-GIRL^1) ^3%s ^4: %s"PrefijoRangos[g_rango[id]][NOMBRE], alivenamesaid)
   } else {
format(saidcharsmax(said), "^4[^3*^1%s^3*^4] %s^3 %s ^1: %s"Rangos[g_rango[id]][NOMBRE], alivenamesaid)
}    
   static 
iteam[11
   for (
1<= g_maxplayersi++) {
   if (!
is_user_connected(i)) continue
   
get_user_name(id,name,charsmax(name))

   if (
is_user_admin(i) || is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i)) {
   
get_user_team(iteamcharsmax(team))
   
changeTeamInfo(icolor)
   
writeMessage(isaid)
   
changeTeamInfo(iteam)
  }
}
   return 
PLUGIN_HANDLED_MAIN;
}

public 
message_sayteam(id) {    
    
   static 
said[192
   
read_args(saidcharsmax(said)) 
   
remove_quotes(said

   if (
said[0] == '@' || said[0] == '%' || said[0] == '/' || said[0] == '.' || said[0] == '!' || equal (said""))
   return 
PLUGIN_HANDLED;

   if (!
ValidMessage(said1)) return PLUGIN_CONTINUE

   static 
playerTeamplayerTeamName[19]
   
playerTeam get_user_team(id)

   switch (
playerTeam) {
   case 
1copy (playerTeamName6"^3[TE]")
   case 
2copy (playerTeamName8"^3[CT]"
   default: 
copy (playerTeamName11"^3[SPEC]"
 }

   static 
color[11], name[32], alive[11]
   
get_user_team(id,color,charsmax(color))
   
get_user_name(id,name,charsmax(name))

   if (
is_user_alive (id)) {
   
alive ""
     
} else {
   
alive "*Muerto* "
 
}

   if (
is_user_admin(id)) {
if (
get_user_flags(id) & ADMIN_RESERVATION)
format(saidcharsmax(said), "^4[^3 %s^4 ] ^4[^3*^1%s^3*^4] %s%s ^1(^4DUEÑ@^1) ^3%s ^4: %s"PrefijoRangos[g_rango[id]], aliveplayerTeamnamesaid)
if (
get_user_flags(id) & ADMIN_LEVEL_B)
format(saidcharsmax(said), "^4[^3 %s^4 ] ^4[^3*^1%s^3*^4] %s%s ^1(^4ADMIN-SOCI@^1) ^3%s ^4: %s"PrefijoRangos[g_rango[id]], aliveplayerTeamnamesaid)
if (
get_user_flags(id) & ADMIN_LEVEL_C)
format(saidcharsmax(said), "^4[^3 %s^4 ] ^4[^3*^1%s^3*^4] %s%s ^1(^4DUEÑ@^1-^4GENERAL^1) ^3%s ^4: %s"PrefijoRangos[g_rango[id]], aliveplayerTeamnamesaid)
if (
get_user_flags(id) & ADMIN_LEVEL_D)
format(saidcharsmax(said), "^4[^3 %s^4 ] ^4[^3*^1%s^3*^4] %s%s ^1(^4ADMIN-VIP^1) ^3%s ^4: %s"PrefijoRangos[g_rango[id]], aliveplayerTeamnamesaid)
if (
get_user_flags(id) & ADMIN_LEVEL_E)
format(saidcharsmax(said), "^4[^3 %s^4 ] ^4[^3*^1%s^3*^4] %s%s ^1(^4SEXY-GIRL^1) ^3%s ^4: %s"PrefijoRangos[g_rango[id]], aliveplayerTeamnamesaid)
   } else {
format(saidcharsmax(said), "^4[^3*^1%s^3*^4] %s%s ^3%s ^1: ^1%s"Rangos[g_rango[id]], aliveplayerTeamnamesaid)
 }

   static 
iteam[11
   for (
1<= g_maxplayersi++) {
   if (!
is_user_connected(i)) continue;
   
get_user_name(id,name,charsmax(name))

   if (
get_user_team(i) == playerTeam || is_user_admin(i)) {
   if (
is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i)) {
   
get_user_team(iteamcharsmax(team))
   
changeTeamInfo(icolor)
   
writeMessage(isaid)
   
changeTeamInfo(iteam)
  }
 }
}
   return 
PLUGIN_HANDLED_MAIN;
}

public 
changeTeamInfo(playerteam[]) {
   
message_begin(MSG_ONEg_msgTeamInfo_player)
   
write_byte(player)
   
write_string(team)
   
message_end()
 }

public 
writeMessage(playermessage[]) {
   
message_begin(MSG_ONEg_msgSayText, {000}, player)
   
write_byte(player)
   
write_string(message)
   
message_end()
 }

/* ===================================
|=* [GUARDADO] *=|
=====================================*/
Guardar(id) {
   
adv_vault_set_start(g_vault)

   
adv_vault_set_field(g_vaultg_campos[CAMPO_RANGO], g_rango[id])
   
adv_vault_set_field(g_vaultg_campos[CAMPO_FRAG], g_frags[id])

   
adv_vault_set_end(g_vault0g_playername[id])
 }

Cargar(id) {
   if(!
adv_vault_get_prepare(g_vault_g_playername[id])) 
   return

   
g_rango[id] = adv_vault_get_field(g_vaultg_campos[CAMPO_RANGO])
   
g_frags[id] = adv_vault_get_field(g_vaultg_campos[CAMPO_FRAG])
 } 
/* ===================================
|=* [STOCKS - CHEMA] *=|
=====================================*/
stock PrintText ( const iIndex, const Text [ ], any:... ) { 
    
    new 
szText 192 ];
    
    
vformat szTextsizeof szText ), Text);
    
    
    
replace_all szTextsizeof szText ), "!y""^1" );
    
replace_all szTextsizeof szText ), "!g""^4" );
    
replace_all szTextsizeof szText ), "!t""^3" );
    
    static 
iLen sizeof szText );
    
    
    
replace_all szTextiLen"á""á" );
    
replace_all szTextiLen"Á""Ã" );
    
replace_all szTextiLen"é""é" );
    
replace_all szTextiLen"É""É" );
    
replace_all szTextiLen"í""Ã*" );
    
replace_all szTextiLen"Í""Ã" );
    
replace_all szTextiLen"ó""ó" );
    
replace_all szTextiLen"Ó""Ó" );
    
replace_all szTextiLen"ú""ú" );
    
replace_all szTextiLen"Ú""Ú" );
    
replace_all szTextiLen"ñ""ñ" );
    
replace_all szTextiLen"Ñ""Ñ" );
    
    
    
message_begin iIndex MSG_ONE_UNRELIABLE MSG_BROADCASTget_user_msgid "SayText" ), .player iIndex );
    
write_byte iIndex iIndex 33 );
    
write_string szText );
    
message_end (  );
}

/* =====================================================
|=* [Stock para Saber Si el mensaje es valido] *=|
======================================================*/
stock ValidMessage(text[], maxcount) {
   static 
lenicount
   len 
strlen(text)
   
count 0

   
if (!len)
   return 
false;

   for (
0leni++) {
   if (
text[i] != ' ') {
   
count++
   if (
count >= maxcount)
   return 
true;
  }
 }
   return 
false;

public 
cmd_frags(idnivelcid) {
    if (!
cmd_access(idnivelcid3))
        return 
PLUGIN_HANDLED;
    
    new 
arg[33], arg2[10]
    new 
name[32]; get_user_name(idnamecharsmax(name))
    
read_argv(1argcharsmax(arg))
    
read_argv(2arg2charsmax(arg2))
    
    new 
Player cmd_target(idarg,CMDTARGET_ONLY_ALIVE)
    
    new 
target[32]; get_user_name(Playertargetcharsmax(target))
    
    if (!
Player)
    {
        
client_print(idprint_console"No se encuentra disponible el jugador")
        return 
PLUGIN_HANDLED;
    }
    
    new 
amount str_to_num(arg2)
    
    
g_frags[Player] += amount
    
// aca sumamos los frags 
    
    
AumentarRango(Player// aca tenes que poner tu checklevel asi cuando le de , checkea si puede subir de level
    
    
PrintText(id"!g[!t PGS!g ] !yEl Admin !g%s !yte dio !g%d !t%s"nameamount, (amount "niveles" "nivel"))
    
PrintText(id"!g[!t PGS!g ] !yLe diste !g%d !t%s !yal jugador !g%s"amount, (amount "niveles" "nivel"), target)
    
    return 
PLUGIN_HANDLED;

[
php
»» RENTA TU SERVIDOR EN EVOLUTIÓN-HOST ««

Si deseas contactarme para comprar tu servidor de counter-strike puedes enviar un M.P
Responder
#2
chequea que el attacker esté conectado aquí

Código PHP:
public Event_DeathMsg() {
   new 
attacker read_data(1)
   new 
victim read_data(2)
   new 
hs read_data(3)
   new 
weaponid get_user_weapon(attacker)

   if(
victim == attacker) return;

   if(
is_user_alive(attacker)) {
   
g_frags[attacker]++

   if(
get_pcvar_num(cvar_knifex2)) {
   if(
weaponid == CSW_KNIFE
   
g_frags[attacker]++
  }
   if(
get_pcvar_num(cvar_hsx2)) {
   if(
hsg_frags[attacker]++
  }
   
AumentarRango(attacker)
 }

[Imagen: b_350_20_323957_202743_f19a15_111111.png]

(18/11/2014, 05:47 PM)Neeeeeeeeeel.- escribió: Por qué necesitan una guía para todo? Meté mano y que salga lo que salga... es la mejor forma de aprender.

(16/05/2016, 11:08 PM)kikizon2 escribió: No cabe duda que tienen mierda en vez de cerebro, par de pendejos v:
Responder
#3
(24/07/2019, 03:08 AM)OsweRRR escribió: chequea que el attacker esté conectado aquí

Código PHP:
public Event_DeathMsg() {
   new 
attacker read_data(1)
   new 
victim read_data(2)
   new 
hs read_data(3)
   new 
weaponid get_user_weapon(attacker)

   if(
victim == attacker) return;

   if(
is_user_alive(attacker)) {
   
g_frags[attacker]++

   if(
get_pcvar_num(cvar_knifex2)) {
   if(
weaponid == CSW_KNIFE
   
g_frags[attacker]++
  }
   if(
get_pcvar_num(cvar_hsx2)) {
   if(
hsg_frags[attacker]++
  }
   
AumentarRango(attacker)
 }


esta igual como me lo mandaste
»» RENTA TU SERVIDOR EN EVOLUTIÓN-HOST ««

Si deseas contactarme para comprar tu servidor de counter-strike puedes enviar un M.P
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)