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

Invalid player id 0


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
Shinzon
Senior Member
Join Date: Feb 2005
Location: Hellfire
Old 09-10-2006 , 23:53   Invalid player id 0
#1

Hi,
need help...

L 08/27/2006 - 20:48:02: Invalid player id 0
L 08/27/2006 - 20:48:02: [AMXX] Run time error 10 (plugin "damagemult.amxx") - debug not enabled!
L 08/27/2006 - 20:48:02: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).

Below plugin causes this error:

Code:
/*Name:  Weapon Multiplier
Author:  BlueRaja

About 10-20% of this code was stolen from Warcraft3 mod - credit, therefore, should go to its author(s).  Thanks guy(s)!

Other than that...I'd like to give shout out to Damaged Soul..thanks for helping me out all these times,
and for putting up with all my crazy shit :D

***VARIABLES***:
sv_highnadedam - admins with ADMIN_RCON get this much damage added to their HE grenade.  Remember, it's a percentage (0.5 = 50% MORE damage, 1.99 = 199% MORE damage , etc.)
sv_lownadedam - admins with ADMIN_CHAT get this much damage added to their HE grenade.  Again, it's a percentage.
sv_highgundam - admins with ADMIN_RCON get this much damage added to their gun shots.  Remember, it's a percentage.
sv_lowgundam - I think you get the idea
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>

new gmsgDeathMsg
new gmsgScoreInfo
new DeathHandled[33]

public client_connect(id)
{
	DeathHandled[id]=false
}

public RoundStart()
{
   new Float:roundtime = get_cvar_float("mp_roundtime") * 60.0
   new rtime = read_data(1)
   
   if ( roundtime == rtime )   { //Roundstart after freezetime
	for (new i=0; i<33; i++){
		DeathHandled[i]=false
      }

   }   
   return PLUGIN_CONTINUE
}

public damage_event(id)
{

	new weapon, bodypart, attacker = get_user_attacker(id,weapon,bodypart)
	new damage
	new hasrcon = get_user_flags(attacker)&ADMIN_LEVEL_G //

	//If death has already been handled, return
	if(DeathHandled[id])
		return PLUGIN_CONTINUE

	//Is called for all players, regardless of admin status
	//In case player died "legitimately"
	if (!is_user_alive(id))
	{
		DeathHandled[id]=true
		return PLUGIN_CONTINUE
	}
		

	if (!(get_user_flags(attacker)&ADMIN_LEVEL_F) && !hasrcon)//Need ADMIN_LEVEL_F flag r to use
		return PLUGIN_CONTINUE

	if (weapon==CSW_HEGRENADE){
		if (hasrcon){
			if (!get_cvar_float("sv_highnademult")){
				return PLUGIN_CONTINUE
			}
		}
		else {
			if (!get_cvar_float("sv_lownademult")){
				return PLUGIN_CONTINUE
			}
		}
	}
	else { //weapon is gun
		if (hasrcon){
			if (!get_cvar_float("sv_highgunmult")){
				return PLUGIN_CONTINUE
			}
		}
		else { //low admins
			if (!get_cvar_float("sv_lowgunmult")){
				return PLUGIN_CONTINUE
			}
		}
	}

	if (attacker==0)
		return PLUGIN_CONTINUE

	if (attacker==id && weapon==0)
		return PLUGIN_CONTINUE

//Check is victim and attacker are dead
	new victimkilled = 0
	new victimhealth = get_user_health(id)

//Check if shot was headshot; might want to fake it, if not
	new headshot = 0
	if (bodypart==HIT_HEAD || 							//real headshot
	   (damage>35 && weapon!=CSW_HEGRENADE && bodypart==HIT_CHEST))	//fake headshot ^_^
		headshot=0

	damage = read_data(2)
	if(weapon==CSW_HEGRENADE) {
		if (hasrcon){
			damage = floatround(float(damage) * get_cvar_float("sv_highnademult"))
		}
		else{  //normal admin
			damage= floatround(float(damage) * get_cvar_float("sv_lownademult"))
		}
		
		if (damage>35 && victimhealth>35) //Shouldn't kill someone with 100 HP (a nade on the ground can only do up to 65 normally ^_^)
			damage=25+random_num(0,10)
	}
	else { //guns guns guns
		if (hasrcon){
			damage = floatround(float(damage) * get_cvar_float("sv_highgunmult"))
		}
		else{
			damage = floatround(float(damage) * get_cvar_float("sv_lowgunmult"))
		}
	}

	//Extra damage for certain weapons :D
	if (weapon==CSW_KNIFE)
		damage = floatround(float(damage)*1.1)
	if (weapon==CSW_MAC10)
		damage = floatround(float(damage)*1.5)
	if (weapon==CSW_GLOCK18)
		damage = floatround(float(damage)*1.3)

	//check if player should die; if so, kill 'em
	if (victimhealth - damage<=0)
		victimkilled = 1
	if (victimhealth - damage<=1024 && get_user_health(id)>500)
		victimkilled = 1
	

	if (victimkilled){
		new weaponname[32]

		switch (weapon)
		{
		case 1:
			weaponname = "p228"
		case 3:
			weaponname = "scout"
		case 4:
			weaponname = "grenade"
		case 5:
			weaponname = "xm1014"
		case 7:
			weaponname = "mac10"
		case 8:
			weaponname = "aug"
		case 10:
			weaponname = "elite"
		case 11:
			weaponname = "fiveseven"
		case 12:
			weaponname = "ump45"
		case 13:
			weaponname = "sg550"
		case 14:
			weaponname = "galil"
		case 15:
			weaponname = "famas"
		case 16:
			weaponname = "usp"
		case 17:
			weaponname = "glock18"
		case 18:
			weaponname = "awp"
		case 19:
			weaponname = "mp5navy"
		case 20:
			weaponname = "m249"
		case 21:
			weaponname = "m3"
		case 22:
			weaponname = "m4a1"
		case 23:
			weaponname = "tmp"
		case 24:
			weaponname = "g3sg1"
		case 26:
			weaponname = "deagle"
		case 27:
			weaponname = "sg552"
		case 28:
			weaponname = "ak47"
		case 29:
			weaponname = "knife"
		case 30:
			weaponname = "p90"
		}

		if (get_user_team(id)!=get_user_team(attacker)){
			set_user_frags(id,get_user_frags(id)+1)
			set_user_frags(attacker,get_user_frags(attacker)+1)
		}
		else{
			set_user_frags(id,get_user_frags(id)+1)
			set_user_frags(attacker,get_user_frags(attacker)-1)
		}

		//Kill victim
		set_msg_block(gmsgDeathMsg,BLOCK_ONCE)
		set_user_health(id,-1)
		set_msg_block(gmsgDeathMsg,BLOCK_NOT) //having problems with more than one message being blocked :S

		//Display death
		message_begin( MSG_ALL, gmsgDeathMsg,{0,0,0},0)
		write_byte(attacker)
		write_byte(id)
		write_byte(headshot)
		write_string(weaponname)
		message_end()

		//Change scoreboard for victim
		message_begin(MSG_ALL, gmsgScoreInfo)
		write_byte(id)				//Player
		write_short(get_user_frags(id))	//Frags
		write_short(cs_get_user_deaths(id))	//Deaths
		write_short(0)				//"Class"
		write_short(get_user_team(id))	//Team
		message_end()

		//Change scoreboard for attacker
		message_begin(MSG_ALL, gmsgScoreInfo)
		write_byte(attacker)				//Player
		write_short(get_user_frags(attacker))	//Frags
		write_short(cs_get_user_deaths(attacker))	//Deaths
		write_short(0)					//"Class"
		write_short(get_user_team(attacker))	//Team
		message_end()



		//Don't handle this death again
		DeathHandled[id]=true

	}
	else {
		set_user_health(id,get_user_health(id) - damage)
	}

	return PLUGIN_CONTINUE
}




public plugin_init(){
	gmsgDeathMsg = get_user_msgid("DeathMsg")
	gmsgScoreInfo = get_user_msgid("ScoreInfo") 
	register_plugin("Weapon Multiplier","0.50","BlueRaja")
	register_event("Damage", "damage_event", "b", "2!0")
	register_event("RoundTime", "RoundStart", "bc") 
	register_cvar("sv_highnademult","1.0",0) //only applies to admins with flag s
	register_cvar("sv_lownademult","0.25",0) //For lower admins with level r
	register_cvar("sv_highgunmult","0.5",0)
	register_cvar("sv_lowgunmult","0.5",0)
	return PLUGIN_CONTINUE
}
Why this happens?
Sry about, but cant find any error by myself...

Please give me hint...
__________________
Shinzon

CS:1.6 [max-torgau.de] Fun Server 83.142.83.26:27016
CS:1.6 [max-torgau.de] DeathMatch 83.142.83.26:27017
CS:1.6 [max-torgau.de] .::N!CkYs fUn sErVeR wC3::. XP-SAVE 83.142.83.26:27035
nihil aliud est ebrietas quam voluntaria insania
Shinzon is offline
{NM}Jason
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Texas
Old 09-10-2006 , 23:57   Re: Invalid player id 0
#2

Support / Help
Find help for general AMXX issues. This does not include support for individual 3rd party plugins.

Post in that plugins Thread!
__________________
http://forums.alliedmods.net/showthr...396#post451396
Quote:
Originally Posted by BAILOPAN View Post
Shortly after posting that image, Jason crushed the truck into a ball with his hands, and tossed it over his shoulder.
{NM}Jason is offline
Send a message via ICQ to {NM}Jason Send a message via AIM to {NM}Jason Send a message via MSN to {NM}Jason Send a message via Yahoo to {NM}Jason
Shinzon
Senior Member
Join Date: Feb 2005
Location: Hellfire
Old 09-11-2006 , 00:06   Re: Invalid player id 0
#3

If u wanna say nothing, say nothing...
__________________
Shinzon

CS:1.6 [max-torgau.de] Fun Server 83.142.83.26:27016
CS:1.6 [max-torgau.de] DeathMatch 83.142.83.26:27017
CS:1.6 [max-torgau.de] .::N!CkYs fUn sErVeR wC3::. XP-SAVE 83.142.83.26:27035
nihil aliud est ebrietas quam voluntaria insania
Shinzon is offline
{NM}Jason
AMX Mod X Beta Tester
Join Date: Mar 2004
Location: Texas
Old 09-11-2006 , 00:12   Re: Invalid player id 0
#4

Quote:
Originally Posted by Shinzon View Post
If u wanna say nothing, say nothing...
Listen before you get your Self in Trouble you need to learn to read the Rules.
__________________
http://forums.alliedmods.net/showthr...396#post451396
Quote:
Originally Posted by BAILOPAN View Post
Shortly after posting that image, Jason crushed the truck into a ball with his hands, and tossed it over his shoulder.
{NM}Jason is offline
Send a message via ICQ to {NM}Jason Send a message via AIM to {NM}Jason Send a message via MSN to {NM}Jason Send a message via Yahoo to {NM}Jason
s p l i t
Senior Member
Join Date: May 2006
Location: US, NC
Old 09-11-2006 , 09:25   Re: Invalid player id 0
#5

Enable debuging for that plugin and post the debug error along with the script in the scripting help section, not here.
s p l i t is offline
Send a message via AIM to s p l i t Send a message via MSN to s p l i t
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 09-11-2006 , 10:03   Re: Invalid player id 0
#6

new hasrcon = get_user_flags(attacker)&ADMIN_LEVEL_G
That is the problem here is the fix:
Find this inside damage_event(id):
PHP Code:
    if (attacker==0)
        return 
PLUGIN_CONTINUE 
And place it here:
PHP Code:
new weaponbodypartattacker get_user_attacker(id,weapon,bodypart)
if (
attacker==0) return PLUGIN_CONTINUE
new damage
new hasrcon get_user_flags(attacker)&ADMIN_LEVEL_G // 
Orangutanz is offline
Closed Thread



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 00:16.


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