Raised This Month: $ Target: $400
 0% 

Grab weapons from ground (not only players)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CuLLi
BANNED
Join Date: Apr 2009
Location: Romania (piratebay) C
Old 05-22-2009 , 08:41   Grab weapons from ground (not only players)
Reply With Quote #1

The grab script for edit:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

#define KZ_LEVEL ADMIN_KICK        // Adminlevel
#define MIN_DIST 70.0
#define THROW_POWER 1500

new grab[32]
new 
Float:grabdistance[32]
new 
bool:grabsearch[32]
new 
MaxPlayers;

public 
plugin_init() {
    
register_plugin("ProKreedzGrab","1.0","p4ddY")
    
    
register_clcmd("+grab","grab_on",KZ_LEVEL)
    
register_clcmd("-grab","grab_off",KZ_LEVEL)
    
    
register_event("DeathMsg","deathmsg","a")
    
register_event("ResetHUD","resethud","be")
    
    
MaxPlayers get_maxplayers();
}

// =================================================================================================

public grab_on(id,level,cid) {
    if(!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED
    
    grabsearch
[id-1] = true
    
    
return PLUGIN_HANDLED
}

public 
grab_off(id,level,cid) {
    if(!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED
    
    grabsearch
[id-1] = false
    grab
[id-1] = 0
    
    
return PLUGIN_HANDLED
}

// =================================================================================================

public grab_player(id,target) {
    
grab[id-1] = target
    grabsearch
[id-1] = false
    
new Float:origin1[3], Float:origin2[3]
    
entity_get_vector(id,EV_VEC_origin,origin1)
    
entity_get_vector(target,EV_VEC_origin,origin2)
    
grabdistance[id-1] = get_distance_f(origin1,origin2)
                
    new 
name[32]
    
get_user_name(target,name,31)
    
client_print(id,print_chat,"[Grab] %s",name)
    
    if(
callfunc_begin("detect_cheat","prokreedz.amxx") == 1) {
        
callfunc_push_int(target)
        
callfunc_push_str("Grab")
        
callfunc_end()
    }
}

// =================================================================================================

public is_user_grabbed(id) {
    for(new 
i=0;i<32;i++) {
        if(
grab[i] == id)
            return (
i+1)
    }
    
    return -
1
}

// =================================================================================================

public client_PreThink(id) {
    new 
buttons entity_get_int(id,EV_INT_button)
    
    if(
grabsearch[id-1] == true) {
        new 
aimidaimbody
        
if(get_user_aiming(id,aimid,aimbody) != 0.0 && aimid != 0) {
            new 
targetclass[16]
            
entity_get_string(aimid,EV_SZ_classname,targetclass,16)
            if(
equal(targetclass,"player")) {
                if(
is_user_grabbed(aimid) == -1)
                    
grab_player(id,aimid)
                else {
                    
client_print(id,print_chat,"[Grab] Ii deja grabat")
                    
grabsearch[id-1] = false
                
}
            }
        }
    }
    
    if(
grab[id-1] > 0) { // Took this from JediGrap by KCE
        
new Float:origin1[3], Float:origin2[3], ilook[3], Float:look[3], Float:direction[3], Float:moveto[3], Float:grabbedorigin[3], Float:velocity[3], Float:length
        get_user_origin
(id,ilook,3)
        
IVecFVec(ilook,look)
        
entity_get_vector(grab[id-1],EV_VEC_origin,grabbedorigin)

        
entity_get_vector(id,EV_VEC_origin,origin1)
        
entity_get_vector(grab[id-1],EV_VEC_origin,origin2)

        
direction[0] = look[0] - origin1[0]
        
direction[1] = look[1] - origin1[1]
        
direction[2] = look[2] - origin1[2]
        
length get_distance_f(look,origin1)
        if(!
length)
            
length 1.0 // avoid division by 0

        
moveto[0] = origin1[0] + direction[0] * grabdistance[id-1] / length
        moveto
[1] = origin1[1] + direction[1] * grabdistance[id-1] / length
        moveto
[2] = origin1[2] + direction[2] * grabdistance[id-1] / length

        velocity
[0] = (moveto[0] - origin2[0]) * 8
        velocity
[1] = (moveto[1] - origin2[1]) * 8
        velocity
[2] = (moveto[2] - origin2[2]) * 8

        entity_set_vector
(grab[id-1],EV_VEC_velocity,velocity)
        
        
// Push and Pull
        
if(buttons&IN_ATTACK) {
            
entity_set_int(id,EV_INT_button,buttons&~IN_ATTACK)
            
grabdistance[id-1] += 7
        
}
        else if(
buttons&IN_ATTACK2) {
            
entity_set_int(id,EV_INT_button,buttons&~IN_ATTACK2)
            
grabdistance[id-1] -= 7
            
if(grabdistance[id-1] < MIN_DIST)
                
grabdistance[id-1] = MIN_DIST
        
}
        else if(
buttons&IN_JUMP) {
            
entity_set_int(id,EV_INT_button,buttons&~IN_JUMP)
            
            
VelocityByAim(id,THROW_POWER,velocity)
            
entity_set_vector(grab[id-1],EV_VEC_velocity,velocity)
            
            
grab[id-1] = 0
        
}
    }
    
    if(
is_user_grabbed(id) != -1)
        
entity_set_int(id,EV_INT_button,buttons&~IN_MOVELEFT&~IN_MOVERIGHT&~IN_FORWARD&~IN_BACK&~IN_JUMP// Stop sucking :o
}

// =================================================================================================

public deathmsg() {
    new 
attacker read_data(1// attacker
    
new victim read_data(2)
    
    if (!
attacker || attacker MaxPlayers)
    return;

    
grab[attacker-1] = 0
    grabsearch
[attacker-1] = false
    
    
new pid is_user_grabbed(victim)
    if(
pid != -1)
        
grab[pid-1] = 0
}

public 
resethud(id) {
    new 
pid is_user_grabbed(id)
    if(
pid != -1) {
        
grab[pid-1] = 0
    
}
    
    
grab[id-1] = 0
    grabsearch
[id-1] = false
}

// =================================================================================================

public client_disconnect(id) {
    
grabsearch[id-1] = false
    grab
[id-1] = 0
}

public 
client_putinserver(id) {
    
grabsearch[id-1] = false
    grab
[id-1] = 0
}

// You reached the end of file
// This plugin was made by p4ddY :)
// Credits to KCE 

Last edited by CuLLi; 05-23-2009 at 01:35.
CuLLi is offline
CuLLi
BANNED
Join Date: Apr 2009
Location: Romania (piratebay) C
Old 05-23-2009 , 01:40   Re: Grab weapons from ground (not only players)
Reply With Quote #2

^ UP
CuLLi is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 05-23-2009 , 02:53   Re: Grab weapons from ground (not only players)
Reply With Quote #3

"[Grab] Ii deja grabat")



lol
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
mplayerexe
Senior Member
Join Date: Dec 2008
Old 05-23-2009 , 03:39   Re: Grab weapons from ground (not only players)
Reply With Quote #4

Quote:
Originally Posted by tuty View Post
"[Grab] Ii deja grabat")



lol
hahaah grabat )
__________________
mplayerexe is offline
CuLLi
BANNED
Join Date: Apr 2009
Location: Romania (piratebay) C
Old 05-23-2009 , 03:56   Re: Grab weapons from ground (not only players)
Reply With Quote #5

Da cum sai spun??

tuty numa potzi ajuta??

weaponu are alt velocity decat playerii? (sau nush c)
CuLLi is offline
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 05-23-2009 , 05:08   Re: Grab weapons from ground (not only players)
Reply With Quote #6

Grab+ already has this
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
mplayerexe
Senior Member
Join Date: Dec 2008
Old 05-23-2009 , 05:27   Re: Grab weapons from ground (not only players)
Reply With Quote #7

Quote:
Originally Posted by CuLLi View Post
Da cum sai spun??

tuty numa potzi ajuta??

weaponu are alt velocity decat playerii? (sau nush c)
grab - a ridica .. ridicat
__________________
mplayerexe is offline
CuLLi
BANNED
Join Date: Apr 2009
Location: Romania (piratebay) C
Old 05-23-2009 , 05:30   Re: Grab weapons from ground (not only players)
Reply With Quote #8

Quote:
Grab entities other than players, such as bombs, weapons, and hostages.
i want this in the grab script that i posted

+karma =))
CuLLi 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:13.


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