Raised This Month: $ Target: $400
 0% 

Entity Grabbing plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-10-2010 , 17:58   Re: Entity Grabbing plugin
Reply With Quote #2

PHP Code:
public cmdGrab(id)
{
    
//get the entity the player is aiming at and the length
    
new body;
    new 
Float:vGrabbedOrigin[3];
    new 
Float:vOrigin[3];
    new 
Float:vOffset[3];
    
    
gfGrablength[id] = get_user_aiming(idiEntitybody);
    
    
//get who is currently grabbing the entity (if anyone)
    
new grabber entity_get_int(iEntityEV_INT_iuser2);
    
    
//if entity is not being grabbed by someone else
    
if (grabber == || grabber == id)
    {
        
//get origin of the block
        
entity_get_vector(iEntityEV_VEC_originvGrabbedOrigin);
        
        
//calculate offset from grabbed block
        
vOffset[0] = vGrabbedOrigin[0] - vOrigin[0];
        
vOffset[1] = vGrabbedOrigin[1] - vOrigin[1];
        
vOffset[2] = vGrabbedOrigin[2] - vOrigin[2];
        
        
//indicate that entity is being grabbed
        
entity_set_int(iEntityEV_INT_iuser2id);
        
client_print(idprint_chat"test")
    }
    return 
PLUGIN_HANDLED;


PHP Code:
public cmdGrab(id)
{
    
//get the entity the player is aiming at and the length
    
new body;
    new 
Float:vGrabbedOrigin[3];
    new 
Float:vOrigin[3];
    new 
Float:vOffset[3];
    
    
gfGrablength[id] = get_user_aiming(idiEntitybody);
    
    
//check valid entity
    
if (!is_valid_ent(iEntity))
        return 
PLUGIN_HANDLED;
    
    
//get who is currently grabbing the entity (if anyone)
    
new grabber entity_get_int(iEntityEV_INT_iuser2);
    
    
//if entity is not being grabbed by someone else
    
if (grabber == || grabber == id)
    {
        
setGrabbed(id)
        
client_print(idprint_chat"test")
    }
    return 
PLUGIN_HANDLED;

Also, none of that code is mine lol.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 03:56.


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