Event_PlayerHurt what weapon did the damage?
I have the following code to find the attacker and person taking damage.
Is there a way to find out if the weapon doing the damage was the AWP? This is for CSGO. PHP Code:
|
Re: Event_PlayerHurt what weapon did the damage?
Yea... check the player active weapon and check what is the weapon...
cheers... i don have CSGO, just bumping.. :) |
Re: Event_PlayerHurt what weapon did the damage?
http://docs.sourcemod.net/api/index....d=show&id=425& if attacker is valid.
|
Re: Event_PlayerHurt what weapon did the damage?
Edit:
never mind, I like this way better and it works! IgniteEntity(AWPClient)! => Is there a way to make them scream after igniting them? !!! Thanks for the replies. What I am tying to do is limit AWPing on my server by denying AWP damage and then killing the AWPER! I have this code, but when I shoot someone the server crashes. ?? PHP Code:
|
Re: Event_PlayerHurt what weapon did the damage?
According to the documentation for player_hurt in CS:GO, there's a weapon String that will tell you what weapon was used.
However, to BLOCK the damage, you should use SDKHooks's OnTakeDamage hook, which has the weapon as one of its arguments, which you can use GetEntityClassname on to find out which weapon it is (after checking that it's a valid entity). Just remember to adjust the damage to 0, then return Plugin_Changed. |
Re: Event_PlayerHurt what weapon did the damage?
TwistedPanda: Don't forget that that will NOT work if the damage was done by grenade - they won't have it equipped anymore.
|
Re: Event_PlayerHurt what weapon did the damage?
necavi, indeed, but he asked about the awp, so grenades were no where in the equation.
|
Re: Event_PlayerHurt what weapon did the damage?
Quote:
And even if some of them do not exactly apply to my initial question, this feedback helps me to have better overall understanding. I am finally beginning to have enough sm scripting experience to be able to do the things I want to fairly quickly without asking a lot of questions. 1) necavi This helps because at some point I may try to see if the weapon was a nade and spend hours trying to figure it out. Now I know to right away to look for some other solution. Your 1 minute post could save me hours in the future. Thanks! 2) thetwistedpanda Your replay and link got me the info I need to get the plugin working, all in about an hours time including the initial post of my question! So thanks for the quick reply and help! 3) Powerlord I was going to ask about this in another post. So when I get an event passed into Player hurt, what else can I do with the event? Where are the docs on what I can do with this structure? The link is a great help! Thanks. And I am quickly learning it is better to use SDKHooks when we have the option to do so. Thanks! So the code below works great. When a someone uses an AWP the attacked doesn't take damage and the AWPer ignites for 6 seconds! Awesome! I don't want to switch topics, but I need help from people with experience like all of you. To have a decent bot server with csgo I need to solve one last problem with the new way CSGO limits maxplayers per team. For GO it is now this bad thing: (max per team) = (max players/2) Please if you can check this and let me know if you have a solution. I have posted in several forums (sourcemod metamod and Steam forums LOL). Can't have a decent bot server until we fix this. http://forums.alliedmods.net/showthr...21#post1792521 |
Re: Event_PlayerHurt what weapon did the damage?
Quote:
You can get specific values from events using GetEventInt, GetEventFloat, GetEventVector, or GetEventString based on what the type of the value is in the event documentation. You can also create and fire these events from your code; why you'd want to do this varies. SDKHooks works by detouring functions the game server would call and allowing plugins to add their own hooks to those detours. Depending on the return value from the plugin hook, the game function may be called as normal (Plugin_Continue), called with new values (Plugin_Changed), or not called at all (Plugin_Handled or Plugin_Stop; not sure which). |
Re: Event_PlayerHurt what weapon did the damage?
PHP Code:
|
All times are GMT -4. The time now is 12:11. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.