Raised This Month: $32 Target: $400
 8% 

Suggestion / Subplugin Request [Searching] Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ESPADONGAMING
Senior Member
Join Date: Mar 2011
Location: In the Game [ro]
Old 10-06-2011 , 06:11   [Searching] Plugin
Reply With Quote #1

How do I add aura?

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

#include <fakemeta>
#include <hamsandwich>
#include <engine>

#include <cellarray>
#include <xs>

new const model_present[][] = { "models/present/w_present.mdl","models/present/w_present2.mdl" }

#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))

#define SS_VERSION    "1.0"
#define SS_MIN_DISTANCE    500.0
#define SS_MAX_LOOPS    100000

new Array:g_vecSsOrigins
new Array:g_vecSsSpawns
new Array:g_vecSsUsed
new Float:g_flSsMinDist
new g_iSsTime

new const g_szStarts[][] = { "info_player_start""info_player_deathmatch" }
new const 
Float:g_flOffsets[] = { 3500.03500.01500.0 }

#if cellbits == 32
const OFFSET_CSMONEY 115
#else
const OFFSET_CSMONEY 140
#endif
const OFFSET_LINUX  5
        
new pcvar_respawn_timepcvar_presents_on_map
new g_money
new g_bonus[33]

public 
plugin_init()
{
    
register_plugin("XMAS GIFTS""2.2""KronoS")
        
    
register_event("HLTV""spawn_gifts""a""1=0""2=0")
    
RegisterHam(Ham_Spawn"player""round_start"1)
    
RegisterHam(Ham_Killed"player""client_death"1)
        
RegisterHam(Ham_Item_PreFrame"player""FwdPreFramePost"1)
    
register_forward(FM_Touch,"forward_touch")

    
pcvar_respawn_time register_cvar("presents_respawn_time","60.0")
    
pcvar_presents_on_map register_cvar("presents_on_map""11")

    
SsInit(800.0)
    
SsScan()
    
    
g_money get_user_msgid("Money")
}

public 
plugin_precache()
{
    new 
i
    
for(0sizeof model_presenti++)
        
engfunc(EngFunc_PrecacheModel,model_present[i])
}

public 
spawn_gifts()
{
    
func_spawn()
}

public 
round_start(id)
{
    if(
g_bonus[id] > 0)
    {
        switch(
g_bonus[id])
        {
            case 
1:
            {
                
fm_set_user_health(idget_user_health(id) + 50)
            }
            case 
2:
            {
                
fm_set_user_gravity(id0.4)
            }
        }
    }
}

public 
func_spawn()
{
        new 
Float:origin[3]
    new 
i

    
for(i=0iget_pcvar_num(pcvar_presents_on_map); i++)
    {
        if(
SsGetOrigin(origin))
        {
                new 
ent engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
                if(
pev_valid(ent))
                {
                        
engfunc(EngFunc_SetModel,ent,model_present[random_num(0,sizeof model_present 1)])
                        
engfunc(EngFunc_SetOriginentorigin)
            static 
Float:fMaxs[3] = { 2.02.04.0 }
            static 
Float:fMins[3] = { -2.0, -2.0, -4.0 }
            
set_pev(ent,pev_solid,SOLID_BBOX)
            
engfunc(EngFunc_SetSize,ent,fMins,fMaxs)
            
engfunc(EngFunc_DropToFloorent)

            switch(
random_num(0,1))
            {
                case 
0:
                {
                    
set_pev(ent,pev_classname,"small_present")
                }
                case 
1:
                {
                    
set_pev(ent,pev_classname,"large_present")
                }
            }
                }
        }
    }
}

public 
client_death(id)
{
    if(
g_bonus[id] > 0)
    {
        
g_bonus[id] = 0
    
}
}

public 
FwdPreFramePost(iClient)
{
    if(
is_user_connected(iClient))
    {
        if(
g_bonus[iClient] == 3)
        {
                
fm_set_user_maxspeed(iClient350.0)
        }
        if(
g_bonus[iClient] == 4)
        {
                
fm_set_user_maxspeed(iClient200.0)
        }
    }
}  

public 
forward_touch(ent,id)
{
    if(!
pev_valid(ent))
        return 
FMRES_IGNORED
    
    
static class[20]
    
    
pev(ent,pev_classname,class,sizeof class - 1)
    
    if((!
equali(class,"small_present") && !equali(class,"large_present")))
        return 
FMRES_IGNORED

    
if((equali(class,"large_present") && (g_bonus[id] > 0)))
        return 
FMRES_IGNORED
    
    
if(!is_user_alive(id))
        return 
FMRES_IGNORED
    
    set_pev
(ent,pev_solid,SOLID_NOT)
    
set_pev(ent,pev_effects,EF_NODRAW)
    
set_task(get_pcvar_float(pcvar_respawn_time), "func_spawn"ent)
    
    if(
equali(class,"small_present"))
    {
    switch(
random_num(0,4))
    {
        case 
0
        {
            
fm_set_user_money(idfm_get_user_money(id) + 500)
            
set_hudmessage(25516500.020.7306.012.0)
            
show_hudmessage(id"[XMAS Gift] Mosul ti-a oferit 500$")
        }
        case 
1:
        {
            
fm_set_user_money(id16000)
            
set_hudmessage(25516500.020.7306.012.0)
            
show_hudmessage(id"[XMAS Gift] Mosul ti-a oferit 16000$")
        }
        case 
2:
        {
            
fm_set_user_money(id0)
            
set_hudmessage(25516500.020.7306.012.0)
            
show_hudmessage(id"[XMAS Gift] Mosul ti-a furat toti banii")
        }
        case 
3:
        {
            
fm_set_user_money(idfm_get_user_money(id) - 500)
            
set_hudmessage(25516500.020.7306.012.0)
            
show_hudmessage(id"[XMAS Gift] Mosul ti-a furat 500$")
        }
        case 
4:
        {
            
fm_give_item(id"weapon_awp")
            
set_hudmessage(25516500.020.7306.012.0)
            
show_hudmessage(id"[XMAS Gift] Mosul ti-a oferit un AWP")
        }
    }
    }
    if(
equali(class,"large_present"))
    {
    switch(
random_num(0,3))
    {
        case 
0
        {
            
fm_set_user_health(idget_user_health(id) + 50)
            
g_bonus[id] = 1
            large_present_hud
(id)
        }
        case 
1:
        {
            
fm_set_user_gravity(id0.4)
            
g_bonus[id] = 2
            large_present_hud
(id)
        }
        case 
2:
        {
            
fm_set_user_maxspeed(id350.0)
            
g_bonus[id] = 3
            large_present_hud
(id)
        }
        case 
3:
        {
            
fm_set_user_maxspeed(id200.0)
            
g_bonus[id] = 4
            large_present_hud
(id)
        }
    }
    }
    
    return 
FMRES_IGNORED
}

public 
large_present_hud(id)
{
    if(
is_user_alive(id))
    {
        if(
g_bonus[id] > 0)
        {
            switch(
g_bonus[id])
            {
                case 
1:
                {
                    
set_hudmessage(025500.020.7306.012.0)
                    
show_hudmessage(id"[XMAS Gift] Viata+")
                }
                case 
2:
                {
                    
set_hudmessage(025500.020.7306.012.0)
                    
show_hudmessage(id"[XMAS Gift] Gravitatie-")
                }
                case 
3:
                {
                    
set_hudmessage(025500.020.7306.012.0)
                    
show_hudmessage(id"[XMAS Gift] Viteza+")
                }
                case 
4:
                {
                    
set_hudmessage(200000.020.7306.012.0)
                    
show_hudmessage(id"[XMAS Gift] Viteza-")
                }
            }
            
set_task(12.0"large_present_hud"id)
        }
    }
}

public 
client_disconnect(id)
{
    
g_bonus[id] = 0
}

stock fm_set_user_money(id,money,flash=1)
{
    
set_pdata_int(id,OFFSET_CSMONEY,money,OFFSET_LINUX)

    
message_begin(MSG_ONE,g_money,{0,0,0},id)
    
write_long(money)
    
write_byte(flash)
    
message_end()
}

stock fm_get_user_money(id)
{
    return 
get_pdata_int(id,OFFSET_CSMONEY,OFFSET_LINUX)
}

stock fm_set_user_health(idhealth)
{
    (
health 0) ? set_pev(idpev_healthfloat(health)) : dllfunc(DLLFunc_ClientKillid)

    return 
1
}

stock fm_give_item(index, const item[]) {
    if (!
equal(item"weapon_"7) && !equal(item"ammo_"5) && !equal(item"item_"5) && !equal(item"tf_weapon_"10))
        return 
0

    
new ent fm_create_entity(item)
    if (!
pev_valid(ent))
        return 
0

    
new Float:origin[3]
    
pev(indexpev_originorigin)
    
set_pev(entpev_originorigin)
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN)
    
dllfunc(DLLFunc_Spawnent)

    new 
save pev(entpev_solid)
    
dllfunc(DLLFunc_Touchentindex)
    if (
pev(entpev_solid) != save)
        return 
ent

    engfunc
(EngFunc_RemoveEntityent)

    return -
1
}

stock fm_set_user_gravity(indexFloat:gravity 1.0) {
    
set_pev(indexpev_gravitygravity)

    return 
1
}

stock fm_set_user_maxspeed(indexFloat:speed = -1.0) {
    
engfunc(EngFunc_SetClientMaxspeedindexspeed);
    
set_pev(indexpev_maxspeedspeed);

    return 
1;
}

public 
SsInit(Float:mindist)
{
    new 
cmd[32]
    
format(cmd15"_ss_dump%c%c%c%c"random_num('A''Z'), random_num('A''Z'), random_num('A''Z'), random_num('A''Z'))
    
register_cvar("sv_superspawns"SS_VERSION, (FCVAR_SERVER|FCVAR_SPONLY))
    
register_concmd(cmd"SsDump")

    
g_flSsMinDist mindist
    g_vecSsOrigins 
ArrayCreate(31)
    
g_vecSsSpawns ArrayCreate(31)
    
g_vecSsUsed ArrayCreate(31)
}

stock SsClean()
{
    
g_flSsMinDist 0.0
    ArrayClear
(g_vecSsOrigins)
    
ArrayClear(g_vecSsSpawns)
    
ArrayClear(g_vecSsUsed)
}

stock SsGetOrigin(Float:origin[3])
{
    new 
Float:data[3], size
    
new ok 1

    
while((size ArraySize(g_vecSsOrigins)))
    {
        new 
idx random_num(0size 1)

        
ArrayGetArray(g_vecSsOriginsidxorigin)

        new 
used ArraySize(g_vecSsUsed)
        for(new 
0usedi++)
        {
            
ok 0
            ArrayGetArray
(g_vecSsUsedidata)
            if(
get_distance_f(dataorigin) >= g_flSsMinDist)
            {
                
ok 1
                
break
            }
        }

        
ArrayDeleteItem(g_vecSsOriginsidx)
        if(
ok)
        {
            
ArrayPushArray(g_vecSsUsedorigin)
            return 
true
        
}
    }
    return 
false
}

public 
SsDump()
{
    new 
Float:origin[3]
    new 
count ArraySize(g_vecSsOrigins)
    
server_print("-------------------------------------------------------")
    for(new 
0counti++)
    {
        
ArrayGetArray(g_vecSsOriginsiorigin)
        
server_print("Origin: %f %f %f"origin[0], origin[1], origin[2])
    }
    
server_print("-------------------------------------------------------")
    
server_print("Number of origins: %i"count)
    
server_print("Time: %i"g_iSsTime)
    
server_print("-------------------------------------------------------")
}

public 
SsScan()
{
    new 
startFloat:origin[3], starttime
    starttime 
get_systime()
    for(
start 0start sizeof(g_szStarts); start++)
    {
        
server_print("Searching for %s"g_szStarts[start])
        new 
ent
        
if((ent engfunc(EngFunc_FindEntityByStringent"classname"g_szStarts[start])))
        {
            new 
counter
            pev
(entpev_originorigin)
            
ArrayPushArray(g_vecSsSpawnsorigin)
            while(
counter SS_MAX_LOOPS)
            {
                
counter GetLocation(origincounter)
            }
        }
    }
    
g_iSsTime get_systime()
    
g_iSsTime -= starttime
}

GetLocation(Float:start[3], &counter)
{
    new 
Float:end[3]
    for(new 
03i++)
    {
        
end[i] += random_float(0.0 g_flOffsets[i], g_flOffsets[i])
    }

    if(
IsValid(startend))
    {
        
start[0] = end[0]
        
start[1] = end[1]
        
start[2] = end[2]
        
ArrayPushArray(g_vecSsOriginsend)
    }
    
counter++
    return 
counter
}

IsValid(Float:start[3], Float:end[3])
{
    
SetFloor(end)
    
end[2] += 36.0
    
new point engfunc(EngFunc_PointContentsend)
    if(
point == CONTENTS_EMPTY)
    {
        if(
CheckPoints(end) && CheckDistance(end) && CheckVisibility(startend))
        {
            if(!
trace_hull(endHULL_LARGE, -1))
            {
                return 
true
            
}
        }
    }
    return 
false
}

CheckVisibility(Float:start[3], Float:end[3])
{
    new 
tr
    engfunc
(EngFunc_TraceLinestartendIGNORE_GLASS, -1tr)
    return (
get_tr2(trTR_pHit) < 0)
}

SetFloor(Float:start[3])
{
    new 
trFloat:end[3]
    
end[0] = start[0]
    
end[1] = start[1]
    
end[2] = -99999.9
    engfunc
(EngFunc_TraceLinestartendDONT_IGNORE_MONSTERS, -1tr)
    
get_tr2(trTR_vecEndPosstart)
}

CheckPoints(Float:origin[3])
{
    new 
Float:data[3], trpoint
    data
[0] = origin[0]
    
data[1] = origin[1]
    
data[2] = 99999.9
    engfunc
(EngFunc_TraceLineorigindataDONT_IGNORE_MONSTERS, -1tr)
    
get_tr2(trTR_vecEndPosdata)
    
point engfunc(EngFunc_PointContentsdata)
    if(
point == CONTENTS_SKY && get_distance_f(origindata) < 250.0)
    {
        return 
false
    
}
    
data[2] = -99999.9
    engfunc
(EngFunc_TraceLineorigindataDONT_IGNORE_MONSTERS, -1tr)
    
get_tr2(trTR_vecEndPosdata)
    
point engfunc(EngFunc_PointContentsdata)
    if(
point CONTENTS_SOLID)
        return 
false
    
    
return true
}

CheckDistance(Float:origin[3])
{
    new 
Float:distFloat:data[3]
    new 
count ArraySize(g_vecSsSpawns)
    for(new 
0counti++)
    {
        
ArrayGetArray(g_vecSsSpawnsidata)
        
dist get_distance_f(origindata)
        if(
dist SS_MIN_DISTANCE)
            return 
false
    
}

    
count ArraySize(g_vecSsOrigins)
    for(new 
0counti++)
    {
        
ArrayGetArray(g_vecSsOriginsidata)
        
dist get_distance_f(origindata)
        if(
dist SS_MIN_DISTANCE)
            return 
false
    
}

    return 
true



Last edited by ESPADONGAMING; 10-06-2011 at 09:02.
ESPADONGAMING is offline
Send a message via MSN to ESPADONGAMING Send a message via Yahoo to ESPADONGAMING Send a message via Skype™ to ESPADONGAMING
ESPADONGAMING
Senior Member
Join Date: Mar 2011
Location: In the Game [ro]
Old 10-06-2011 , 15:32   Re: [Searching] Plugin
Reply With Quote #2

help.. ?
ESPADONGAMING is offline
Send a message via MSN to ESPADONGAMING Send a message via Yahoo to ESPADONGAMING Send a message via Skype™ to ESPADONGAMING
JoKeR LauGh
Veteran Member
Join Date: May 2011
Location: Malaysia
Old 10-06-2011 , 23:33   Re: [Searching] Plugin
Reply With Quote #3

you know , you can bump if the thread had past 2 weeks .
__________________
Quote:
Originally Posted by addons_zz View Post
Also, just to not read `the article`, read all you find. Read and read, for ever and ever. Never stop reading.
Why? Because there is not one single universal truth which holds the meaning for everything.
JoKeR LauGh 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 12:38.


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