Raised This Month: $51 Target: $400
 12% 

Speed ​​in the zone


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 03-23-2023 , 06:00   Speed ​​in the zone
Reply With Quote #1

Hello
I am going to increase the zombie speed in a zone area
I have two problems
The mod has used fw_PlayerPreThink to speed up the zombies
Next, I don't know how to recognize that they have left the zone
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN_VERSION "1.0"
#define ADMIN_ACCESS ADMIN_RCON
#define TASK_SHOWZONES 377737

#define MAXPLAYERS 32
#define isPlayer(%1) ((1 <= %1 && %1 < MAXPLAYERS))

#define ZONE_SPRITE "sprites/laserbeam.spr"
#define ZONE_STARTFRAME 1
#define ZONE_FRAMERATE 1
#define ZONE_LIFE 12
#define ZONE_WIDTH 5
#define ZONE_NOISE 0
#define ZONE_COLOR_RED 255
#define ZONE_COLOR_GREEN 0
#define ZONE_COLOR_BLUE 0
#define ZONE_COLOR_SELECTED_RED 0
#define ZONE_COLOR_SELECTED_GREEN random(256)
#define ZONE_COLOR_SELECTED_BLUE 255
#define ZONE_BRIGHTNESS 255
#define ZONE_SPEED 0
#define ZONE_VIEWDISTANCE 800.0
#define ZONE_BLOCKEDTEAM 1

// Comment this line to disable the beam when setting points.
#define BEAM_ENABLED

// Comment a line to disable the sound.
#define SOUND_SETPOINT "agrunt/ag_fire2.wav"
#define SOUND_SELECT "bullchicken/bc_spithit3.wav"
#define SOUND_DELETE "buttons/button10.wav"
#define SOUND_DELETEALL "buttons/button11.wav"
#define SOUND_TELEPORT "debris/beamstart7.wav"

#if defined BEAM_ENABLED
    #define BEAM_SPRITE "sprites/lgtning.spr"
    #define BEAM_STARTFRAME 0
    #define BEAM_FRAMERATE 10
    #define BEAM_LIFE 2
    #define BEAM_WIDTH 15
    #define BEAM_NOISE 2
    #define BEAM_COLOR_RED 255
    #define BEAM_COLOR_GREEN 0
    #define BEAM_COLOR_BLUE 0
    #define BEAM_COLOR_SELECT_RED 0
    #define BEAM_COLOR_SELECT_GREEN random(256)
    #define BEAM_COLOR_SELECT_BLUE 255
    #define BEAM_BRIGHTNESS 255
    #define BEAM_SPEED 30
    
    
new g_iBeamSprite
#endif

new const g_szPrefix[] = "^4[BB Zones]^1"
new const g_szEntString[] = "info_target"
new const g_szClassname[] = "BBZone"

new g_szDirectory[512], g_szFilename[512], g_szMap[32]

new Array:
g_aZones
new Trie:g_tZones
new bool:g_blBuilding[33]
new 
Float:g_flBuildOrigin[33][2][3]
new 
g_iBuildStage[33]
new 
g_iCurrentZone[33][2]

new 
bool:g_blHighlight[33]
new 
g_iZoneSprite

new g_iTotalZones
new g_iSayText

new Float:g_zonesOrigins[50][3]

public 
plugin_init()
{
    
register_plugin("BaseBuilder No-Build Zones"PLUGIN_VERSION"Lucifer")
    
register_cvar("BBZones"PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
    
register_dictionary("BBZones.txt")
    
    
register_clcmd("say /bbzones""menuZone")
    
register_clcmd("say_team /bbzones""menuZone")
    
register_clcmd("say /pointir""selectPoint")
    
register_touch(g_szClassname"player""OnTouchZone")
    
    
get_mapname(g_szMapcharsmax(g_szMap))
    
strtolower(g_szMap)
    
    
get_datadir(g_szDirectorycharsmax(g_szDirectory))
    
add(g_szDirectorycharsmax(g_szDirectory), "/BBZones")    
    
formatex(g_szFilenamecharsmax(g_szFilename), "%s/%s.txt"g_szDirectoryg_szMap)
    
    if(!
dir_exists(g_szDirectory))
        
mkdir(g_szDirectory)
    
    
g_aZones ArrayCreate(51)
    
g_tZones TrieCreate()
    
g_iSayText get_user_msgid("SayText")
    
fileRead(0)
}

public 
OnTouchZone(iZoneid)
{
    if(
get_user_team(id) != 1)
        return
        
    
set_pev(idpev_maxspeed1000.0)
}

public 
plugin_end()
{
    
fileRead(1)
    
ArrayDestroy(g_aZones)
    
TrieDestroy(g_tZones)
}

fileRead(iWrite)
{
    new 
iFilePointer
    
    
switch(iWrite)
    {
        case 
0:
        {
            
iFilePointer fopen(g_szFilename"rt")
    
            if(
iFilePointer)
            {
                new 
szData[200], szPoint[6][32]
                new 
Float:flPoint[2][3]
                
                while(!
feof(iFilePointer))
                {
                    
fgets(iFilePointerszDatacharsmax(szData))
                    
trim(szData)
                    
                    if(
szData[0] == EOS || szData[0] == ';')
                        continue
                        
                    
parse(szDataszPoint[0], charsmax(szPoint[]), szPoint[1], charsmax(szPoint[]), szPoint[2], charsmax(szPoint[]),
                    
szPoint[3], charsmax(szPoint[]), szPoint[4], charsmax(szPoint[]), szPoint[5], charsmax(szPoint[]))
                    
                    for(new 
i3i++)
                        
flPoint[0][i] = str_to_float(szPoint[i])
                        
                    for(new 
i3i++)
                        
flPoint[1][i] = str_to_float(szPoint[3])
                    
                    
CreateZone(flPoint[0], flPoint[1])
                }
            }
        }
        case 
1:
        {
            
delete_file(g_szFilename)
            
            if(!
g_iTotalZones)
                return
                
            
iFilePointer fopen(g_szFilename"wt")
            
            new 
szCoords[200], szZone[5], iZone
            
            
for(new ig_iTotalZonesi++)
            {
                
iZone ArrayGetCell(g_aZonesi)
                
num_to_str(iZoneszZonecharsmax(szZone))
                
TrieGetString(g_tZonesszZoneszCoordscharsmax(szCoords))
                
fprintf(iFilePointer"%s^n"szCoords)
            }
        }
    }
    
    
fclose(iFilePointer)
}

public 
selectPoint(id)
{
    if(!
g_blBuilding[id])
        return 
PLUGIN_CONTINUE
        
    
new Float:flPointOrigin[3], flUserOrigin[3]
    
get_user_origin(idflUserOrigin3)
    
IVecFVec(flUserOriginflPointOrigin)
    
g_flBuildOrigin[id][g_iBuildStage[id]] = flPointOrigin
    
    
#if defined SOUND_SETPOINT
        
player_spksound(idSOUND_SETPOINT)
    
#endif
    
    #if defined BEAM_ENABLED
        
draw_beam(id)
    
#endif
    
    
switch(g_iBuildStage[id])
    {
        case 
0:
        {
            
g_iBuildStage[id]++
            
ColorChat(id"%L"LANG_PLAYER"BBZONE_SET_SECOND")
        }
        case 
1:
        {
            
g_iBuildStage[id]--
            
g_blBuilding[id] = false
            CreateZone
(g_flBuildOrigin[id][0], g_flBuildOrigin[id][1])
            
ColorChat(id"%L"LANG_PLAYER"BBZONE_CREATED")
        }
    }
    
    
menu_reopen(id)
    return 
PLUGIN_HANDLED
}

public 
menuZone(id)
{
    if(!(
get_user_flags(id) & ADMIN_ACCESS))
    {
        
//ColorChat(id, "%L", LANG_PLAYER, "BBZONE_NOACCESS")
        
return PLUGIN_HANDLED
    
}
    
    new 
szTitle[128], szItem[64]
    
formatex(szTitlecharsmax(szTitle), "\r%L \d| \y%s \d| \r%i %L"LANG_PLAYER"BBZONE_BBZONES"g_szMapg_iTotalZonesLANG_PLAYER"BBZONE_ZONES")
    
    new 
iMenu menu_create(szTitle"handlerZone")
    
    
formatex(szItemcharsmax(szItem), "%L"LANG_PLAYERg_blBuilding[id] ? "BBZONE_CANCEL" "BBZONE_ADD")
    
menu_additem(iMenuszItem"")
    
    
formatex(szItemcharsmax(szItem), "%L"LANG_PLAYERg_blHighlight[id] ? "BBZONE_HIDE" "BBZONE_HIGHLIGHT")
    
menu_additem(iMenuszItem"")
    
    
formatex(szItemcharsmax(szItem), "%s%L"g_iTotalZones "" "\d"LANG_PLAYER"BBZONE_SELECT")
    
menu_additem(iMenuszItem"")
    
    
formatex(szItemcharsmax(szItem), "%s%L"g_iTotalZones && is_zone(g_iCurrentZone[id][0]) ? "" "\d"LANG_PLAYER"BBZONE_DELETE")
    
menu_additem(iMenuszItem"")
    
    
formatex(szItemcharsmax(szItem), "%s%L"g_iTotalZones "" "\d"LANG_PLAYER"BBZONE_DELETEALL")
    
menu_additem(iMenuszItem"")
    
    
formatex(szItemcharsmax(szItem), "%s%L"g_iTotalZones && is_zone(g_iCurrentZone[id][0]) ? "" "\d"LANG_PLAYER"BBZONE_TELEPORT")
    
menu_additem(iMenuszItem"")
    
    
menu_display(idiMenu0)
    return 
PLUGIN_HANDLED
}

public 
handlerZone(idiMenuiItem)
{
    if(
iItem == MENU_EXIT)
    {
        
menu_destroy(iMenu)
        return 
PLUGIN_HANDLED
    
}
    
    switch(
iItem)
    {
        case 
0:
        {
            if(
g_blBuilding[id])
            {
                
g_iBuildStage[id] = 0
                g_blBuilding
[id] = false
                ColorChat
(id"%L"LANG_PLAYER"BBZONE_CANCELED")
            }
            else
            {
                
g_blBuilding[id] = true
                ColorChat
(id"%L"LANG_PLAYER"BBZONE_SET_FIRST")
            }
        }
        case 
1:
        {
            if(
g_blHighlight[id])
            {
                
g_blHighlight[id] = false
                remove_task
(id TASK_SHOWZONES)
                
ColorChat(id"%L"LANG_PLAYER"BBZONE_HIGHLIGHT_DISABLED")
            }
            else
            {
                
g_blHighlight[id] = true
                set_task
(1.0"showZones"id TASK_SHOWZONES""0"b"0)
                
ColorChat(id"%L"LANG_PLAYER"BBZONE_HIGHLIGHT_ENABLED")
            }
        }
        case 
2:
        {
            if(
g_iTotalZones)
            {
                
menu_destroy(iMenu)
                
menuSelect(id)
                return 
PLUGIN_HANDLED
            
}
            else 
noZones(id)
        }
        case 
3:
        {
            if(
is_zone(g_iCurrentZone[id][0]))
            {
                
ColorChat(id"%L"LANG_SERVER"BBZONE_REMOVED"g_iCurrentZone[id][0])
                
player_remove_zone(id)
                
                
#if defined SOUND_DELETE
                    
player_spksound(idSOUND_DELETE)
                
#endif
            
}
            else 
invalidZone(id)
        }
        case 
4:
        {
            if(
g_iTotalZones)
            {
                new 
iPlayers[32], iPnumiEnt
                get_players
(iPlayersiPnum)
                
                while((
iEnt find_ent_by_class(iEntg_szClassname)))
                    if(
pev_valid(iEnt))
                        
remove_entity(iEnt)
                
                for(new 
iiPlayeriPnumi++)
                {
                    
iPlayer iPlayers[i]
                    
g_iCurrentZone[iPlayer][0] = 0
                    g_iCurrentZone
[iPlayer][1] = 0
                
}
                
                
g_iTotalZones 0
                ArrayClear
(g_aZones)
                
TrieClear(g_tZones)
                
ColorChat(id"%L"LANG_PLAYER"BBZONE_REMOVEDALL")
                
                
#if defined SOUND_DELETEALL
                    
player_spksound(idSOUND_DELETEALL)
                
#endif
            
}
            else 
noZones(id)
        }
        case 
5:
        {
            if(
is_zone(g_iCurrentZone[id][0]))
            {
                new 
Float:flOrigin[3]
                
pev(g_iCurrentZone[id][0], pev_originflOrigin)
                
set_pev(idpev_originflOrigin)
                
ColorChat(id"%L"LANG_PLAYER"BBZONE_TELEPORTED"g_iCurrentZone[id][0])
                
                
#if defined SOUND_TELEPORT
                    
player_emitsound(idSOUND_TELEPORT)
                
#endif
            
}
            else 
invalidZone(id)
        }
    }
    
    
menu_destroy(iMenu)
    
menuZone(id)
    return 
PLUGIN_HANDLED
}

public 
menuSelect(id)
{
    new 
szTitle[128], szItem[64], szTemp[32], szZone[5], iZone
    formatex
(szTitlecharsmax(szTitle), "\r%L \d| \y%s \d| \r%i %L"LANG_PLAYER"BBZONE_BBZONES"g_szMapg_iTotalZonesLANG_PLAYER"BBZONE_ZONES")
    
    new 
iMenu menu_create(szTitle"handlerSelect")
    
    
formatex(szItemcharsmax(szItem), "\r%L"LANG_PLAYER"BBZONE_BACK")
    
menu_additem(iMenuszItem"0")
    
    
formatex(szItemcharsmax(szItem), "\r%L"LANG_PLAYER"BBZONE_DESELECT")
    
menu_additem(iMenuszItem"1")
    
    for(new 
ig_iTotalZonesi++)
    {
        
iZone ArrayGetCell(g_aZonesi)
        
num_to_str(iZoneszZonecharsmax(szZone))
        
formatex(szItemcharsmax(szItem), "%L #%i"LANG_PLAYER"BBZONE_ZONE"iZone)
        
        if(
g_iCurrentZone[id][0] == iZone)
        {
            
formatex(szTempcharsmax(szTemp), " \y[%L]"LANG_PLAYER"BBZONE_CURRENT")
            
add(szItemcharsmax(szItem), szTemp)
        }
        
        
menu_additem(iMenuszItemszZone)
    }
    
    
menu_display(idiMenu0)
    return 
PLUGIN_HANDLED
}

public 
handlerSelect(idiMenuiItem)
{
    switch(
iItem)
    {
        case 
MENU_EXIT:
        {
            
menu_destroy(iMenu)
            return 
PLUGIN_HANDLED
        
}
        case 
0:
        {
            
menu_destroy(iMenu)
            
menuZone(id)
            return 
PLUGIN_HANDLED
        
}
        case 
1:
        {
            
g_iCurrentZone[id][0] = 0
            ColorChat
(id"%L"LANG_PLAYER"BBZONE_DESELECTED")
            
menu_destroy(iMenu)
            
menuSelect(id)
            return 
PLUGIN_HANDLED
        
}
    }
    
    new 
szData[6], iName[64], iAccessiCallback
    menu_item_getinfo
(iMenuiItemiAccessszDatacharsmax(szData), iNamecharsmax(iName), iCallback)
    new 
iKey str_to_num(szData)
    
    
g_iCurrentZone[id][0] = iKey
    g_iCurrentZone
[id][1] = iItem 2
    ColorChat
(id"%L"LANG_PLAYER"BBZONE_SELECTED"iKey)
    
    
#if defined SOUND_SELECT
        
player_spksound(idSOUND_SELECT)
    
#endif
    
    #if defined BEAM_ENABLED
        
draw_beam(idiKey)
    
#endif
    
    
menu_destroy(iMenu)
    
menuSelect(id)
    return 
PLUGIN_HANDLED
}

CreateZone(Float:flFirstPoint[3], Float:flSecondPoint[3])
{
    new 
Float:flCenter[3], Float:flSize[3]
    new 
Float:flMins[3], Float:flMaxs[3]
    
    for(new 
i3i++)
    {
        
flCenter[i] = (flFirstPoint[i] + flSecondPoint[i]) / 2.0
        flSize
[i] = get_float_difference(flFirstPoint[i], flSecondPoint[i])
        
flMins[i] = flSize[i] / -2.0
        flMaxs
[i] = flSize[i] / 2.0
    
}
    
    new 
iEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringg_szEntString))
    
    if(
pev_valid(iEnt))
    {
        
engfunc(EngFunc_SetOriginiEntflCenter)
        
set_pev(iEntpev_classnameg_szClassname)
        
dllfunc(DLLFunc_SpawniEnt)
        
set_pev(iEntpev_movetypeMOVETYPE_NONE)
        
set_pev(iEntpev_solidSOLID_TRIGGER)
        
entity_set_size(iEntflMinsflMaxs)
        
//engfunc(EngFunc_SetSize, iEnt, flMins, flMaxs)
    
}
    
    new 
szCoords[200], szZone[5]
    
formatex(szCoordscharsmax(szCoords), "%f %f %f %f %f %f"flFirstPoint[0], flFirstPoint[1], flFirstPoint[2], flSecondPoint[0], flSecondPoint[1], flSecondPoint[2])
    
num_to_str(iEntszZonecharsmax(szZone))
    
TrieSetString(g_tZonesszZoneszCoords)
    
ArrayPushCell(g_aZonesiEnt)
    
g_iTotalZones++
}

public 
origin_check(ident)
{
    new 
Float:entCenter[3]
    new 
zoneEnt = -1
    
new Float:zCenter[3]
    
    while((
zoneEnt find_ent_by_class(zoneEntg_szClassname)))
    {
        
// Get world center for the entity
        
static Float:flAbsMin[3], Float:flAbsMax[3]
        
pev(entpev_absminflAbsMin)
        
pev(entpev_absmaxflAbsMax)
        
        
entCenter[0] = (flAbsMin[0] + flAbsMax[0]) * 0.5
        entCenter
[1] = (flAbsMin[1] + flAbsMax[1]) * 0.5
        entCenter
[2] = (flAbsMin[2] + flAbsMax[2]) * 0.5
        
        
// Get world center for the zone
        
static Float:zAbsMin[3], Float:zAbsMax[3]
        
pev(zoneEntpev_absminzAbsMin)
        
pev(zoneEntpev_absmaxzAbsMax)
        
        
zCenter[0] = (zAbsMin[0] + zAbsMax[0]) * 0.5
        zCenter
[1] = (zAbsMin[1] + zAbsMax[1]) * 0.5
        zCenter
[2] = (zAbsMin[2] + zAbsMax[2]) * 0.5
        
        
// Get zone size
        
        
new Float:zoneSize[3]
        new 
Float:entSize[3]
        
        
pev(zoneEntpev_sizezoneSize)
        
pev(entpev_sizeentSize)
        
        new 
Float:zHalfSize[3]
        new 
Float:entHalfSize[3]
        
        
zHalfSize[0] = zoneSize[0] / 2
        zHalfSize
[1] = zoneSize[1] / 2
        zHalfSize
[2] = zoneSize[2] / 2
        
        entHalfSize
[0] = entSize[0] / 2
        entHalfSize
[1] = entSize[1] / 2
        entHalfSize
[2] = entSize[2] / 2
        
        
new Float:maxDistX
        
new Float:maxDistY
        
new Float:maxDistZ
        
        maxDistX 
zHalfSize[0] + entHalfSize[0]
        
maxDistY zHalfSize[1] + entHalfSize[1]
        
maxDistZ zHalfSize[2] + entHalfSize[2]
        
        if((
zCenter[0] - entCenter[0] > maxDistX) || (zCenter[0] - entCenter[0] < -maxDistX
        || (
zCenter[1] - entCenter[1] > maxDistY) || (zCenter[1] - entCenter[1] < -maxDistY)
        || (
zCenter[2] - entCenter[2] > maxDistZ) || (zCenter[2] - entCenter[2] < -maxDistZ))
        {
            
        }
        else if(!
isPlayer(ent)){
            
//engfunc( EngFunc_SetOrigin, ent, Float:{ -8192.0, -8192.0, -8192.0 } )
            
set_pev(ent,pev_rendermode,kRenderTransColor)
            
set_pev(ent,pev_rendercolorFloat:{163.01.037.0} )
            
set_pev(ent,pev_renderamt240.0 )
            
set_task(0.2"removeEnt"ent)
            
//ColorChat(id, "You are not allowed to build there.")
        
}
    }
}

public 
removeEnt(ent){    
    
Remove(ent)
}
stock Remove(ent
{
    
set_pev(entpev_solidSOLID_NOT);
    
set_pev(entpev_effectspev(entpev_effects) | EF_NODRAW);
}

public 
showZones(id)
{
    
id -= TASK_SHOWZONES
    
    
if(!is_user_connected(id))
    {
        
remove_task(id TASK_SHOWZONES)
        return
    }
    
    new 
iMins[3], iMaxs[3], iEnt
    
new Float:flUserOrigin[3], Float:flOrigin[3], Float:flMins[3], Float:flMaxs[3]
    new 
bool:blCurrentZone
    pev
(idpev_originflUserOrigin)
    
    
// Save zones origins
    
new zonesCount 0
    
// End save zones origins
    
    
while((iEnt find_ent_by_class(iEntg_szClassname)))
    {
        
blCurrentZone = (iEnt == g_iCurrentZone[id][0]) ? true false
        
        pev
(iEntpev_originflOrigin)
        
        
// Save zones origins
        
        
g_zonesOrigins[zonesCount][0] = flOrigin[0]
        
g_zonesOrigins[zonesCount][1] = flOrigin[1]
        
g_zonesOrigins[zonesCount][2] = flOrigin[2]
        
zonesCount += 1
        
        
// End save zones origins
        
        
if(get_distance_f(flUserOriginflOrigin) > ZONE_VIEWDISTANCE)
            continue
        
        
pev(iEntpev_minsflMins)
        
pev(iEntpev_maxsflMaxs)
        
        
flMins[0] += flOrigin[0]
        
flMins[1] += flOrigin[1]
        
flMins[2] += flOrigin[2]
        
flMaxs[0] += flOrigin[0]
        
flMaxs[1] += flOrigin[1]
        
flMaxs[2] += flOrigin[2]
        
        
/*console_print(0, "Size: %f", flMins[0])
        console_print(0, "Size: %f", flMins[1])
        console_print(0, "Size: %f", flMins[2])*/
        
        
FVecIVec(flMinsiMins)
        
FVecIVec(flMaxsiMaxs)

        
draw_line(idblCurrentZoneiMaxs[0], iMaxs[1], iMaxs[2], iMins[0], iMaxs[1], iMaxs[2])
        
draw_line(idblCurrentZoneiMaxs[0], iMaxs[1], iMaxs[2], iMaxs[0], iMins[1], iMaxs[2])
        
draw_line(idblCurrentZoneiMaxs[0], iMaxs[1], iMaxs[2], iMaxs[0], iMaxs[1], iMins[2])
        
draw_line(idblCurrentZoneiMins[0], iMins[1], iMins[2], iMaxs[0], iMins[1], iMins[2])
        
draw_line(idblCurrentZoneiMins[0], iMins[1], iMins[2], iMins[0], iMaxs[1], iMins[2])
        
draw_line(idblCurrentZoneiMins[0], iMins[1], iMins[2], iMins[0], iMins[1], iMaxs[2])
        
draw_line(idblCurrentZoneiMins[0], iMaxs[1], iMaxs[2], iMins[0], iMaxs[1], iMins[2])
        
draw_line(idblCurrentZoneiMins[0], iMaxs[1], iMins[2], iMaxs[0], iMaxs[1], iMins[2])
        
draw_line(idblCurrentZoneiMaxs[0], iMaxs[1], iMins[2], iMaxs[0], iMins[1], iMins[2])
        
draw_line(idblCurrentZoneiMaxs[0], iMins[1], iMins[2], iMaxs[0], iMins[1], iMaxs[2])
        
draw_line(idblCurrentZoneiMaxs[0], iMins[1], iMaxs[2], iMins[0], iMins[1], iMaxs[2])
        
draw_line(idblCurrentZoneiMins[0], iMins[1], iMaxs[2], iMins[0], iMaxs[1], iMaxs[2])
    }
}

public 
plugin_precache()
{
    
g_iZoneSprite precache_model(ZONE_SPRITE)
    
    
#if defined SOUND_SETPOINT
        
precache_sound(SOUND_SETPOINT)
    
#endif
    
    #if defined SOUND_SELECT
        
precache_sound(SOUND_SELECT)
    
#endif
    
    #if defined SOUND_DELETE
        
precache_sound(SOUND_DELETE)
    
#endif
    
    #if defined SOUND_DELETEALL
        
precache_sound(SOUND_DELETEALL)
    
#endif
    
    #if defined SOUND_TELEPORT
        
precache_sound(SOUND_TELEPORT)
    
#endif
    
    #if defined BEAM_ENABLED
        
g_iBeamSprite precache_model(BEAM_SPRITE)
    
#endif
}

menu_reopen(id)
{
    new 
iNewMenuiMenu player_menu_info(idiMenuiNewMenu)
    
    if(
iMenu)
    {
        
show_menu(id0"^n"1)
        
menuZone(id)
    }
}

#if defined BEAM_ENABLED
    
draw_beam(idiZone 0)
    {
        new 
iUserOrigin[3], iPointOrigin[3]
        
get_user_origin(idiUserOrigin)
        
        if(
iZone && pev_valid(iZone))
        {
            new 
Float:flOrigin[3]
            
pev(iZonepev_originflOrigin)
            
FVecIVec(flOriginiPointOrigin)
        }
        else 
get_user_origin(idiPointOrigin3)
        
        
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
        
write_byte(TE_BEAMPOINTS)
        
write_coord(iUserOrigin[0])
        
write_coord(iUserOrigin[1])
        
write_coord(iUserOrigin[2])
        
write_coord(iPointOrigin[0])
        
write_coord(iPointOrigin[1])
        
write_coord(iPointOrigin[2])
        
write_short(g_iBeamSprite)
        
write_byte(BEAM_STARTFRAME)
        
write_byte(BEAM_FRAMERATE)
        
write_byte(BEAM_LIFE)
        
write_byte(BEAM_WIDTH)
        
write_byte(BEAM_NOISE)
        
write_byte(iZone BEAM_COLOR_SELECT_RED BEAM_COLOR_RED)
        
write_byte(iZone BEAM_COLOR_SELECT_GREEN BEAM_COLOR_GREEN)
        
write_byte(iZone BEAM_COLOR_SELECT_BLUE BEAM_COLOR_BLUE)
        
write_byte(BEAM_BRIGHTNESS)
        
write_byte(BEAM_SPEED)
        
message_end()
    }
#endif

draw_line(idbool:blCurrentZonex1y1z1x2y2z2)
{
    
message_begin(id MSG_ONE_UNRELIABLE MSG_BROADCASTSVC_TEMPENTITY_id id 0)
    
write_byte(TE_BEAMPOINTS)
    
write_coord(x1)
    
write_coord(y1)
    
write_coord(z1)
    
write_coord(x2)
    
write_coord(y2)
    
write_coord(z2)
    
write_short(g_iZoneSprite)
    
write_byte(ZONE_STARTFRAME)
    
write_byte(ZONE_FRAMERATE)
    
write_byte(ZONE_LIFE)
    
write_byte(ZONE_WIDTH)
    
write_byte(ZONE_NOISE)
    
write_byte(blCurrentZone ZONE_COLOR_SELECTED_RED ZONE_COLOR_RED)
    
write_byte(blCurrentZone ZONE_COLOR_SELECTED_GREEN ZONE_COLOR_GREEN)
    
write_byte(blCurrentZone ZONE_COLOR_SELECTED_BLUE ZONE_COLOR_BLUE)
    
write_byte(ZONE_BRIGHTNESS)
    
write_byte(ZONE_SPEED)
    
message_end()
}

player_emitsound(idszSound[])
    
emit_sound(idCHAN_ITEMszSound1.0ATTN_NORM0PITCH_NORM)

player_spksound(idszSound[])
    
client_cmd(id"spk %s"szSound)

noZones(id)
    
ColorChat(id"%L"LANG_PLAYER"BBZONE_NOZONES")
    
invalidZone(id)
    
ColorChat(id"%L"LANG_PLAYER"BBZONE_INVALID")

player_remove_zone(id)
{
    new 
szZone[5]
    
num_to_str(g_iCurrentZone[id][0], szZonecharsmax(szZone))
    
ArrayDeleteItem(g_aZonesg_iCurrentZone[id][1])
    
TrieDeleteKey(g_tZonesszZone)
    
remove_entity(g_iCurrentZone[id][0])
    
g_iCurrentZone[id][0] = 0
    g_iCurrentZone
[id][1] = 0
    g_iTotalZones
--
}

bool:is_zone(iEnt)
{
    if(!
pev_valid(iEnt))
        return 
false
        
    
new szClass[32]
    
pev(iEntpev_classnameszClasscharsmax(szClass))
    return 
equal(szClassg_szClassname) ? true false
}

Float:get_float_difference(Float:flNumber1Float:flNumber2)
    return (
flNumber1 flNumber2) ? (flNumber1 flNumber2) : (flNumber2 flNumber1)

ColorChat(const id, const szInput[], any:...)
{
    new 
iPlayers[32], iCount 1
    
static szMessage[191]
    
vformat(szMessagecharsmax(szMessage), szInput3)
    
format(szMessage[0], charsmax(szMessage), "%s %s"g_szPrefixszMessage)
    
    
replace_all(szMessagecharsmax(szMessage), "!g""^4")
    
replace_all(szMessagecharsmax(szMessage), "!n""^1")
    
replace_all(szMessagecharsmax(szMessage), "!t""^3")
    
    if(
id)
        
iPlayers[0] = id
    
else
        
get_players(iPlayersiCount"ch")
    
    for(new 
iiCounti++)
    {
        if(
is_user_connected(iPlayers[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEg_iSayText_iPlayers[i])
            
write_byte(iPlayers[i])
            
write_string(szMessage)
            
message_end()
        }
    }

__________________
amirwolf 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 02:10.


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