Raised This Month: $ Target: $400
 0% 

[L4D2]Entity touch problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
y1pen
Junior Member
Join Date: Feb 2014
Old 08-27-2015 , 20:50   [L4D2]Entity touch problem
Reply With Quote #1

Hello , I want my players to hit the set of objects to work.
But it is not working.
Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public OnClientPutInServer(Client)
{
	new String:class[32];
	GetEdictClassname(Client, class, 32);
	if(StrContains(class, "models/props_interiors/dining_table_round.mdl", false) != -1 
	|| StrContains(class, "models/props_fairgrounds/amp_plexi.mdl", false) != -1 )
	{
		SDKHook(Client, SDKHook_Touch, Start_Touch);
	}
}

public Start_Touch(client, other)
{
	if(!IsClientInGame(other))return;
	
	PrintToChatAll("TEST");
}
If you can help me thank you very much !!!
Although my English is not very good.
y1pen is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 08-27-2015 , 21:01   Re: [L4D2]Entity touch problem
Reply With Quote #2

Try something like this
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public OnEntityCreated(entity, const String:classname[])
{
    if (
StrEqual(classname"prop_SOMETHING")) {
        new 
String:model[PLATFORM_MAX_PATH];
        
GetEntPropString(entityProp_Data"m_ModelName"modelsizeof(model))
        
        if (
StrEqual(model"models/props_interiors/dining_table_round.mdl"false) || StrEqual(model"models/props_fairgrounds/amp_plexi.mdl"false)) {
            
SDKHook(ClientSDKHook_TouchStart_Touch);
        }
    }


public 
Action:Start_Touch(propclient)
{
    if (
client || client MaxClients || !IsClientInGame(client)) {
        return 
Plugin_Continue;
    }
    
    
PrintToChatAll("TEST %N"client);
    
    return 
Plugin_Continue;

KissLick is offline
y1pen
Junior Member
Join Date: Feb 2014
Old 08-27-2015 , 21:32   Re: [L4D2]Entity touch problem
Reply With Quote #3

Quote:
Originally Posted by KissLick View Post
Try something like this
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public OnEntityCreated(entity, const String:classname[])
{
    if (
StrEqual(classname"prop_SOMETHING")) {
        new 
String:model[PLATFORM_MAX_PATH];
        
GetEntPropString(entityProp_Data"m_ModelName"modelsizeof(model))
        
        if (
StrEqual(model"models/props_interiors/dining_table_round.mdl"false) || StrEqual(model"models/props_fairgrounds/amp_plexi.mdl"false)) {
            
SDKHook(ClientSDKHook_TouchStart_Touch);
        }
    }


public 
Action:Start_Touch(propclient)
{
    if (
client || client MaxClients || !IsClientInGame(client)) {
        return 
Plugin_Continue;
    }
    
    
PrintToChatAll("TEST %N"client);
    
    return 
Plugin_Continue;

Thank you for your reply , but when I touch the objects when not working.
But still thank you for your reply .
y1pen is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 08-28-2015 , 05:13   Re: [L4D2]Entity touch problem
Reply With Quote #4

And did you edit
PHP Code:
if (StrEqual(classname"prop_SOMETHING")) 
to your needs?
What prop entities you are trying to hook touch with?
KissLick is offline
y1pen
Junior Member
Join Date: Feb 2014
Old 08-28-2015 , 17:44   Re: [L4D2]Entity touch problem
Reply With Quote #5

Quote:
Originally Posted by KissLick View Post
And did you edit
PHP Code:
if (StrEqual(classname"prop_SOMETHING")) 
to your needs?
What prop entities you are trying to hook touch with?
I was through this plugin: https://forums.alliedmods.net/showthread.php?p=1186503
Made out of static entity , but touch still is not working.

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public OnEntityCreated(entity, const String:classname[])
{
    if (
StrEqual(classname"prop_dynamic")) 
    {
        new 
String:model[PLATFORM_MAX_PATH];
        
GetEntPropString(entityProp_Data"m_ModelName"modelsizeof(model))
        
        if (
StrEqual(model"models/props_interiors/dining_table_round.mdl"false)
        || 
StrEqual(model"models/props_fairgrounds/amp_plexi.mdl"false)) 
        {
            
SDKHook(entitySDKHook_TouchStart_Touch);
        }
    }


public 
Action:Start_Touch(propclient)
{
    if (
client || client MaxClients || !IsClientInGame(client)) 
    {
        return 
Plugin_Continue;
    }
    
    
PrintToChatAll("TEST");
    
    return 
Plugin_Continue;

y1pen 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 18:15.


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