Raised This Month: $51 Target: $400
 12% 

[AMXX] Run time error 10: native error (native "get_user_weapon")


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
polimpo4
Member
Join Date: Jan 2017
Old 09-29-2018 , 15:27   [AMXX] Run time error 10: native error (native "get_user_weapon")
Reply With Quote #1

I Have This Erro At DEbug Mode Console
L 09/29/2018 - 18:53:23: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 09/29/2018 - 18:53:23: [AMXX] [0] moedas.sma::fw_PlayerKilled (line 74)


print of line of error
https://imgur.com/a/YA85Dgw

Can Anyone Help With It?
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
#include <nvault>

/*
UPDATES

2.9 - New Logs
2.8 - Fix Logs
2.7 - Set New Command "Set_Credits"
2.6 - Set New Command "Give Credits"
2.5 - Fix Errors
2.4 - Fix Acess Flags
2.3 - Create Function To Easy Save Credits SaveCredits(id);
2.2 - Create Vault
2.1 - Create Multiples Ways To Win Credits
2.0 - Fix Conditions To Give Credits
1.9 - Set HUD To Display Credits
1.8 - Check Credits
1.7 - Create Update Time To Update Chat Credits
1.6 - Set Task
1.5 - Create Variables
1.4 - Recreate All Code
1.3 - Fix Old Code
1.2 - Fail Tries
1.1 - Set Code.
*/

#define PLUGIN "Moedas"
#define VERSION "2.9"
#define AUTHOR "_|Polimpo4|_"

#define STATS_COINS 0  
#define UPDATETIME 5.0

new g_coins[33][1];

new 
vaultwidhs;


public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
    
register_concmd("amx_give_credits""Give_Credits"ADMIN_IMMUNITY"Name/@T/@CT/@All -> Amount");
    
register_concmd("amx_set_credits""Set_Credits"ADMIN_IMMUNITY"Name/@T/@CT/@All -> Amount");

    
set_taskUPDATETIME"ShowCoinDetails"___"b" );

    
vault nvault_open("SaveCoins")
}


public 
fw_PlayerKilled(victimattackershouldgib)  
{
    if (
victim == attacker || !is_user_alive(attacker) )
    {
    return;
    }
        
    
    new 
Aname[32], Vname[32];

    
get_user_nameattacker Aname charsmaxAname ) );
    
get_user_namevictim Vname charsmaxVname ) );

    
attacker get_user_attacker(victimwidhs)

    if(
get_user_weapon(attacker) == CSW_KNIFE && is_user_alive(attacker))
    { 
        
g_coins[attacker][STATS_COINS]+=
        
//client_print (attacker, print_chat, "You killed %s with a knife", V_name) 
        //client_print (victim, print_chat, "You were killed by %s with a knife", A_name) 
    
}
    else if(
hs==HIT_HEAD)
    {
        
g_coins[attacker][STATS_COINS]+=2  
        
//client_print (victim, print_chat, "%s got you a headshoot", A_name)
    
}

    
g_coins[attacker][STATS_COINS]++ 
    
client_printattackerprint_center"Moedas %d"g_coins[attacker]);

}

public 
ShowCoinDetails()
{

    new 
Players32 ];
    new 
playerCountiplayer;

    
get_players(PlayersplayerCount"ach");
    for (
i=0i<playerCounti++) 
    {
        
player Players];
        
    new 
name50 ];
    
get_user_nameplayername49 );

    new 
x_coins g_coins[player][STATS_COINS]


    if(
is_user_alive(player))
        {
            
set_hudmessage02552550.020.1706.0UPDATETIME );
        
show_hudmessageplayer"[MOEDAS : %i]",x_coins);
    }   
    }

}

public 
Give_Credits(idlevelcid) { 
   if(!
cmd_access(idlevelcid2)) { 
      return 
PLUGIN_HANDLED
   }
   
   
   new 
Players32 ];
   new 
playerCountiplayer;
   
get_players(PlayersplayerCount"ach");
   for (
i=0i<playerCounti++) 
    {
        
player Players];
    }
   new 
arg[23], gplayers[32], numplayersname[32]; 
   
get_user_name(idname31); 
   
read_argv(1arg23); 
   new 
give_credits[5]; 
   
read_argv(2give_creditscharsmax(give_credits)); 
   new 
dar_coins str_to_num(give_credits); 
   if(
equali(arg"@T")) { 
      
get_players(gplayersnum"e""TERRORIST"); 
      for(
0numi++) { 
         
players gplayers[i]; 
         if(!
is_user_connected(players)) 
            continue; 
         
g_coins[player][STATS_COINS] += dar_coins;
         
SaveCoins(id
      } 
      new 
x_coins g_coins[player][STATS_COINS];
      switch(
get_cvar_num("amx_show_activity")) { 
         case 
1ColorChat(0"^x03ADMIN^x04 give^x03 %i Credits^x04 to all^x03 Ts."x_coins); 
            case 
2ColorChat(0"^x03%s^x04 give^x03 %i Credits^x04 to all^x03 Ts."namex_coins); 
         } 
   } 
   else if(
equali(arg"@CT")) { 
      
get_players(gplayersnum"e""CT"); 
      for(
0numi++) {
         if(!
is_user_connected(players)) 
            continue; 
         
g_coins[player][STATS_COINS] += dar_coins
         
SaveCoins(id
      }
      new 
x_coins g_coins[player][STATS_COINS];
      switch(
get_cvar_num("amx_show_activity")) { 
         case 
1ColorChat(0"^x03ADMIN^x04 give^x03 %i Credits^x04 to all^x03 CTs."x_coins); 
            case 
2ColorChat(0"^x03%s^x04 give^x03 %i Credits^x04 to all^x03 CTs."namex_coins); 
         } 
   } 
   if(
equali(arg"@All")) { 
      
get_players(gplayersnum"a"); 
      for(
0numi++) {
         if(!
is_user_connected(players)) 
            continue; 
         
g_coins[player][STATS_COINS] += dar_coins
         
SaveCoins(id
      }
      new 
x_coins g_coins[player][STATS_COINS];
      switch(
get_cvar_num("amx_show_activity")) { 
         case 
1ColorChat(0"^x03ADMIN^x04 give^x03 %i Credits^x04 to all^x03 Players."x_coins); 
            case 
2ColorChat(0"^x03%s^x04 give^x03 %i Credits^x04 to all^x03 Players."namex_coins); 
         } 
   } 
   new 
playertg cmd_target(idarg11); 
   if(!
playertg) { 
      return 
PLUGIN_HANDLED
   } 
   
g_coins[player][STATS_COINS] += dar_coins;
   
SaveCoins(id)
   new 
x_coins g_coins[player][STATS_COINS];
   switch(
get_cvar_num("amx_show_activity")) { 
      case 
1ColorChat(player"^x03ADMIN^x04 give your^x03 %i Credits."x_coins); 
         case 
2ColorChat(player"^x03%s^x04 give your^x03 %i Credits."namex_coins); 
      } 
   return 
PLUGIN_HANDLED



public 
Set_Credits(idlevelcid) { 
   if(!
cmd_access(idlevelcid2)) { 
      return 
PLUGIN_HANDLED
   }
   
   
   new 
Players32 ];
   new 
playerCountiplayer;
   
get_players(PlayersplayerCount"ach");
   for (
i=0i<playerCounti++) 
    {
        
player Players];
    }
   new 
arg[23], gplayers[32], numplayersname[32]; 
   
get_user_name(idname31); 
   
read_argv(1arg23); 
   new 
give_credits[5]; 
   
read_argv(2give_creditscharsmax(give_credits)); 
   new 
set_coins str_to_num(give_credits); 
   if(
equali(arg"@T")) { 
      
get_players(gplayersnum"e""TERRORIST"); 
      for(
0numi++) { 
         
players gplayers[i]; 
         if(!
is_user_connected(players)) 
            continue; 
         
g_coins[player][STATS_COINS] = set_coins;
         
SaveCoins(id
      } 
      new 
x_coins g_coins[player][STATS_COINS];
      switch(
get_cvar_num("amx_show_activity")) { 
         case 
1ColorChat(0"^x03ADMIN^x04 set to all^x03 Ts^x03 %i Credits."x_coins); 
            case 
2ColorChat(0"^x03%s^x04 set to all^x03 Ts^x03 %i Credits."namex_coins); 
         } 
   } 
   else if(
equali(arg"@CT")) { 
      
get_players(gplayersnum"e""CT"); 
      for(
0numi++) {
         if(!
is_user_connected(players)) 
            continue; 
         
g_coins[player][STATS_COINS] = set_coins
         
SaveCoins(id
      }
      new 
x_coins g_coins[player][STATS_COINS];
      switch(
get_cvar_num("amx_show_activity")) { 
         case 
1ColorChat(0"^x03ADMIN^x04 set to all^x03 CTs^x03 %i Credits."x_coins); 
            case 
2ColorChat(0"^x03%s^x04 set to all^x03 CTs^x03 %i Credits."namex_coins); 
         } 
   } 
   if(
equali(arg"@All")) { 
      
get_players(gplayersnum"a"); 
      for(
0numi++) {
         if(!
is_user_connected(players)) 
            continue; 
         
g_coins[player][STATS_COINS] = set_coins
         
SaveCoins(id
      }
      new 
x_coins g_coins[player][STATS_COINS];
      switch(
get_cvar_num("amx_show_activity")) { 
         case 
1ColorChat(0"^x03ADMIN^x04 set to all^x03 Players^x03 %i Credits."x_coins); 
            case 
2ColorChat(0"^x03%s^x04 set to all^x03 Players^x03 %i Credits."namex_coins); 
         } 
   } 
   new 
playertg cmd_target(idarg11); 
   if(!
playertg) { 
      return 
PLUGIN_HANDLED
   } 
   
g_coins[player][STATS_COINS] = set_coins;
   
SaveCoins(id)
   new 
x_coins g_coins[player][STATS_COINS];
   switch(
get_cvar_num("amx_show_activity")) { 
      case 
1ColorChat(player"^x03ADMIN^x04 set your Credits to^x03 %i."x_coins); 
         case 
2ColorChat(player"^x03%s^x04 set your Credits to^x03 %i."namex_coins); 
      } 
   return 
PLUGIN_HANDLED


public 
SaveCoins(id){
    new 
name[32],data[512]  
    
get_user_name(id,name,31)  
    
formatex(data,511,"%d",g_coins[id][STATS_COINS])  
    
nvault_set(vault,name,data)
}

public 
client_putinserver(id)
{
    new 
name[32],data[512],raw[1][20]  
    
get_user_name(id,name,31)  
     
    if(!
nvault_get(vault,name,data,511)) 
        return 
PLUGIN_CONTINUE 
     
    parse
(data,raw[0],19
    
g_coins[id][STATS_COINS]=str_to_num(raw[0])  
     
    return 
PLUGIN_CONTINUE
}

public 
client_disconnect(id)
{
    
SaveCoins(id);

}

//####################Color Chat######

stock ColorChat(const id, const input[], any:...) { 
   new 
count 1players[32]; 
   static 
msg[191]; 
   
vformat(msg190input3); 
    
   
replace_all(msg190"!x04""^4"); 
   
replace_all(msg190"!x01""^1"); 
   
replace_all(msg190"!x03""^3"); 
    
   if(
idplayers[0] = id
   else 
get_players(playerscount"ch"); { 
      for(new 
0counti++) { 
         if(
is_user_connected(players[i])) { 
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]); 
            
write_byte(players[i]); 
            
write_string(msg); 
            
message_end(); 
         } 
      } 
   } 


Last edited by polimpo4; 09-29-2018 at 15:30.
polimpo4 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-29-2018 , 15:37   Re: [AMXX] Run time error 10: native error (native "get_user_weapon")
Reply With Quote #2

What is the point of using get_user_attacker instead of using "attacker" param directly?
__________________
HamletEagle is offline
Old 09-29-2018, 19:09
Natsheh
This message has been deleted by Natsheh. Reason: Nvm
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode