Raised This Month: $ Target: $400
 0% 

Specific player can touch only specific entity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Bladell
Senior Member
Join Date: Jun 2012
Old 06-19-2014 , 05:21   Specific player can touch only specific entity
Reply With Quote #1

I have this plugin
PHP Code:
/*
Name: [ZP] Addon: Bonus Box
Author: PomanoB & STRELOK
Version 1.0

Based on [ZP] DM Item's by PomanoB
*/
#include <superheromod>
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>

#define PLUGIN "[ZP] Addon: Bonus Box"
#define VERSION "1.0"
#define AUTHOR "PomanoB & Accelerator"

new const item_class_name[] = "dm_item"

new g_models[][] = {"models/shero/presents.mdl"}

public 
plugin_precache()
{
    for (new 
0sizeof g_modelsi++)
        
precache_model(g_models[i])    
}


public 
round_start()
{
    new 
ent FM_NULLENT
    
static string_class[] = "classname"
    
while ((ent engfunc(EngFunc_FindEntityByStringentstring_classitem_class_name))) 
        
set_pev(entpev_flagsFL_KILLME)
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_Touch"fwd_Touch")
    
    
register_event("HLTV""round_start""a""1=0""2=0")
    
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
    
register_dictionary("bonus_box.txt")
}

public 
show_hud()
{
    new 
Player[32], playerCount
    
    get_players
(PlayerplayerCount"c")
    
    
set_hudmessage(225000.990.15clamp(102), 6.01800.06.06.0, -1)
    
    for(new 
id=1id <= playerCountid++)
    {
        if(!
is_user_alive(Player[id]))
            
ShowSyncHudMsg(Player[id], CreateHudSyncObj(), "Bonus boxes event!")
    }
}

public 
fwd_Touch(touchertouched)
{
    if (!
is_user_alive(toucher) || !pev_valid(touched))
        return 
FMRES_IGNORED
    
    
new classname[32]    
    
pev(touchedpev_classnameclassname31)
    if (!
equal(classnameitem_class_name))
        return 
FMRES_IGNORED
    
    
    
    shgive_item
(toucher)
    
set_pev(touchedpev_effectsEF_NODRAW)
    
set_pev(touchedpev_solidSOLID_NOT)
    
    return 
FMRES_IGNORED
    
}

public 
fw_PlayerKilled(victimattackershouldgib)
{
    if (!
is_user_connected(attacker) || !is_user_connected(victim) || attacker == victim || !attacker)
        return 
HAM_IGNORED
    
    
    
new random random_num(09)
    
    new 
hour[3]
    
    
get_time("%H"hour2)
    
    if(
str_to_num(hour) == 20)
    {
        if (
random <= 5)
        {
            new 
origin[3]
            
get_user_origin(victimorigin0)
            
            
addItem(origin)
            
            if(!
task_exists(2212))
                
set_task(1.0"show_hud"2212__"b")
        }
    }
    else if(
random == 5)
    {
        new 
origin[3]
        
get_user_origin(victimorigin0)
        
        
addItem(origin)
        
        if(
task_exists(2212))
            
remove_task(2212)
    }
        
    return 
HAM_IGNORED
}

public 
removeEntity(ent)
{
    if (
pev_valid(ent))
        
engfunc(EngFunc_RemoveEntityent)
}

public 
addItem(origin[3])
{
    new 
ent fm_create_entity("info_target")
    
set_pev(entpev_classnameitem_class_name)
    
    
engfunc(EngFunc_SetModel,entg_models[random_num(0sizeof g_models 1)])

    
set_pev(ent,pev_mins,Float:{-10.0,-10.0,0.0})
    
set_pev(ent,pev_maxs,Float:{10.0,10.0,25.0})
    
set_pev(ent,pev_size,Float:{-10.0,-10.0,0.0,10.0,10.0,25.0})
    
engfunc(EngFunc_SetSize,ent,Float:{-10.0,-10.0,0.0},Float:{10.0,10.0,25.0})

    
set_pev(ent,pev_solid,SOLID_BBOX)
    
set_pev(ent,pev_movetype,MOVETYPE_FLY)
    
    new 
Float:fOrigin[3]
    
IVecFVec(originfOrigin)
    
set_pev(entpev_originfOrigin)
    
    
set_pev(ent,pev_renderfx,kRenderFxGlowShell)
    switch(
random_num(1,4))
    {
        case 
1set_pev(ent,pev_rendercolor,Float:{0.0,0.0,255.0})
        case 
2set_pev(ent,pev_rendercolor,Float:{0.0,255.0,0.0})
        case 
3set_pev(ent,pev_rendercolor,Float:{255.0,0.0,0.0})
        case 
4set_pev(ent,pev_rendercolor,Float:{255.0,255.0,255.0})
    }

When somebody dies a box is let behind and if someone touch it will receive something. It want to change this plugin... only the player who killed the victim can touch the box left by victim and receive the bonus, or at least the toucher id team != victim id team

I know that function shgive_item is missing, there is nothing that I could change to make this plugin as I want.
Bladell 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 21:16.


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