Raised This Month: $ Target: $400
 0% 

SDK Hooks 2.1 - Updated 2011-9-10


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Chanz
Veteran Member
Join Date: Aug 2008
Location: Germany - Stuttgart
Old 08-05-2011 , 11:11   Re: SDK Hooks 2.0 - It's beta time again!
#1521

PHP Code:
#include <smlib>
[...]
if ( 
Client_IsValid(attacker) &&
Client_IsValid(victim) &&
GetClientFrags(attacker) >= GetMaxFrags() &&
GetClientTeam(attacker) != GetClientTeam(victim)
) { 
Link to the smlib thread in my sig. :-)
__________________
[ SourceModPlugins.org ][ My Plugins ]

Thank you for donations: [ Paypal ]

Video Tutorial (German): [ Gameserver & SourceMod Plugins mit HLSW verwalten ]
Chanz is offline
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 08-05-2011 , 11:17   Re: SDK Hooks 2.0 - It's beta time again!
#1522

Why? Clients indexes is in range from 1 to 64. Or no?
PS. This is macro: #define IsClient(%1) (0 < %1 < 65)
Yeah=} is offline
psychonic

BAFFLED
Join Date: May 2008
Old 08-05-2011 , 11:21   Re: SDK Hooks 2.0 - It's beta time again!
#1523

Quote:
Originally Posted by Yeah=} View Post
Why? Clients indexes is in range from 1 to 64. Or no?
PS. This is macro: #define IsClient(%1) (0 < %1 < 65)

Sorry, been brainwashed by TF2 (capped at 32 players). I tend to forget that CS:S can go to 64.

Still, being in that range doesn't mean that there's a client connected and occupying that entity ( "ingame" ). You want to use the special MaxClients variable as the upper bound (inclusive), and also check IsClientInGame.

Quote:
Originally Posted by Chanz View Post
PHP Code:
#include <smlib>
[...]
if ( 
Client_IsValid(attacker) &&
Client_IsValid(victim) &&
GetClientFrags(attacker) >= GetMaxFrags() &&
GetClientTeam(attacker) != GetClientTeam(victim)
) { 
Link to the smlib thread in my sig. :-)
Why include a huge library for a simple check?
psychonic is offline
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 08-05-2011 , 11:24   Re: SDK Hooks 2.0 - It's beta time again!
#1524

I have replaced 64 to MaxClients.
PS. Event can't be called if client is not in game :C
Yeah=} is offline
psychonic

BAFFLED
Join Date: May 2008
Old 08-05-2011 , 11:29   Re: SDK Hooks 2.0 - It's beta time again!
#1525

Quote:
Originally Posted by Yeah=} View Post
I have replaced 64 to MaxClients.
PS. Event can't be called if client is not in game :C
The victim is guaranteed to be a valid entity since that is what the function is being called as a member of. Attacker and inflictor should be valid (and/or 0 for world), but i'm not sure offhand what happens for example what would show if someone tosses a grenade and then leaves before it explodes.
psychonic is offline
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 08-05-2011 , 11:31   Re: SDK Hooks 2.0 - It's beta time again!
#1526

Ok, thanks.
Yeah=} is offline
Chanz
Veteran Member
Join Date: Aug 2008
Location: Germany - Stuttgart
Old 08-05-2011 , 11:33   Re: SDK Hooks 2.0 - It's beta time again!
#1527

Quote:
Originally Posted by psychonic View Post
[...] Why include a huge library for a simple check?
I don't think we should discuss that in this thread. But Yeah=}'s plugin is called bonuse.smx. I guess its not a small plugin, so using the SMLib may help him with other problems too...
__________________
[ SourceModPlugins.org ][ My Plugins ]

Thank you for donations: [ Paypal ]

Video Tutorial (German): [ Gameserver & SourceMod Plugins mit HLSW verwalten ]
Chanz is offline
Yeah=}
Member
Join Date: Apr 2010
Location: Ural, Russia
Old 08-05-2011 , 12:10   Re: SDK Hooks 2.0 - It's beta time again!
#1528

Quote:
Originally Posted by Chanz View Post
I don't think we should discuss that in this thread. But Yeah=}'s plugin is called bonuse.smx. I guess its not a small plugin, so using the SMLib may help him with other problems too...
This is a module of my DeathRun plugin. And I have used your library in the main plugin, thanks for your work! =)
Yeah=} is offline
Nail
BANNED
Join Date: May 2008
Location: PetrovЪ GradЪ
Old 08-05-2011 , 16:08   Re: SDK Hooks 2.0 - It's beta time again!
#1529

PHP Code:
    ...
    new 
ent CreateEntityByName("prop_dynamic_override");
    ...
    
SDKHookEx(entSDKHook_ShouldCollideOnCollide);    
}
public 
bool:OnCollide(entitycollisiongroupcontentsMaskbool:result)
{
    
//ent = entity, but client = ????? perhaps client == contentsMask?

On the server, two players
client = 1 and client = 2. I need to turn off ent collision for client = 1. How can I do?

Dump resultsz: entity=280 collisiongroup=8 contentsmask=33636363 result=1. So contentsmask - wtf is it? I do not see where is id the player who collide with ent?

Last edited by Nail; 08-05-2011 at 16:19.
Nail is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 08-05-2011 , 18:05   Re: SDK Hooks 2.0 - It's beta time again!
#1530

Quote:
Originally Posted by psychonic View Post
No. That's not how ShouldCollide works.

All of the information available is already passed. It is a check to see if, based on a given collision group and mask, whether or not the there should or would be a collision. There isn't necessary another entity potentially being collided with, and when there is, ShouldCollide does not know nor care. It is just a basic check using the aforementioned info.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami 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 04:06.


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