Raised This Month: $ Target: $400
 0% 

How To Prevent A Player From Beying Killed From A Triggerd Event?


Post New Thread Reply   
 
Thread Tools Display Modes
Zylius
SourceMod Donor
Join Date: Nov 2009
Old 06-11-2012 , 03:22   Re: How To Prevent A Player From Beying Killed From A Triggerd Event?
Reply With Quote #21

Quote:
Originally Posted by C0nw0nk View Post
PHP Code:
public OnPluginStart()
{    
    
HookUserMessage(GetUserMessageId("TextMsg"), UserMessageHooktrue);
}
public 
Action:UserMessageHook(UserMsg:MsgIdHandle:hBitBuffer, const iPlayers[], iNumPlayersbool:bReliablebool:bInit) {
    
BfReadByte(hBitBuffer);
    
BfReadByte(hBitBuffer);
    
decl String:strMessage[1024];
    
BfReadString(hBitBufferstrMessagesizeof(strMessage));
    if (
StrEqual(strMessage"before trying to switch")) return Plugin_Handled;
    return 
Plugin_Handled;

So this is what it should look like ?

Fixed it thanks berni <3

EDIT :// More issues caused now all sourcemod plugin and other outputs such as "nextmap" etc do not work...
Cause you are returning Plugin_Handled either way...
Should be return Plugin_Continue at the end.
Zylius is offline
C0nw0nk
Senior Member
Join Date: May 2011
Location: United Kingdom
Old 06-11-2012 , 04:57   Re: How To Prevent A Player From Beying Killed From A Triggerd Event?
Reply With Quote #22

Still does not solve the issue because with plugin_continue it actualy does nothing does not remove the message at all with plugin_handled it does remove it but also remove's all of sourcemod's output.
C0nw0nk is offline
Send a message via MSN to C0nw0nk
Zylius
SourceMod Donor
Join Date: Nov 2009
Old 06-11-2012 , 05:45   Re: How To Prevent A Player From Beying Killed From A Triggerd Event?
Reply With Quote #23

Quote:
Originally Posted by C0nw0nk View Post
Still does not solve the issue because with plugin_continue it actualy does nothing does not remove the message at all with plugin_handled it does remove it but also remove's all of sourcemod's output.
Because the strings aren't equal....
Use StrContains.
Zylius is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 06-11-2012 , 05:55   Re: How To Prevent A Player From Beying Killed From A Triggerd Event?
Reply With Quote #24

well now you know that TextMsg is the right usermessage, the rest (proper string comparison and returns) is up to you
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
C0nw0nk
Senior Member
Join Date: May 2011
Location: United Kingdom
Old 06-11-2012 , 06:48   Re: How To Prevent A Player From Beying Killed From A Triggerd Event?
Reply With Quote #25

PHP Code:
public OnPluginStart() 
{     
    
HookUserMessage(GetUserMessageId("TextMsg"), UserMessageHooktrue); 

public 
Action:UserMessageHook(UserMsg:MsgIdHandle:hBitBuffer, const iPlayers[], iNumPlayersbool:bReliablebool:bInit) { 
    
BfReadByte(hBitBuffer); 
    
BfReadByte(hBitBuffer); 
    
decl String:strMessage[1024]; 
    
BfReadString(hBitBufferstrMessagesizeof(strMessage)); 
    if (
StrContains(strMessage"before trying to switch")) return Plugin_Continue
    return 
Plugin_Continue

Replaced both plugin_handle's with plugin_continue aswell as replacing the string equal with string contains and still no success

It's no map output and no other plugin or extension output it is part of the game i think trying to force me onto another team but failing so it floods my chat box with this message highly frustrating when you pay attention to it lol.

Last edited by C0nw0nk; 06-11-2012 at 06:51.
C0nw0nk is offline
Send a message via MSN to C0nw0nk
Zylius
SourceMod Donor
Join Date: Nov 2009
Old 06-11-2012 , 08:10   Re: How To Prevent A Player From Beying Killed From A Triggerd Event?
Reply With Quote #26

Quote:
Originally Posted by C0nw0nk View Post
PHP Code:
public OnPluginStart() 
{     
    
HookUserMessage(GetUserMessageId("TextMsg"), UserMessageHooktrue); 

public 
Action:UserMessageHook(UserMsg:MsgIdHandle:hBitBuffer, const iPlayers[], iNumPlayersbool:bReliablebool:bInit) { 
    
BfReadByte(hBitBuffer); 
    
BfReadByte(hBitBuffer); 
    
decl String:strMessage[1024]; 
    
BfReadString(hBitBufferstrMessagesizeof(strMessage)); 
    if (
StrContains(strMessage"before trying to switch")) return Plugin_Continue
    return 
Plugin_Continue

Replaced both plugin_handle's with plugin_continue aswell as replacing the string equal with string contains and still no success

It's no map output and no other plugin or extension output it is part of the game i think trying to force me onto another team but failing so it floods my chat box with this message highly frustrating when you pay attention to it lol.
The first one should be plugin_handled...
Zylius is offline
C0nw0nk
Senior Member
Join Date: May 2011
Location: United Kingdom
Old 06-11-2012 , 08:40   Re: How To Prevent A Player From Beying Killed From A Triggerd Event?
Reply With Quote #27

Quote:
Originally Posted by Zylius View Post
The first one should be plugin_handled...
Does not make a diffrence still i did compile and test the plugin's both way's
C0nw0nk is offline
Send a message via MSN to C0nw0nk
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 06-11-2012 , 09:10   Re: How To Prevent A Player From Beying Killed From A Triggerd Event?
Reply With Quote #28

StrContains
Read and understand your reading...
Quote:
Return:
-1 on failure (no match found). Any other value indicates a position in the string where the match starts.
PHP Code:
   if(StrContains(strMessage"before trying to switch") != -1)
   {
      return 
Plugin_Handled;
   }
   return 
Plugin_Continue
Bacardi is offline
Reply



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 05:47.


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