Raised This Month: $ Target: $400
 0% 

get error when a guy not kill by another player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 08-16-2008 , 14:22   get error when a guy not kill by another player
Reply With Quote #1

When a people kill themselves with worldspawn.. send kill command..etc
it will get error
Any one know how to fix that?

L 08/10/2008 - 06:26:22: Start of error session.
L 08/10/2008 - 06:26:22: Info (map "35hp_2") (file "addons/amxmodx/logs/error_20080810.log")
L 08/10/2008 - 06:26:22: [CSTRIKE] Player out of range (0)
L 08/10/2008 - 06:26:22: [AMXX] Displaying debug trace (plugin "kill_bouns.amxx")
L 08/10/2008 - 06:26:22: [AMXX] Run time error 10: native error (native "cs_get_user_money")
L 08/10/2008 - 06:26:22: [AMXX] [0] kill_bouns.sma::event_death (line 54)
Code:
/* 
*   AMXMOD script. 
*   (plugin_bonus1.sma) 
*   by DreamZSW <[email protected]> 
*   This file is provided as is (no warranties). 
* 
*/ 
#include <amxmodx>
#include <cstrike>
#define MAX_NAME_LENGTH 32 
#define MAX_TEXT_LENGTH 512 
#define ACCESS_LEVEL ADMIN_LEVEL_A 
// Default on/off 
new gBonusMode = 1 
new gBonusCount = 0 
new gBonusIndex[5] = { 5000,4000,3000,2000,1000 } 
public admin_bonuskill(id) 
{ 
// Check access level 
if (!(get_user_flags(id)&ACCESS_LEVEL)) { 
  console_print(id,"[AMX] You have no access to that command") 
  return PLUGIN_HANDLED 
} 
// Check arguments 
if (read_argc() < 2) { 
  console_print(id,"[AMX] Usage: amx_bonuskill < 1 | 0 >") 
  return PLUGIN_HANDLED 
} 
new sArg1[MAX_NAME_LENGTH] 
read_argv(1,sArg1,MAX_NAME_LENGTH) 
if (str_to_num(sArg1)) { 
  gBonusMode = 1 
  client_print(id,print_console,"[AMX] Bonus money for kills is now ON.") 
} 
else { 
  gBonusMode = 0 
  client_print(id,print_console,"[AMX] Bonus money for kills is now OFF.") 
} 
return PLUGIN_HANDLED 
} 
public event_death() 
{ 
if (gBonusMode) { 
  new iKiller = read_data(1) 
  new iVictim = read_data(2) 
  new sMsg[MAX_TEXT_LENGTH] 
  new sName[MAX_NAME_LENGTH] 
  get_user_name(iKiller,sName,MAX_NAME_LENGTH) 
 
  if ((iKiller != iVictim) && (gBonusCount < sizeof gBonusIndex) && (get_user_team(iKiller) != get_user_team(iVictim))) { 
   gBonusCount++ 
   cs_set_user_money(iKiller,cs_get_user_money(iKiller)+gBonusIndex[gBonusCount-1]) 
   if (gBonusCount == 1) { 
    format(sMsg,MAX_TEXT_LENGTH,"%s first blood^n================^nget money +$%i",sName,gBonusIndex[gBonusCount-1]) 
    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.25, 0, 6.0, 6.0, 0.5, 0.15, 3) 
   } 
   else if (gBonusCount == 2) { 
    format(sMsg,MAX_TEXT_LENGTH,"%s got the 2nd kill! Awarded (+$%i money)",sName,gBonusIndex[gBonusCount-1]) 
    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.26, 0, 6.0, 6.0, 0.5, 0.15, 3)
   } 
   else if (gBonusCount == 3) { 
    format(sMsg,MAX_TEXT_LENGTH,"%s got the 3rd kill! Awarded (+$%i money)",sName,gBonusIndex[gBonusCount-1]) 
    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.27, 0, 6.0, 6.0, 0.5, 0.15, 3) 
   } 
   else if (gBonusCount == 4) { 
    format(sMsg,MAX_TEXT_LENGTH,"%s got the 4rd kill! Awarded (+$%i money)",sName,gBonusIndex[gBonusCount-1]) 
    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.28, 0, 6.0, 6.0, 0.5, 0.15, 3) 
   }
   else {
    format(sMsg,MAX_TEXT_LENGTH,"%s got the %ith kill! Awarded (+$%i money)",sName,gBonusCount,gBonusIndex[gBonusCount-1]) 
    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 3) 
   } 
   show_hudmessage(0,sMsg)
  } 
} 
return PLUGIN_CONTINUE 
} 
public event_round_end() { 
gBonusCount = 0 
} 
/************************************************************ 
* PLUGIN FUNCTIONS 
************************************************************/ 
public plugin_init() 
{ 
register_plugin("Plugin Money Bonus","1.0","DreamZSW") 
register_event("DeathMsg","event_death","a") 
register_event("SendAudio","event_round_end","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw") 
register_concmd("amx_bonuskill","admin_bonuskill",ACCESS_LEVEL,"amx_powers < authid | part of nick >") 
}
biscuit628 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-16-2008 , 14:23   Re: get error when a guy not kill by another player
Reply With Quote #2

Code:
register_event("DeathMsg","event_death","a","1!0")
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-16-2008 , 15:39   Re: get error when a guy not kill by another player
Reply With Quote #3

@x-olent
Have also to check if killer is not an entity.

PHP Code:
/* 
*   AMXMOD script. 
*   (plugin_bonus1.sma) 
*   by DreamZSW <[email protected]
*   This file is provided as is (no warranties). 

*/ 
#include <amxmodx>
#include <cstrike>
#define MAX_NAME_LENGTH 32 
#define MAX_TEXT_LENGTH 512 
#define ACCESS_LEVEL ADMIN_LEVEL_A 
// Default on/off 
new gBonusMode 
new gBonusCount 
new gBonusIndex[5] = { 5000,4000,3000,2000,1000 }
new 
g_iMaxPlayers 
public admin_bonuskill(id

// Check access level 
if (!(get_user_flags(id)&ACCESS_LEVEL)) { 
  
console_print(id,"[AMX] You have no access to that command"
  return 
PLUGIN_HANDLED 

// Check arguments 
if (read_argc() < 2) { 
  
console_print(id,"[AMX] Usage: amx_bonuskill < 1 | 0 >"
  return 
PLUGIN_HANDLED 

new 
sArg1[MAX_NAME_LENGTH
read_argv(1,sArg1,MAX_NAME_LENGTH
if (
str_to_num(sArg1)) { 
  
gBonusMode 
  client_print
(id,print_console,"[AMX] Bonus money for kills is now ON."

else { 
  
gBonusMode 
  client_print
(id,print_console,"[AMX] Bonus money for kills is now OFF."

return 
PLUGIN_HANDLED 

public 
event_death() 

if (
gBonusMode) { 
  new 
iKiller read_data(1)
  if(
iKiller g_iMaxPlayers)
    return 
  new 
iVictim read_data(2
  new 
sMsg[MAX_TEXT_LENGTH
  new 
sName[MAX_NAME_LENGTH
  
get_user_name(iKiller,sName,MAX_NAME_LENGTH
 
  if ((
iKiller != iVictim) && (gBonusCount sizeof gBonusIndex) && (get_user_team(iKiller) != get_user_team(iVictim))) { 
   
gBonusCount++ 
   
cs_set_user_money(iKiller,cs_get_user_money(iKiller)+gBonusIndex[gBonusCount-1]) 
   if (
gBonusCount == 1) { 
    
format(sMsg,MAX_TEXT_LENGTH,"%s first blood^n================^nget money +$%i",sName,gBonusIndex[gBonusCount-1]) 
    
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.020.2506.06.00.50.153
   } 
   else if (
gBonusCount == 2) { 
    
format(sMsg,MAX_TEXT_LENGTH,"%s got the 2nd kill! Awarded (+$%i money)",sName,gBonusIndex[gBonusCount-1]) 
    
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.020.2606.06.00.50.153)
   } 
   else if (
gBonusCount == 3) { 
    
format(sMsg,MAX_TEXT_LENGTH,"%s got the 3rd kill! Awarded (+$%i money)",sName,gBonusIndex[gBonusCount-1]) 
    
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.020.2706.06.00.50.153
   } 
   else if (
gBonusCount == 4) { 
    
format(sMsg,MAX_TEXT_LENGTH,"%s got the 4rd kill! Awarded (+$%i money)",sName,gBonusIndex[gBonusCount-1]) 
    
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.020.2806.06.00.50.153
   }
   else {
    
format(sMsg,MAX_TEXT_LENGTH,"%s got the %ith kill! Awarded (+$%i money)",sName,gBonusCount,gBonusIndex[gBonusCount-1]) 
    
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.020.2906.06.00.50.153
   } 
   
show_hudmessage(0,sMsg)
  } 



public 
event_round_end() { 
gBonusCount 

/************************************************************ 
* PLUGIN FUNCTIONS 
************************************************************/ 
public plugin_init() 

register_plugin("Plugin Money Bonus","1.0","DreamZSW"
register_event("DeathMsg","event_death","a","1!0"
register_event("SendAudio","event_round_end","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw"
register_concmd("amx_bonuskill","admin_bonuskill",ACCESS_LEVEL,"amx_powers < authid | part of nick >")
g_iMaxPlayers get_maxplayers() 

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

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 03:14.


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