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

Entity marker


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Apb hq
Senior Member
Join Date: Apr 2014
Old 07-20-2018 , 06:22   Entity marker
Reply With Quote #1

Hi guys i have found a plugin which can help me to block some zones on maps and i need this because i want to create new small maps, and now i have one issue when i quit the menu for entity creating , my zone is invisible so i wanted to know if it's possible to create two laserbeams who will show a cross (X) so that players can see what are the forbidden zones
PS. glow can do the job also , showing some sprite etc

here are some ss
Spoiler






Here is the code
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>

#define PLUGIN "2x2block_beta"
#define VERSION "1.4 beta"
#define AUTHOR "wopox"

#define MAXZONES 100
#define ZONEID pev_iuser1
#define TASK_BASIS_SHOWZONES 1000

/*
 *    Π*Ρ‚ΠΎΡ‚ ΠΏΠ»Π°Π³ΠΈΠ½ ΡΠ²Π»ΡΠ΅Ρ‚ся ΠΌΠΎΠ΄ΠΈΡ„ΠΈΠΊΠ°Ρ†ΠΈΠ΅ΠΉ WalkGuard 1.3.2.
 *  ΠžΡ„ΠΈΡ†ΠΈΠ°Π»ΡŒΠ½Π°Ρ Ρ‚Π΅ΠΌΠ° Ρ€Π°Π·Π±ΠΎΡ‚ΠΊΠΈ ΠΏΠ»Π°Π³ΠΈΠ½Π°: http://c-s.net.ua/forum/topic57108s0.html - Π½Π°ΡˆΠ»ΠΈ Π±Π°Π³? ΠΏΠΎΠΆΠ΅Π»Π΅Π»Π°Π½ΠΈΡ, Ρ€Π΅ΠΊΠΎΠΌΠ΅Π½Π΄Π°Ρ†ΠΈΠΈ
 *    Π—Π° Π±ΠΎΠ»ΡŒΡˆΡƒΡŽ Ρ‡Π°ΡΡ‚ΡŒ ΠΊΠΎΠ΄Π° Π½ΡƒΠΆΠ½ΠΎ Π±Π»Π°Π³ΠΎΠ΄Π°Ρ€ΠΈΡ‚ΡŒ "mogel", ΠΈΠΌΠ΅Π½Π½ΠΎ Π½Π° ΠΎΡΠ½ΠΎΠ²Π΅ Π΅Π³ΠΎ ΠΏΠ»Π°Π³ΠΈΠ½Π° ΡΠΎΠ·Π΄Π°Π½ ΡΡ‚ΠΎΡ‚ ΠΏΠ»Π°Π³ΠΈΠ½.
 */

new zonecolor[3] = { 255255255 }
new 
zone_color_active[3] = { 00255 }
new 
zone_color_red[3] = { 2550}
new 
zone_color_yellow[3] = { 255255}
new 
setupunits 10
new direction 0
new coordinates[3][] = { "TRANSLATE_X_COORD""TRANSLATE_Y_COORD""TRANSLATE_Z_COORD" }
new 
spr_dot
new editor 0
new zone[MAXZONES]
new 
maxzones
new index
static g_pPlayersNum
static g_pMessageAboutType
static boolg_b2x2ModeEnable true;
new 
RoundCount 0

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_dictionary("2x2block.txt")

    
register_cvar("2x2block"VERSIONFCVAR_SERVER FCVAR_SPONLY FCVAR_UNLOGGED)
    
server_cmd("2x2block %s"VERSION)
        
    
register_menu("MainMenu", -1"MainMenuAction"0)
    
register_menu("EditMenu", -1"EditMenuAction"0)
    
register_menu("KillMenu", -1"KillMenuAction"0)
    
    
register_clcmd("2x2menu""Init2x2block"ADMIN_RCON" - open the 2x2block-Menu")
    
g_pPlayersNum register_cvar ("2x2_players","10")
    
g_pMessageAboutType register_cvar ("2x2_notifytype","2")
    
    
//register_clcmd ("say /2x2","printMessageAbout");

    
register_logevent("Event_RoundStart"2"1=Round_Start")
    
register_forward(FM_Touch"fw_touch")
    
set_task(1.0"LoadBLC")
}

public 
plugin_precache() {
    
precache_model("models/gib_skull.mdl")
    
spr_dot precache_model("sprites/dot.spr")
}

public 
client_disconnect(player) {
    if (
player == editorHideAllZones()
}

public 
Event_RoundStart() {
    if (
get_playersnum () <= get_pcvar_num (g_pPlayersNum)){
        
set_task(0.1"OnBlockAllZone")
        
g_b2x2ModeEnable true;
    } 
    if (
get_playersnum () > get_pcvar_num (g_pPlayersNum)){
        
set_task(0.1"OffBlockAllZone")
        
g_b2x2ModeEnable false;
    }
    
set_task(0.1"printMessageAbout")
}

public 
printMessageAbout (id) {
    if (
get_pcvar_num(g_pMessageAboutType) == 1) {
        if (
g_b2x2ModeEnable) {
            
client_print (0,print_chat,"[2X2 MODE] %L"id"MODE_ENABLED");
        }
        if ((!
g_b2x2ModeEnable) && RoundCount == 1) {
            
client_print (0,print_chat,"[2X2 MODE] %L"id"MODE_DISABLED");
        }
    }
    if (
get_pcvar_num(g_pMessageAboutType) == 2) {
        if (
g_b2x2ModeEnable) {
            
set_hudmessage(0255128, -1.0, -0.911.02.00.20.6)
            
show_hudmessage(0"[2X2 MODE] %L"id,  "MODE_ENABLED");
        }
        if ((!
g_b2x2ModeEnable) && RoundCount == 1) {
            
set_hudmessage(0255128, -1.0, -0.911.02.00.20.6)
            
show_hudmessage(0"[2X2 MODE] %L"id,  "MODE_DISABLED");
        }
    }
    if (
get_pcvar_num(g_pMessageAboutType) == 0) {
        return 
PLUGIN_HANDLED
    
}
    return 
1
}

public 
fw_touch(zoneplayer) {
    if (
editor) return FMRES_IGNORED

    
if (!pev_valid(zone) || !is_user_connected(player))
        return 
FMRES_IGNORED

    
static classname[33]
    
pev(playerpev_classnameclassname32)
    if (!
equal(classname"player")) 
        return 
FMRES_IGNORED
    
    pev
(zonepev_classnameclassname32)
    if (!
equal(classname"2x2blockzone")) 
        return 
FMRES_IGNORED
        client_print
(player,print_center"This zone is blocked")
        
    return 
FMRES_IGNORED
}

//    Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ Π·ΠΎΠ½
public CreateZone(Float:position[3], Float:mins[3], Float:maxs[3]) {
    new 
entity fm_create_entity("info_target")
    
set_pev(entitypev_classname"2x2blockzone")
    
fm_entity_set_model(entity"models/gib_skull.mdl")
    
fm_entity_set_origin(entityposition)
    
set_pev(entitypev_movetypeMOVETYPE_FLY)
    
set_pev(entity,pev_renderfx,kRenderFxGlowShell)
    

    if (
editor
    {
        
set_pev(entitypev_solidSOLID_NOT)
    } else {
        
set_pev(entitypev_solidSOLID_BBOX)
    }
    
    
fm_entity_set_size(entityminsmaxs)
    
fm_set_entity_visibility(entity0)
    
    
set_pev(entityZONEID)
    
    return 
entity
}

public 
CreateNewZone(Float:position[3]) {
    new 
Float:mins[3] = { -32.0, -32.0, -32.0 }
    new 
Float:maxs[3] = { 32.032.032.0 }
    return 
CreateZone(positionminsmaxs);    // ZM_NONE
}

public 
CreateZoneOnPlayer(player) {
    new 
Float:position[3]
    
pev(playerpev_originposition)
    
    new 
entity CreateNewZone(position)
    
FindAllZones()
    
    for(new 
0maxzonesi++) if (zone[i] == entityindex i;
}

//    Π—Π°Π³Ρ€ΡƒΠ·ΠΊΠ° ΠΈ ΡΠΎΠ·Ρ€Π°Π½Π΅Π½ΠΈΠ΅ *.blc Ρ„Π°ΠΉΠ»ΠΎΠ²
public SaveBLC(player) {
    new 
zonefile[200]
    new 
mapname[50]

    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³Π°
    
get_configsdir(zonefile199)
    
format(zonefile199"%s/2x2blockMaps"zonefile)
    if (!
dir_exists(zonefile)) mkdir(zonefile)
    
    
// Π‘ΠΎΠ·Π΄Π°ΡŽΡ‚ΡΡ Ρ„Π°ΠΉΠ»Ρ‹ Ρ ΠΈΠΌΠ΅Π½Π΅ΠΌ ΠΊΠ°Ρ€Ρ‚Ρ‹
    
get_mapname(mapname49)
    
format(zonefile199"%s/%s.blc"zonefilemapname)
    
delete_file(zonefile)
    
    
FindAllZones()    // Π΄Π»Ρ "бСзопасности"
    
    // Header
    
write_file(zonefile"; V1 - 2x2block Zone-File")
    
write_file(zonefile";<position (x/y/z)> <mins (x/y/z)> <maxs (x/y/z)>")
    
write_file(zonefile";")
    
write_file(zonefile"")
    
    
// Π‘ΠΎΡ…Ρ€Π°Π½Π΅Π½ΠΈΠ΅ Π²ΡΠ΅Ρ… Π·ΠΎΠ½
    
for(new 0maxzonesi++)
    {        
        
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚
        
new zone[i]
        new 
Float:pos[3]
        
pev(zpev_originpos)
        
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ Ρ€Π°Π·ΠΌΠ΅Ρ€ΠΎΠ²
        
new Float:mins[3], Float:maxs[3]
        
pev(zpev_minsmins)
        
pev(zpev_maxsmaxs)
        
// Π’Ρ‹Π²ΠΎΠ΄ Π² ΡΠΏΠ΅Ρ†ΠΈΠ°Π»ΡŒΠ½Ρ‹ΠΉ Ρ„ΠΎΡ€ΠΌΠ°Ρ‚
        
new output[1000]
        
//  -> ΠŸΠΎΠ·ΠΈΡ†ΠΈΡ
        
format(output999"%s %.1f %.1f %.1f"outputpos[0], pos[1], pos[2])
        
//  -> Π*Π°Π·ΠΌΠ΅Ρ€Ρ‹
        
format(output999"%s %.0f %.0f %.0f"outputmins[0], mins[1], mins[2])
        
format(output999"%s %.0f %.0f %.0f"outputmaxs[0], maxs[1], maxs[2])
        
// ΠΈ Π·Π°ΠΏΠΈΡΠ°Ρ‚ΡŒ Π² Ρ„Π°ΠΉΠ»
        
write_file(zonefileoutput)
    }
    
client_print(playerprint_chat"%L"player"ZONE_FILE_SAVED"zonefile)
}

public 
LoadBLC() {
    new 
zonefile[200]
    new 
mapname[50]
    new 
data[20]
    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³Π°
    
get_configsdir(zonefile199)
    
format(zonefile199"%s/2x2blockMaps"zonefile)
    
// ΠŸΠΎΠ»ΡƒΡ‡Π°Π΅ΠΌ Ρ„Π°ΠΉΠ» Ρ ΠΈΠΌΠ΅Π½Π΅ΠΌ ΠΊΠ°Ρ€Ρ‚Ρ‹
    
get_mapname(mapname49)
    
format(zonefile199"%s/%s.blc"zonefilemapname)
    
    if (!
file_exists(zonefile))
    {
        
log_amx("no zone-file found")
        return
    }
    
    
// Π§ΠΈΡ‚Π°Π΅ΠΌ Π΄Π°Π½Π½Ρ‹Π΅
    
new input[1000], line 0len
    
while( (line read_file(zonefile line input 127 len) ) != 
    {
        if (!
strlen(input)  || (input[0] == ';')) continue;    // ΠžΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡƒΡΡ‚Ρ‹Ρ… ΡΡ‚Ρ€ΠΎΠΊ ΠΈ ΠΊΠΎΠΌΠΌΠ΅Π½Ρ‚Π°Ρ€ΠΈΠ΅Π²
        
new Float:pos[3], Float:mins[3], Float:maxs[3]    // ΠŸΠΎΠ·ΠΈΡ†ΠΈΡ ΠΈ Ρ€Π°Π·ΠΌΠ΅Ρ€Ρ‹
        
        // ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΠΏΠΎΠ·ΠΈΡ†ΠΈΠΈ
        
strbreak(inputdata20input999);    pos[0] = str_to_float(data);
        
strbreak(inputdata20input999);    pos[1] = str_to_float(data);
        
strbreak(inputdata20input999);    pos[2] = str_to_float(data);
        
//  ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ Π*Π°Π·ΠΌΠ΅Ρ€ΠΎΠ²
        
strbreak(inputdata20input999);    mins[0] = str_to_float(data);
        
strbreak(inputdata20input999);    mins[1] = str_to_float(data);
        
strbreak(inputdata20input999);    mins[2] = str_to_float(data);
        
strbreak(inputdata20input999);    maxs[0] = str_to_float(data);
        
strbreak(inputdata20input999);    maxs[1] = str_to_float(data);
        
strbreak(inputdata20input999);    maxs[2] = str_to_float(data);

        
// Π‘ΠΎΠ·Π΄Π°Ρ‘ΠΌ Π·ΠΎΠ½Ρ‹
        
CreateZone(posminsmaxs);
    }
    
FindAllZones()
    
HideAllZones()
}

//    2x2block-Menu
public FX_Box(Float:sizemin[3], Float:sizemax[3], color[3], life) {
    
message_begin(MSG_ALLSVC_TEMPENTITY);
    
write_byte(31);
    
write_coordfloatroundsizemin[0] ) ); // x
    
write_coordfloatroundsizemin[1] ) ); // y
    
write_coordfloatroundsizemin[2] ) ); // z
    
write_coordfloatroundsizemax[0] ) ); // x
    
write_coordfloatroundsizemax[1] ) ); // y
    
write_coordfloatroundsizemax[2] ) ); // z
    
write_short(life)    // Life
    
write_byte(color[0])    // Color R / G / B
    
write_byte(color[1])
    
write_byte(color[2])
    
message_end(); 
}

public 
FX_Line(start[3], stop[3], color[3], brightness) {
    
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_editor
    
write_byteTE_BEAMPOINTS 
    
write_coord(start[0]) 
    
write_coord(start[1])
    
write_coord(start[2])
    
write_coord(stop[0])
    
write_coord(stop[1])
    
write_coord(stop[2])
    
write_shortspr_dot )
    
write_byte)    // framestart 
    
write_byte)    // framerate 
    
write_byte)    // life in 0.1's 
    
write_byte)    // width
    
write_byte)     // noise 
    
write_bytecolor[0] )   // r, g, b 
    
write_bytecolor[1] )   // r, g, b 
    
write_bytecolor[2] )   // r, g, b 
    
write_bytebrightness )      // ΡΡ€ΠΊΠΎΡΡ‚ΡŒ
    
write_byte)       // ΡΠΊΠΎΡ€ΠΎΡΡ‚ΡŒ
    
message_end() 
}

public 
DrawLine(Float:x1Float:y1Float:z1Float:x2Float:y2Float:z2color[3]) {
    new 
start[3]
    new 
stop[3]
    
    
start[0] = floatroundx1 )
    
start[1] = floatroundy1 )
    
start[2] = floatroundz1 )
    
    
stop[0] = floatroundx2 )
    
stop[1] = floatroundy2 )
    
stop[2] = floatroundz2 )

    
FX_Line(startstopcolor200)
}

public 
ShowAllZones() {
    
FindAllZones()    // Π΄Π»Ρ "бСзопасности"
    
for(new 0maxzonesi++)
    {
        new 
zone[i]
        
remove_task(TASK_BASIS_SHOWZONES z)
        
set_pev(zpev_solidSOLID_NOT)
        
set_task(0.2"ShowZoneBox"TASK_BASIS_SHOWZONES z__"b")
    }
}

public 
ShowZoneBox(entity) {
    
entity -= TASK_BASIS_SHOWZONES
    
if ((!fm_is_valid_ent(entity)) || !editor) return
    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚
    
new Float:pos[3]
    
pev(entitypev_originpos)
    if (!
fm_is_in_viewcone(editorpos) && (entity != zone[index])) return        // Π•ΡΠ»ΠΈ Π½Π΅ Π² fov
    // "ΠŸΡ€ΠΎΠ²Π΅Ρ€ΠΊΠ° Π½Π° Π²ΠΈΠ΄ΠΈΠΌΠΎΡΡ‚ΡŒ Π·ΠΎΠ½ Π² fov Π³Ρ€ΠΎΠΊΠ°"
    // Π½Π΅ Π²ΠΈΠ΄ΠΈΠΌΡ‹Π΅ - Π½Π΅ ΠΎΡ‚Ρ€ΠΈΡΠΎΠ²Ρ‹Π²Π°ΡŽΡ‚ΡΡ
    
new Float:editorpos[3]
    
pev(editorpev_origineditorpos)
    new 
Float:hitpoint[3]
    
fm_trace_line(-1editorposposhitpoint)

    if (
entity == zone[index]) DrawLine(editorpos[0], editorpos[1], editorpos[2] - 16.0pos[0], pos[1], pos[2], { 25500} )

    new 
Float:dh vector_distance(editorpospos) - vector_distance(editorposhitpoint)
    if ( (
floatabs(dh) > 128.0) && (entity != zone[index])) return

    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚
    
new Float:mins[3], Float:maxs[3]
    
pev(entitypev_minsmins)
    
pev(entitypev_maxsmaxs)
    
    
mins[0] += pos[0]
    
mins[1] += pos[1]
    
mins[2] += pos[2]
    
maxs[0] += pos[0]
    
maxs[1] += pos[1]
    
maxs[2] += pos[2]

    new 
color[3]
    
color[0] = (zone[index] == entity) ? zone_color_active[0] : zonecolor[0]
    
color[1] = (zone[index] == entity) ? zone_color_active[1] : zonecolor[1]
    
color[2] = (zone[index] == entity) ? zone_color_active[2] : zonecolor[2]
        
// Π*исовка Π»ΠΈΠ½ΠΈΠΉ Box'ΠΎΠ² (Π·ΠΎΠ½)
    //  -> Π²ΡΠ΅ maxs Π»ΠΈΠ½ΠΈΠΈ
    
DrawLine(maxs[0], maxs[1], maxs[2], mins[0], maxs[1], maxs[2], color)
    
DrawLine(maxs[0], maxs[1], maxs[2], maxs[0], mins[1], maxs[2], color)
    
DrawLine(maxs[0], maxs[1], maxs[2], maxs[0], maxs[1], mins[2], color)
    
//  -> Π²ΡΠ΅ mins Π»ΠΈΠ½ΠΈΠΈ
    
DrawLine(mins[0], mins[1], mins[2], maxs[0], mins[1], mins[2], color)
    
DrawLine(mins[0], mins[1], mins[2], mins[0], maxs[1], mins[2], color)
    
DrawLine(mins[0], mins[1], mins[2], mins[0], mins[1], maxs[2], color)
    
//  -> ΠΎΡΡ‚Π°Π»ΡŒΠ½Ρ‹Π΅ 6 Π»ΠΈΠ½ΠΈΠΉ
    
DrawLine(mins[0], maxs[1], maxs[2], mins[0], maxs[1], mins[2], color)
    
DrawLine(mins[0], maxs[1], mins[2], maxs[0], maxs[1], mins[2], color)
    
DrawLine(maxs[0], maxs[1], mins[2], maxs[0], mins[1], mins[2], color)
    
DrawLine(maxs[0], mins[1], mins[2], maxs[0], mins[1], maxs[2], color)
    
DrawLine(maxs[0], mins[1], maxs[2], mins[0], mins[1], maxs[2], color)
    
DrawLine(mins[0], mins[1], maxs[2], mins[0], maxs[1], maxs[2], color)

    if (
entity != zone[index]) return
    
// Π›ΠΈΠ½ΠΈΠΈ ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚
    
if (direction == 0)    // X-ΠšΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚Ρ‹
    
{
        
DrawLine(maxs[0], maxs[1], maxs[2], maxs[0], mins[1], mins[2], zone_color_yellow)
        
DrawLine(maxs[0], maxs[1], mins[2], maxs[0], mins[1], maxs[2], zone_color_yellow)
        
DrawLine(mins[0], maxs[1], maxs[2], mins[0], mins[1], mins[2], zone_color_red)
        
DrawLine(mins[0], maxs[1], mins[2], mins[0], mins[1], maxs[2], zone_color_red)
    }
    if (
direction == 1)    // Y-ΠšΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚Ρ‹
    
{
        
DrawLine(mins[0], mins[1], mins[2], maxs[0], mins[1], maxs[2], zone_color_red)
        
DrawLine(maxs[0], mins[1], mins[2], mins[0], mins[1], maxs[2], zone_color_red)
        
DrawLine(mins[0], maxs[1], mins[2], maxs[0], maxs[1], maxs[2], zone_color_yellow)
        
DrawLine(maxs[0], maxs[1], mins[2], mins[0], maxs[1], maxs[2], zone_color_yellow)
    }    
    if (
direction == 2)    // Z-ΠšΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚Ρ‹
    
{
        
DrawLine(maxs[0], maxs[1], maxs[2], mins[0], mins[1], maxs[2], zone_color_yellow)
        
DrawLine(maxs[0], mins[1], maxs[2], mins[0], maxs[1], maxs[2], zone_color_yellow)
        
DrawLine(maxs[0], maxs[1], mins[2], mins[0], mins[1], mins[2], zone_color_red)
        
DrawLine(maxs[0], mins[1], mins[2], mins[0], maxs[1], mins[2], zone_color_red)
    }
}

public 
HideAllZones() {
    
editor 0
    
for(new 0maxzonesi++)
    {
        
set_pev(zone[i], pev_solidSOLID_BBOX)
        
remove_task(TASK_BASIS_SHOWZONES zone[i])
    }
}

public 
FindAllZones() {
    new 
entity = -1
    maxzones 
0
    
while( (entity fm_find_ent_by_class(entity"2x2blockzone")) )
    {
        
zone[maxzones] = entity
        maxzones
++
    
        
    }
}

public 
Init2x2block(player) {
    new 
name[33], steam[33]
    
get_user_name(playername32)
    
get_user_authid(playersteam32)
    
    if (!(
get_user_flags(player) & ADMIN_RCON))
    {
        
log_amx("no access-rights for '%s' <%s>"namesteam)
        return 
PLUGIN_HANDLED
    
}
    
    
editor player
    FindAllZones
();
    
ShowAllZones();
    
    
set_task(0.1"Open2x2Menu"player)

    return 
PLUGIN_HANDLED
}

public 
OnBlockAllZone(player) {
    
RoundCount 0
    
    editor 
0
    HideAllZones
()
}
public 
OffBlockAllZone(player) {
    
RoundCount++
    
    
editor 0
    FindAllZones
();
    
ShowAllZones();
}

public 
Open2x2Menu(player) {
    new 
menu[1024]
    new 
zm = -1
    
new menukeys MENU_KEY_0 MENU_KEY_4 MENU_KEY_9
    
    
if (fm_is_valid_ent(zone[index]))
    {
        
zm pev(zone[index], ZONEID)
    }
    
    
format(menu1023"\d2x2block-Menu - Version %s\w"VERSION)
    
format(menu1023"%s^n"menu)        // ΠŸΡƒΡΡ‚ая ΡΡ‚Ρ€ΠΎΠΊΠ°
    
format(menu1023"%L"player"WGM_ZONE_FOUND"menumaxzones)
    
    if (
zm != -1)
    {
        
menukeys += MENU_KEY_2 MENU_KEY_3 MENU_KEY_1
        format
(menu1023"%s^n"menu)        // ΠŸΡƒΡΡ‚ая ΡΡ‚Ρ€ΠΎΠΊΠ°
        
format(menu1023"%s^n"menu)        // ΠŸΡƒΡΡ‚ая ΡΡ‚Ρ€ΠΎΠΊΠ°
        
format(menu1023"%L"player"WGM_ZONE_EDIT"menu)
        
format(menu1023"%L"player"WGM_ZONE_CHANGE"menu)
    }
    
    
format(menu1023"%s^n"menu)        // ΠŸΡƒΡΡ‚ая ΡΡ‚Ρ€ΠΎΠΊΠ°
    
format(menu1023"%L" ,player"WGM_ZONE_CREATE"menu)
    
    if (
zm != -1)
    {
        
menukeys += MENU_KEY_6
        format
(menu1023"%L"player"WGM_ZONE_DELETE"menu)
    }
    
format(menu1023"%L"player"WGM_ZONE_SAVE"menu)
        
    
format(menu1023"%s^n"menu)        // ΠŸΡƒΡΡ‚ая ΡΡ‚Ρ€ΠΎΠΊΠ°
    
format(menu1023"%L" ,player"WGM_ZONE_EXIT"menu)
    
    
show_menu(playermenukeysmenu, -1"MainMenu")
    
client_cmd(player"spk sound/buttons/blip1.wav")
}

public 
MainMenuAction(playerkey) {
    
key = (key == 10) ? key 1
    
switch(key
    {
        case 
1: {
                
// Π*Π΅Π΄Π°ΠΊΡ‚ΠΎΡ€ Π·ΠΎΠ½Ρ‹
                
if (fm_is_valid_ent(zone[index])) OpenEditMenu(player); else Open2x2Menu(player);
            }
        case 
2: {
                
// ΠΏΡ€Π΅Π΄Ρ‹Π΄ΡƒΡ‰Π°Ρ Π·ΠΎΠ½Π°
                
index = (index 0) ? index index;
                
Open2x2Menu(player)
            }
        case 
3: {
                
// ΡΠ»Π΅Π΄ΡƒΡŽΡ‰Π°Ρ Π·ΠΎΠ½Π°
                
index = (index maxzones 1) ? index index;
                
Open2x2Menu(player)
            }
        case 
4:    {
                
// ΡΠΎΠ·Π΄Π°Ρ‚ΡŒ Π½ΠΎΠ²ΡƒΡŽ Π·ΠΎΠ½Ρƒ
                
if (maxzones MAXZONES 1) {
                    
CreateZoneOnPlayer(player);
                    
ShowAllZones();
                    
MainMenuAction(player0);
                } else {
                    
client_print(playerprint_chat"%L"player"ZONE_FULL")
                    
client_cmd(player"spk sound/buttons/button10.wav")
                    
set_task(0.5"Open2x2Menu"player)
                }
            }
        case 
6: {
                
// Π£Π΄Π°Π»ΠΈΡ‚ΡŒ Π·ΠΎΠ½Ρƒ
                
OpenKillMenu(player);
            }
        case 
9: {
                
// Π‘ΠΎΠ·Ρ€Π°Π½ΠΈΡ‚ΡŒ Π·ΠΎΠ½Ρ‹
                
SaveBLC(player)
                
Open2x2Menu(player)
            }
        case 
10:{
                
//editor = 0
                
HideAllZones()
            }
    }
}

public 
OpenEditMenu(player) {
    new 
trans[70]
    
    new 
menu[1024]
    new 
menukeys MENU_KEY_0 MENU_KEY_1 MENU_KEY_4 MENU_KEY_5 MENU_KEY_6 MENU_KEY_7 MENU_KEY_8 MENU_KEY_9
    
    format
(menu1023"\dEdit 2x2block-Zone\w")
    
format(menu1023"%s^n"menu)        // ΠŸΡƒΡΡ‚ая ΡΡ‚Ρ€ΠΎΠΊΠ°
    
format(menu1023"%s^n"menu)        // ΠŸΡƒΡΡ‚ая ΡΡ‚Ρ€ΠΎΠΊΠ°

    
if (fm_is_valid_ent(zone[index]))
    {
        
pev(zone[index], ZONEID)
    }
        
    
format(menu1023"%s^n"menu)        // ΠŸΡƒΡΡ‚ая ΡΡ‚Ρ€ΠΎΠΊΠ°
    
    
format(trans49"%L"playercoordinates[direction])
    
format(menu1023"%L"player"WGE_ZONE_SIZE_INIT"menutrans)
    
format(menu1023"%L"player"WGE_ZONE_SIZE_MINS"menu)
    
format(menu1023"%L"player"WGE_ZONE_SIZE_MAXS"menu)
    
format(menu1023"%L"player"WGE_ZONE_SIZE_STEP"menusetupunits)
    
format(menu1023"%s^n"menu)        // ΠŸΡƒΡΡ‚ая ΡΡ‚Ρ€ΠΎΠΊΠ°
    
format(menu1023"%s^n"menu)        // ΠŸΡƒΡΡ‚ая ΡΡ‚Ρ€ΠΎΠΊΠ°
    
format(menu1023"%L"player"WGE_ZONE_SIZE_QUIT"menu)
    
    
show_menu(playermenukeysmenu, -1"EditMenu")
    
client_cmd(player"spk sound/buttons/blip1.wav")
}

public 
EditMenuAction(playerkey) {
    
key = (key == 10) ? key 1
    
switch(key)
    {
        case 
1: {
                
OpenEditMenu(player)
            }
        case 
2: {
                
OpenEditMenu(player)
            }
        case 
3: {
                
OpenEditMenu(player)
            }
        case 
4: {
                
// ΠΠ°ΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅ (ось) Ρ€Π΅Π΄Π°ΠΊΡ‚ирования
                
direction = (direction 2) ? direction 0
                OpenEditMenu
(player)
            }
        case 
5: {
                
// "Π£ΠΆΠ΅"
                
ZuRotAddieren()
                
OpenEditMenu(player)
            }
        case 
6: {
                
// "Π¨ΠΈΡ€Π΅"
                
VonRotAbziehen()
                
OpenEditMenu(player)
            }
        case 
7: {
                
// "Π£ΠΆΠ΅"2
                
VonGelbAbziehen()
                
OpenEditMenu(player)
            }
        case 
8: {
                
// "Π¨ΠΈΡ€Π΅"2
                
ZuGelbAddieren()
                
OpenEditMenu(player)
            }
        case 
9: {
                
// Π²Π΅Π»ΠΈΡ‡ΠΈΠ½Π° ΠΏΡ€ΠΈΡ€ΠΎΡΡ‚Π°
                
setupunits = (setupunits 100) ? setupunits 10 1
                OpenEditMenu
(player)
            }
        case 
10:{
                
Open2x2Menu(player)
            }
    }
}

public 
VonRotAbziehen() {
    new 
entity zone[index]
    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚
    
new Float:pos[3]
    
pev(entitypev_originpos)
    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ Ρ€Π°Π·ΠΌΠ΅Ρ€ΠΎΠ²
    
new Float:mins[3], Float:maxs[3]
    
pev(entitypev_minsmins)
    
pev(entitypev_maxsmaxs)

    
mins[direction] -= float(setupunits) / 2.0
    maxs
[direction] += float(setupunits) / 2.0
    pos
[direction] -= float(setupunits) / 2.0
    
    set_pev
(entitypev_originpos)
    
fm_entity_set_size(entityminsmaxs)
}

public 
ZuRotAddieren() {
    new 
entity zone[index]
    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚
    
new Float:pos[3]
    
pev(entitypev_originpos)
    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ Ρ€Π°Π·ΠΌΠ΅Ρ€ΠΎΠ²
    
new Float:mins[3], Float:maxs[3]
    
pev(entitypev_minsmins)
    
pev(entitypev_maxsmaxs)

    if ((
floatabs(mins[direction]) + maxs[direction]) < setupunits 1) return

    
mins[direction] += float(setupunits) / 2.0
    maxs
[direction] -= float(setupunits) / 2.0
    pos
[direction] += float(setupunits) / 2.0
    
    set_pev
(entitypev_originpos)
    
fm_entity_set_size(entityminsmaxs)
}

public 
VonGelbAbziehen() {
    new 
entity zone[index]
    
    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚
    
new Float:pos[3]
    
pev(entitypev_originpos)

    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ Ρ€Π°Π·ΠΌΠ΅Ρ€ΠΎΠ²
    
new Float:mins[3], Float:maxs[3]
    
pev(entitypev_minsmins)
    
pev(entitypev_maxsmaxs)

    if ((
floatabs(mins[direction]) + maxs[direction]) < setupunits 1) return

    
mins[direction] += float(setupunits) / 2.0
    maxs
[direction] -= float(setupunits) / 2.0
    pos
[direction] -= float(setupunits) / 2.0
    
    set_pev
(entitypev_originpos)
    
fm_entity_set_size(entityminsmaxs)
}

public 
ZuGelbAddieren() {
    new 
entity zone[index]
    
    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ ΠΊΠΎΠΎΡ€Π΄ΠΈΠ½Π°Ρ‚
    
new Float:pos[3]
    
pev(entitypev_originpos)
    
// ΠŸΠΎΠ»ΡƒΡ‡Π΅Π½ΠΈΠ΅ Ρ€Π°Π·ΠΌΠ΅Ρ€ΠΎΠ²
    
new Float:mins[3], Float:maxs[3]
    
pev(entitypev_minsmins)
    
pev(entitypev_maxsmaxs)

    
mins[direction] -= float(setupunits) / 2.0
    maxs
[direction] += float(setupunits) / 2.0
    pos
[direction] += float(setupunits) / 2.0
    
    set_pev
(entitypev_originpos)
    
fm_entity_set_size(entityminsmaxs)
}

public 
OpenKillMenu(player) {
    new 
menu[1024]
    
    
format(menu1023"%L"player"ZONE_KILL_INIT")
    
format(menu1023"%L"player"ZONE_KILL_ASK"menu)
    
    
show_menu(playerMENU_KEY_1 MENU_KEY_0menu, -1"KillMenu")
    
client_cmd(player"spk sound/buttons/button10.wav")
}

// Π€ΡƒΠ½ΠΊΡ†ΠΈΡ ΡƒΠ΄Π°Π»Π΅Π½ΠΈΡ Π·ΠΎΠ½
public KillMenuAction(playerkey) {
    
key = (key == 10) ? key 1
    
switch(key)
    {
        case 
1: {
            
client_print(playerprint_chat"[WalkGuard] %L"player"ZONE_KILL_NO")
        }
        case 
10:{
            
fm_remove_entity(zone[index])
            
index--;
            if (
index 0index 0;
            
client_print(playerprint_chat"[WalkGuard] %L"player"ZONE_KILL_YES")
            
FindAllZones()
        }
    }
    
Open2x2Menu(player)
}

stock fm_set_kvd(entity, const key[], const value[], const classname[] = "") {
    if (
classname[0])
        
set_kvd(0KV_ClassNameclassname)
    else {
        new class[
32]
        
pev(entitypev_classname, class, sizeof class - 1)
        
set_kvd(0KV_ClassName, class)
    }
    
    
set_kvd(0KV_KeyNamekey)
    
set_kvd(0KV_Valuevalue)
    
set_kvd(0KV_fHandled0)

    return 
dllfunc(DLLFunc_KeyValueentity0)
}

stock fm_fake_touch(touchertouched)
    return 
dllfunc(DLLFunc_Touchtouchertouched)

stock fm_DispatchSpawn(entity)
    return 
dllfunc(DLLFunc_Spawnentity)

stock fm_remove_entity(index)
    return 
engfunc(EngFunc_RemoveEntityindex)

stock fm_find_ent_by_class(index, const classname[])
    return 
engfunc(EngFunc_FindEntityByStringindex"classname"classname)

stock fm_is_valid_ent(index)
    return 
pev_valid(index)

stock fm_entity_set_size(index, const Float:mins[3], const Float:maxs[3])
    return 
engfunc(EngFunc_SetSizeindexminsmaxs)

stock fm_entity_set_model(index, const model[])
    return 
engfunc(EngFunc_SetModelindexmodel)

stock fm_create_entity(const classname[])
    return 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringclassname))

stock fm_entity_set_origin(index, const Float:origin[3]) {
    new 
Float:mins[3], Float:maxs[3]
    
pev(indexpev_minsmins)
    
pev(indexpev_maxsmaxs)
    
engfunc(EngFunc_SetSizeindexminsmaxs)

    return 
engfunc(EngFunc_SetOriginindexorigin)
}

stock fm_set_entity_visibility(indexvisible 1) {
    
set_pev(indexpev_effectsvisible == pev(indexpev_effects) & ~EF_NODRAW pev(indexpev_effects) | EF_NODRAW)
    return 
1
}

stock bool:fm_is_in_viewcone(index, const Float:point[3]) {
    new 
Float:angles[3]
    
pev(indexpev_anglesangles)
    
engfunc(EngFunc_MakeVectorsangles)
    
global_get(glb_v_forwardangles)
    
angles[2] = 0.0

    
new Float:origin[3], Float:diff[3], Float:norm[3]
    
pev(indexpev_originorigin)
    
xs_vec_sub(pointorigindiff)
    
diff[2] = 0.0
    xs_vec_normalize
(diffnorm)

    new 
Float:dotFloat:fov
    dot 
xs_vec_dot(normangles)
    
pev(indexpev_fovfov)
    if (
dot >= floatcos(fov M_PI 360))
        return 
true

    
return false
}

stock fm_trace_line(ignoreent, const Float:start[3], const Float:end[3], Float:ret[3]) {
    
engfunc(EngFunc_TraceLinestartendignoreent == -0ignoreent0)

    new 
ent get_tr2(0TR_pHit)
    
get_tr2(0TR_vecEndPosret)

    return 
pev_valid(ent) ? ent 0

Apb hq is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-20-2018 , 10:03   Re: Entity marker
Reply With Quote #2

Maybe you can get these origins with some math through glb_v_up and glb_v_right, then you will just need to call TE_BEAMPOINTS to emulate the traces.
__________________









Last edited by CrazY.; 07-20-2018 at 10:03.
CrazY. 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 11:54.


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