Raised This Month: $ Target: $400
 0% 

Amxx studio error!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-26-2014 , 16:22   Re: Amxx studio error!
Reply With Quote #8

I have a couple comments still.

Code:
    precache_sound("sound/headshot.wav");
I'm not sure here but I think sound/ is not required when precaching a sound file through precache_sound(). It will assume the sound folder, so this will print as "sound/sound/headshot.wav". At least I get this error: "Warning: Unable to open sound/sound/headshot.wav for transfer"

Code:
register_event("deathmsg", "hook_death" ,"a");
Events are case-sensitive. "DeathMsg" would be correct. You could also filter away killer being 0 and the wepon here. by adding this to the end of that function
Code:
"1!0", "4=knife"
This basically means "parameter 1 is not equal to 0" and "parameter 4 is equal to knife".
You could also add "3=1" to make it only for headshots.
Here's a full example that will only get called if the killer is not the server/map/worldspawn (suicide), it's a headshot and it's done with a knife:
Code:
register_event("DeathMsg", "hook_death" ,"a", "1!0", "3=1", "4=knife");

To make sure the killer is a player and not an entity you should check if the player is in the range of 1 and maxplayers. Create a global variable named g_maxplayers and retrieve get_maxplayers() on plugin_init(). Assign that value to the global variable. In the DeathMsg event you need to check if ( killer <= g_maxplayers ) before running any player based functions (like get_user_name(), get_user_team() or get_user_frags()) on that id.

I can see that it's not done so I will stop there for now and let you try for yourself a bit. Just come back if you have more problems. But at least register a cvar for the getmoney pointer because you will get runtime errors if trying to retrieve a value on a cvar pointer that doesn't exist.
__________________
Black Rose is offline
 



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 06:04.


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