Raised This Month: $ Target: $400
 0% 

origin, angles and touch optimisation


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Jack86
Veteran Member
Join Date: Dec 2008
Location: Belgrade, Serbia
Old 01-01-2010 , 09:29   Re: origin and angles
Reply With Quote #4

Ok, tnx. I have 2 more q, is sound emitted with client_cmd( id , spk...) heard by everyone or just that player, and is it ok to remove is_valid_ent check if i change

PHP Code:
public pfn_touch(ptr,ptd) {
    if(!
is_valid_ent(ptd)) { // invalid toucher
        
return PLUGIN_CONTINUE;
    }
    
    
// now check for more invalid entities or players
    
if(!is_valid_ent(ptr) || !is_valid_ent(ptd) || !is_user_connected(ptd)) {
        return 
PLUGIN_CONTINUE;
    }

    new 
classname[32];
    
entity_get_string(ptr,EV_SZ_classname,classname,31); // get name of touched
    
    
if(equal(classname,g_ent_classname)) {
        
// ASSIGN OWNER TO QUAD
        
g_quad_owner ptd 
        
        
// REMOVE ENTRY
        
remove_entity(ptr);
        
        
// enable quad for user
        
quad_enable(ptd);
        return 
PLUGIN_CONTINUE;
    }    
    return 
PLUGIN_CONTINUE;

with

PHP Code:
register_touch("dm_quad","player","touched")

public 
touched(quad,id)
{
    if(!
is_valid_ent(quad) || !is_valid_ent(id) || !is_user_connected(id))
    {
        return 
PLUGIN_CONTINUE;
    }
    
// ASSIGN OWNER TO QUAD
    
g_quad_owner id 
        
    
// REMOVE ENTRY
    
remove_entity(quad);
        
    
// enable quad for user
    
quad_enable(id);
    return 
PLUGIN_CONTINUE;


__________________

Jack86 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 04:16.


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