Discord sunucumuz açılmıştır, hepinizi bekleriz

https://discord.gg/43gGDQe6tS

Hatalı Eklenti - Error Logları

CSDurağı panel kullanımı hakkında bilgiler, merak ettikleriniz, takıldığınız yerleri burada sorabilirsiniz

Moderatör: Moderatörler

Kullanıcı avatarı

Konu Sahibi
holigan
Mesajlar: 1531
Kayıt: Sal May 10, 2016 12:21 pm
Konum: İstanbul
Server Ip/DNS: 213.238.173.117
Clan İsmi: Holigan | Clan

Hatalı Eklenti - Error Logları

Mesaj gönderen holigan »

uzman59 yazdı:@holigan

Denermisin..

Kod: Tümünü seç

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <xs>
#include <zombieplague>

#define PLUGIN "[Zombie: The Hero] Addon: SupplyBox"
#define VERSION "2.0"
#define AUTHOR "Dias"

native get_dmp7a1(id)
native get_cyclone(id)
native get_ethereal(id)
native get_railcannon(id)
native get_bloodhunter(id)
native get_sgdrill(id)

// Config
const MAX_SUPPLYBOX_ENT = 100

new const supplybox_model[] = "models/supply/supplybox4.mdl"
new const supplybox_drop_sound[] = "supply/supply_drop.wav"
new const supplybox_pickup_sound[] = "supply/supply_pickup.wav"
new const supplybox_icon_spr[] = "sprites/supply/icon_supplybox.spr"

#define SUPPLYBOX_CLASSNAME "supplybox"
#define SUPPLYBOX_MAX 16
#define SUPPLYBOX_NUM 2
#define SUPPLYBOX_TOTAL_IN_TIME 4
#define SUPPLYBOX_DROPTIME 30
#define SUPPLYBOX_RADARNICON_DELAY 0.01
#define SUPPLYBOX_ICON 1
#define SUPPLYBOX_ICON_SIZE 2
#define SUPPLYBOX_ICON_LIGHT 70

#define TASK_SUPPLYBOX 128256
#define TASK_SUPPLYBOX2 138266
#define TASK_SUPPLYBOX_HELP 129257
#define TASK_SUPPLYBOX_WAIT 130259

// Hard Code
new g_supplybox_num, g_supplybox_wait[33], supplybox_count, supplybox_ent[MAX_SUPPLYBOX_ENT],
g_supplybox_icon_id, bool:made_supplybox, g_newround, g_endround, Float:g_hud_supplybox_delay[33]

// Spawn Point Research
#define MAX_SPAWN_POINT 40
#define MAX_RETRY 33
new Float:player_spawn_point[MAX_SPAWN_POINT][3]
new player_spawn_point_count

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_event("HLTV", "Event_Newround", "a", "1=0", "2=0")
    register_touch(SUPPLYBOX_CLASSNAME, "player", "fw_Touch_SupplyBox")
    //register_logevent("logevent_round_start", 2, "1=Round_Start")
    register_logevent("logevent_round_end", 2, "1=Round_End")
}

public plugin_precache()
{
    engfunc(EngFunc_PrecacheModel, supplybox_model)
    
    engfunc(EngFunc_PrecacheSound, supplybox_drop_sound)
    engfunc(EngFunc_PrecacheSound, supplybox_pickup_sound)
    
    g_supplybox_icon_id = engfunc(EngFunc_PrecacheModel, supplybox_icon_spr)
}

public plugin_cfg()
{
    research_map()
}

public research_map()
{
    static player
    
    while((player = find_ent_by_class(player, "info_player_deathmatch")) 
    || (player = find_ent_by_class(player, "info_player_start")) != 0)
    {
        if(!pev_valid(player))
            continue
            
        pev(player, pev_origin, player_spawn_point[player_spawn_point_count])
        player_spawn_point_count++
    }

}

public client_PostThink(id)
{
    if(get_gametime() - SUPPLYBOX_RADARNICON_DELAY <= g_hud_supplybox_delay[id])
        return
        
    g_hud_supplybox_delay[id] = get_gametime()
        
    if(!is_user_alive(id))
        return
    if(zp_get_user_zombie(id))
        return
    if(!supplybox_count)
        return
        
    static i, next_ent
    i = 1
    while(i <= supplybox_count)
    {
        next_ent = supplybox_ent[i]
        if (next_ent && pev_valid(next_ent))
        {
            create_icon_origin(id, next_ent, g_supplybox_icon_id)
        }

        i++
    }            
}

public Event_Newround()
{
    made_supplybox = false
    g_newround = 1
    g_endround = 0
    
    remove_supplybox()
    supplybox_count = 0
    
    if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
    if(task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
    if(task_exists(TASK_SUPPLYBOX_HELP)) remove_task(TASK_SUPPLYBOX_HELP)    
}

public remove_supplybox()
{
    remove_entity_name(SUPPLYBOX_CLASSNAME)
    
    new supplybox_ent_reset[MAX_SUPPLYBOX_ENT]
    supplybox_ent = supplybox_ent_reset
}

public logevent_round_end() g_endround = 1
public zp_user_infected_post()
{
    if(!made_supplybox)
    {
        g_newround = 0
        made_supplybox = true
        
        if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
        set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
    }
}

public create_supplybox()
{
    if (supplybox_count >= SUPPLYBOX_MAX || g_newround || g_endround) 
        return

    if (task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
    set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
    
    if (get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME) 
        return

    g_supplybox_num = 0
    create_supplybox2()
    
    client_cmd(0, "spk ^"%s^"", supplybox_drop_sound)
    client_print(0, print_center, "Malzeme Kutusu Geldi !!!")
    
    if (task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
    set_task(0.5, "create_supplybox2", TASK_SUPPLYBOX2, _, _, "b")    
}

public create_supplybox2()
{
    if (supplybox_count >= SUPPLYBOX_MAX
    || get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME || g_newround || g_endround)
    {
        remove_task(TASK_SUPPLYBOX2)
        return
    }
    
    supplybox_count++
    g_supplybox_num++

    new ent = create_entity("info_target")
    
    entity_set_string(ent, EV_SZ_classname, SUPPLYBOX_CLASSNAME)
    entity_set_model(ent, supplybox_model)    
    entity_set_size(ent,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0})
    entity_set_int(ent,EV_INT_solid,1)
    entity_set_int(ent,EV_INT_movetype,6)
    //entity_set_int(ent, EV_INT_iuser1, item)
    entity_set_int(ent, EV_INT_iuser2, supplybox_count)
    
    do_random_spawn(ent, MAX_RETRY)
    
    supplybox_ent[supplybox_count] = ent

    if ((g_supplybox_num >= SUPPLYBOX_NUM) && task_exists(TASK_SUPPLYBOX2)) 
        remove_task(TASK_SUPPLYBOX2)
}

public fw_Touch_SupplyBox(ent, id)
{
    if(!pev_valid(ent))
        return
    if(!is_user_alive(id))
        return
    if(zp_get_user_zombie(id))
        return
    
    get_random_weapon(id)
    emit_sound(id, CHAN_VOICE, supplybox_pickup_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)

    new num_box = entity_get_int(ent, EV_INT_iuser2)
    supplybox_ent[num_box] = 0
    remove_entity(ent)

    g_supplybox_wait[id] = 1
    if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
    set_task(2.0, "remove_supplybox_wait", id+TASK_SUPPLYBOX_WAIT)
    
    return
}

public get_random_weapon(id)
{
    switch(random_num(0,82))
    {
        case 0..20: get_dmp7a1(id)
        case 21..31: get_cyclone(id)
        case 32..43: get_ethereal(id)
        case 44..51: get_railcannon(id)
        case 52..67: get_bloodhunter(id)
        case 68..82: get_sgdrill(id)
    }
}

public remove_supplybox_wait(id)
{
    id -= TASK_SUPPLYBOX_WAIT
    
    g_supplybox_wait[id] = 0
    if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
}

public get_total_supplybox()
{
    new total
    for (new i = 1; i <= supplybox_count; i++)
    {
        if (supplybox_ent[i]) total += 1
    }
    return total
}

public do_random_spawn(id, retry_count)
{
    if(!pev_valid(id))
        return
    
    static hull, Float:Origin[3], random_mem
    hull = (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN
    
    random_mem = random_num(0, player_spawn_point_count - 1)
    Origin[0] = player_spawn_point[random_mem][0]
    Origin[1] = player_spawn_point[random_mem][1]
    Origin[2] = player_spawn_point[random_mem][2]
    
    if(is_hull_vacant(Origin, hull))
        engfunc(EngFunc_SetOrigin, id, Origin)
    else
    {
        if(retry_count > 0)
        {
            retry_count--
            do_random_spawn(id, retry_count)
        }
    }
}

stock is_hull_vacant(Float:origin[3], hull)
{
    engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, 0)
    
    if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen))
        return true;
    
    return false;
}

stock create_icon_origin(id, ent, sprite) // By sontung0
{
    if (!pev_valid(ent)) return;
    if(!is_user_alive(id)) return
    
    new Float:fMyOrigin[3]
    entity_get_vector(id, EV_VEC_origin, fMyOrigin)
    
    new target = ent
    new Float:fTargetOrigin[3]
    entity_get_vector(target, EV_VEC_origin, fTargetOrigin)
    fTargetOrigin[2] += 40.0
    
    if (!is_in_viewcone(id, fTargetOrigin)) return;

    new Float:fMiddle[3], Float:fHitPoint[3]
    xs_vec_sub(fTargetOrigin, fMyOrigin, fMiddle)
    trace_line(-1, fMyOrigin, fTargetOrigin, fHitPoint)
                            
    new Float:fWallOffset[3], Float:fDistanceToWall
    fDistanceToWall = vector_distance(fMyOrigin, fHitPoint) - 10.0
    normalize(fMiddle, fWallOffset, fDistanceToWall)
    
    new Float:fSpriteOffset[3]
    xs_vec_add(fWallOffset, fMyOrigin, fSpriteOffset)
    new Float:fScale
    fScale = 0.01 * fDistanceToWall
    
    new scale = floatround(fScale)
    scale = max(scale, 1)
    scale = min(scale, SUPPLYBOX_ICON_SIZE)
    scale = max(scale, 1)

    te_sprite(id, fSpriteOffset, sprite, scale, SUPPLYBOX_ICON_LIGHT)
}

stock te_sprite(id, Float:origin[3], sprite, scale, brightness) // By sontung0
{    
    message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
    write_byte(TE_SPRITE)
    write_coord(floatround(origin[0]))
    write_coord(floatround(origin[1]))
    write_coord(floatround(origin[2]))
    write_short(sprite)
    write_byte(scale) 
    write_byte(brightness)
    message_end()
}

stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul) // By sontung0
{
    new Float:fLen = xs_vec_len(fIn)
    xs_vec_copy(fIn, fOut)
    
    fOut[0] /= fLen, fOut[1] /= fLen, fOut[2] /= fLen
    fOut[0] *= fMul, fOut[1] *= fMul, fOut[2] *= fMul
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1066\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1254\\ deff0\\ deflang1055{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/

 
Kutular düşmüyor.

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

uzman59
Mesajlar: 624
Kayıt: Çrş Nis 06, 2016 7:40 pm
Konum: Tekirdağ İlçesi
Server Ip/DNS: cs11.csduragi.net
Clan İsmi: HospitaL 卍 KLan

Hatalı Eklenti - Error Logları

Mesaj gönderen uzman59 »

@holigan

Önceki eklentilerde kutular düşüyor muydu ?

Önceki attığımda hata log yazmadı mı ?

Deneyiniz..

Kod: Tümünü seç

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <xs>
#include <zombieplague>

#define PLUGIN "[Zombie: The Hero] Addon: SupplyBox"
#define VERSION "2.0"
#define AUTHOR "Dias"

native get_dmp7a1(id)
native get_cyclone(id)
native get_ethereal(id)
native get_railcannon(id)
native get_bloodhunter(id)
native get_sgdrill(id)

// Config
const MAX_SUPPLYBOX_ENT = 100

new const supplybox_model[] = "models/supply/supplybox4.mdl"
new const supplybox_drop_sound[] = "supply/supply_drop.wav"
new const supplybox_pickup_sound[] = "supply/supply_pickup.wav"
new const supplybox_icon_spr[] = "sprites/supply/icon_supplybox.spr"

#define SUPPLYBOX_CLASSNAME "supplybox"
#define SUPPLYBOX_MAX 16
#define SUPPLYBOX_NUM 2
#define SUPPLYBOX_TOTAL_IN_TIME 4
#define SUPPLYBOX_DROPTIME 30
#define SUPPLYBOX_RADARNICON_DELAY 0.01
#define SUPPLYBOX_ICON 1
#define SUPPLYBOX_ICON_SIZE 2
#define SUPPLYBOX_ICON_LIGHT 70

#define TASK_SUPPLYBOX 128256
#define TASK_SUPPLYBOX2 138266
#define TASK_SUPPLYBOX_HELP 129257
#define TASK_SUPPLYBOX_WAIT 130259

// Hard Code
new g_supplybox_num, g_supplybox_wait[33], supplybox_count, supplybox_ent[MAX_SUPPLYBOX_ENT],
g_supplybox_icon_id, bool:made_supplybox, g_newround, g_endround, Float:g_hud_supplybox_delay[33]

// Spawn Point Research
#define MAX_SPAWN_POINT 40
#define MAX_RETRY 33
new Float:player_spawn_point[MAX_SPAWN_POINT][3]
new player_spawn_point_count

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_event("HLTV", "Event_Newround", "a", "1=0", "2=0")
    register_touch(SUPPLYBOX_CLASSNAME, "player", "fw_Touch_SupplyBox")
    //register_logevent("logevent_round_start", 2, "1=Round_Start")
    register_logevent("logevent_round_end", 2, "1=Round_End")
}

public plugin_precache()
{
    engfunc(EngFunc_PrecacheModel, supplybox_model)
    
    engfunc(EngFunc_PrecacheSound, supplybox_drop_sound)
    engfunc(EngFunc_PrecacheSound, supplybox_pickup_sound)
    
    g_supplybox_icon_id = engfunc(EngFunc_PrecacheModel, supplybox_icon_spr)
}

public plugin_cfg()
{
    research_map()
    research_map_edit()
}

public research_map()
{
    static player
    
    while((player = find_ent_by_class(player, "info_player_deathmatch")) != 0)
    {
        if(!pev_valid(player))
            continue
            
        pev(player, pev_origin, player_spawn_point[player_spawn_point_count])
        player_spawn_point_count++
    }

}
public research_map_edit()
{
    static player
    
    while((player = find_ent_by_class(player, "info_player_start")) != 0)
    {
        if(!pev_valid(player))
            continue        
        
        pev(player, pev_origin, player_spawn_point[player_spawn_point_count])
        player_spawn_point_count++
    }    
}
public client_PostThink(id)
{
    if(get_gametime() - SUPPLYBOX_RADARNICON_DELAY <= g_hud_supplybox_delay[id])
        return
        
    g_hud_supplybox_delay[id] = get_gametime()
        
    if(!is_user_alive(id))
        return
    if(zp_get_user_zombie(id))
        return
    if(!supplybox_count)
        return
        
    static i, next_ent
    i = 1
    while(i <= supplybox_count)
    {
        next_ent = supplybox_ent[i]
        if (next_ent && pev_valid(next_ent))
        {
            create_icon_origin(id, next_ent, g_supplybox_icon_id)
        }

        i++
    }            
}

public Event_Newround()
{
    made_supplybox = false
    g_newround = 1
    g_endround = 0
    
    remove_supplybox()
    supplybox_count = 0
    
    if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
    if(task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
    if(task_exists(TASK_SUPPLYBOX_HELP)) remove_task(TASK_SUPPLYBOX_HELP)    
}

public remove_supplybox()
{
    remove_entity_name(SUPPLYBOX_CLASSNAME)
    
    new supplybox_ent_reset[MAX_SUPPLYBOX_ENT]
    supplybox_ent = supplybox_ent_reset
}

public logevent_round_end() g_endround = 1
public zp_user_infected_post()
{
    if(!made_supplybox)
    {
        g_newround = 0
        made_supplybox = true
        
        if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
        set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
    }
}

public create_supplybox()
{
    if (supplybox_count >= SUPPLYBOX_MAX || g_newround || g_endround) 
        return

    if (task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
    set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
    
    if (get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME) 
        return

    g_supplybox_num = 0
    create_supplybox2()
    
    client_cmd(0, "spk ^"%s^"", supplybox_drop_sound)
    client_print(0, print_center, "Malzeme Kutusu Geldi !!!")
    
    if (task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
    set_task(0.5, "create_supplybox2", TASK_SUPPLYBOX2, _, _, "b")    
}

public create_supplybox2()
{
    if (supplybox_count >= SUPPLYBOX_MAX
    || get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME || g_newround || g_endround)
    {
        remove_task(TASK_SUPPLYBOX2)
        return
    }
    
    supplybox_count++
    g_supplybox_num++

    new ent = create_entity("info_target")
    
    entity_set_string(ent, EV_SZ_classname, SUPPLYBOX_CLASSNAME)
    entity_set_model(ent, supplybox_model)    
    entity_set_size(ent,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0})
    entity_set_int(ent,EV_INT_solid,1)
    entity_set_int(ent,EV_INT_movetype,6)
    //entity_set_int(ent, EV_INT_iuser1, item)
    entity_set_int(ent, EV_INT_iuser2, supplybox_count)
    
    do_random_spawn(ent, MAX_RETRY)
    
    supplybox_ent[supplybox_count] = ent

    if ((g_supplybox_num >= SUPPLYBOX_NUM) && task_exists(TASK_SUPPLYBOX2)) 
        remove_task(TASK_SUPPLYBOX2)
}

public fw_Touch_SupplyBox(ent, id)
{
    if(!pev_valid(ent))
        return
    if(!is_user_alive(id))
        return
    if(zp_get_user_zombie(id))
        return
    
    get_random_weapon(id)
    emit_sound(id, CHAN_VOICE, supplybox_pickup_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)

    new num_box = entity_get_int(ent, EV_INT_iuser2)
    supplybox_ent[num_box] = 0
    remove_entity(ent)

    g_supplybox_wait[id] = 1
    if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
    set_task(2.0, "remove_supplybox_wait", id+TASK_SUPPLYBOX_WAIT)
    
    return
}

public get_random_weapon(id)
{
    switch(random_num(0,82))
    {
        case 0..20: get_dmp7a1(id)
        case 21..31: get_cyclone(id)
        case 32..43: get_ethereal(id)
        case 44..51: get_railcannon(id)
        case 52..67: get_bloodhunter(id)
        case 68..82: get_sgdrill(id)
    }
}

public remove_supplybox_wait(id)
{
    id -= TASK_SUPPLYBOX_WAIT
    
    g_supplybox_wait[id] = 0
    if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
}

public get_total_supplybox()
{
    new total
    for (new i = 1; i <= supplybox_count; i++)
    {
        if (supplybox_ent[i]) total += 1
    }
    return total
}

public do_random_spawn(id, retry_count)
{
    if(!pev_valid(id))
        return
    
    static hull, Float:Origin[3], random_mem
    hull = (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN
    
    random_mem = random_num(0, player_spawn_point_count - 1)
    Origin[0] = player_spawn_point[random_mem][0]
    Origin[1] = player_spawn_point[random_mem][1]
    Origin[2] = player_spawn_point[random_mem][2]
    
    if(is_hull_vacant(Origin, hull))
        engfunc(EngFunc_SetOrigin, id, Origin)
    else
    {
        if(retry_count > 0)
        {
            retry_count--
            do_random_spawn(id, retry_count)
        }
    }
}

stock is_hull_vacant(Float:origin[3], hull)
{
    engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, 0)
    
    if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen))
        return true;
    
    return false;
}

stock create_icon_origin(id, ent, sprite) // By sontung0
{
    if (!pev_valid(ent)) return;
    if(!is_user_alive(id)) return
    
    new Float:fMyOrigin[3]
    entity_get_vector(id, EV_VEC_origin, fMyOrigin)
    
    new target = ent
    new Float:fTargetOrigin[3]
    entity_get_vector(target, EV_VEC_origin, fTargetOrigin)
    fTargetOrigin[2] += 40.0
    
    if (!is_in_viewcone(id, fTargetOrigin)) return;

    new Float:fMiddle[3], Float:fHitPoint[3]
    xs_vec_sub(fTargetOrigin, fMyOrigin, fMiddle)
    trace_line(-1, fMyOrigin, fTargetOrigin, fHitPoint)
                            
    new Float:fWallOffset[3], Float:fDistanceToWall
    fDistanceToWall = vector_distance(fMyOrigin, fHitPoint) - 10.0
    normalize(fMiddle, fWallOffset, fDistanceToWall)
    
    new Float:fSpriteOffset[3]
    xs_vec_add(fWallOffset, fMyOrigin, fSpriteOffset)
    new Float:fScale
    fScale = 0.01 * fDistanceToWall
    
    new scale = floatround(fScale)
    scale = max(scale, 1)
    scale = min(scale, SUPPLYBOX_ICON_SIZE)
    scale = max(scale, 1)

    te_sprite(id, fSpriteOffset, sprite, scale, SUPPLYBOX_ICON_LIGHT)
}

stock te_sprite(id, Float:origin[3], sprite, scale, brightness) // By sontung0
{    
    message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
    write_byte(TE_SPRITE)
    write_coord(floatround(origin[0]))
    write_coord(floatround(origin[1]))
    write_coord(floatround(origin[2]))
    write_short(sprite)
    write_byte(scale) 
    write_byte(brightness)
    message_end()
}

stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul) // By sontung0
{
    new Float:fLen = xs_vec_len(fIn)
    xs_vec_copy(fIn, fOut)
    
    fOut[0] /= fLen, fOut[1] /= fLen, fOut[2] /= fLen
    fOut[0] *= fMul, fOut[1] *= fMul, fOut[2] *= fMul
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1066\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1254\\ deff0\\ deflang1055{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/

Bu mesaja eklenen dosyaları görüntülemek için gerekli izinlere sahip değilsiniz.

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

Konu Sahibi
holigan
Mesajlar: 1531
Kayıt: Sal May 10, 2016 12:21 pm
Konum: İstanbul
Server Ip/DNS: 213.238.173.117
Clan İsmi: Holigan | Clan

Hatalı Eklenti - Error Logları

Mesaj gönderen holigan »

İlk attığın eklentide bir native yanlışı yapmıştım aktif olmuyordu düzelttim çalışıyor ama log veriyor.

Kod: Tümünü seç

L 06/30/2017 - 23:10:40: [AMXX] Run time error 4: index out of bounds 
L 06/30/2017 - 23:10:40: [AMXX]    [0] zp_addon_supply_box_4.3.sma::research_map (line 85)
L 06/30/2017 - 23:10:40: [AMXX]    [1] zp_addon_supply_box_4.3.sma::plugin_cfg (line 72)
Sonradan attığına debug yazmayı unutmuşum oda hata vermiş muhtemelen aynı hatadır.

uzman59 yazdı:@holigan

Önceki eklentilerde kutular düşüyor muydu ?

Önceki attığımda hata log yazmadı mı ?

Deneyiniz..

Kod: Tümünü seç

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <xs>
#include <zombieplague>

#define PLUGIN "[Zombie: The Hero] Addon: SupplyBox"
#define VERSION "2.0"
#define AUTHOR "Dias"

native get_dmp7a1(id)
native get_cyclone(id)
native get_ethereal(id)
native get_railcannon(id)
native get_bloodhunter(id)
native get_sgdrill(id)

// Config
const MAX_SUPPLYBOX_ENT = 100

new const supplybox_model[] = "models/supply/supplybox4.mdl"
new const supplybox_drop_sound[] = "supply/supply_drop.wav"
new const supplybox_pickup_sound[] = "supply/supply_pickup.wav"
new const supplybox_icon_spr[] = "sprites/supply/icon_supplybox.spr"

#define SUPPLYBOX_CLASSNAME "supplybox"
#define SUPPLYBOX_MAX 16
#define SUPPLYBOX_NUM 2
#define SUPPLYBOX_TOTAL_IN_TIME 4
#define SUPPLYBOX_DROPTIME 30
#define SUPPLYBOX_RADARNICON_DELAY 0.01
#define SUPPLYBOX_ICON 1
#define SUPPLYBOX_ICON_SIZE 2
#define SUPPLYBOX_ICON_LIGHT 70

#define TASK_SUPPLYBOX 128256
#define TASK_SUPPLYBOX2 138266
#define TASK_SUPPLYBOX_HELP 129257
#define TASK_SUPPLYBOX_WAIT 130259

// Hard Code
new g_supplybox_num, g_supplybox_wait[33], supplybox_count, supplybox_ent[MAX_SUPPLYBOX_ENT],
g_supplybox_icon_id, bool:made_supplybox, g_newround, g_endround, Float:g_hud_supplybox_delay[33]

// Spawn Point Research
#define MAX_SPAWN_POINT 40
#define MAX_RETRY 33
new Float:player_spawn_point[MAX_SPAWN_POINT][3]
new player_spawn_point_count

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_event("HLTV", "Event_Newround", "a", "1=0", "2=0")
    register_touch(SUPPLYBOX_CLASSNAME, "player", "fw_Touch_SupplyBox")
    //register_logevent("logevent_round_start", 2, "1=Round_Start")
    register_logevent("logevent_round_end", 2, "1=Round_End")
}

public plugin_precache()
{
    engfunc(EngFunc_PrecacheModel, supplybox_model)
    
    engfunc(EngFunc_PrecacheSound, supplybox_drop_sound)
    engfunc(EngFunc_PrecacheSound, supplybox_pickup_sound)
    
    g_supplybox_icon_id = engfunc(EngFunc_PrecacheModel, supplybox_icon_spr)
}

public plugin_cfg()
{
    research_map()
    research_map_edit()
}

public research_map()
{
    static player
    
    while((player = find_ent_by_class(player, "info_player_deathmatch")) != 0)
    {
        if(!pev_valid(player))
            continue
            
        pev(player, pev_origin, player_spawn_point[player_spawn_point_count])
        player_spawn_point_count++
    }

}
public research_map_edit()
{
    static player
    
    while((player = find_ent_by_class(player, "info_player_start")) != 0)
    {
        if(!pev_valid(player))
            continue        
        
        pev(player, pev_origin, player_spawn_point[player_spawn_point_count])
        player_spawn_point_count++
    }    
}
public client_PostThink(id)
{
    if(get_gametime() - SUPPLYBOX_RADARNICON_DELAY <= g_hud_supplybox_delay[id])
        return
        
    g_hud_supplybox_delay[id] = get_gametime()
        
    if(!is_user_alive(id))
        return
    if(zp_get_user_zombie(id))
        return
    if(!supplybox_count)
        return
        
    static i, next_ent
    i = 1
    while(i <= supplybox_count)
    {
        next_ent = supplybox_ent[i]
        if (next_ent && pev_valid(next_ent))
        {
            create_icon_origin(id, next_ent, g_supplybox_icon_id)
        }

        i++
    }            
}

public Event_Newround()
{
    made_supplybox = false
    g_newround = 1
    g_endround = 0
    
    remove_supplybox()
    supplybox_count = 0
    
    if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
    if(task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
    if(task_exists(TASK_SUPPLYBOX_HELP)) remove_task(TASK_SUPPLYBOX_HELP)    
}

public remove_supplybox()
{
    remove_entity_name(SUPPLYBOX_CLASSNAME)
    
    new supplybox_ent_reset[MAX_SUPPLYBOX_ENT]
    supplybox_ent = supplybox_ent_reset
}

public logevent_round_end() g_endround = 1
public zp_user_infected_post()
{
    if(!made_supplybox)
    {
        g_newround = 0
        made_supplybox = true
        
        if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
        set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
    }
}

public create_supplybox()
{
    if (supplybox_count >= SUPPLYBOX_MAX || g_newround || g_endround) 
        return

    if (task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
    set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
    
    if (get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME) 
        return

    g_supplybox_num = 0
    create_supplybox2()
    
    client_cmd(0, "spk ^"%s^"", supplybox_drop_sound)
    client_print(0, print_center, "Malzeme Kutusu Geldi !!!")
    
    if (task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
    set_task(0.5, "create_supplybox2", TASK_SUPPLYBOX2, _, _, "b")    
}

public create_supplybox2()
{
    if (supplybox_count >= SUPPLYBOX_MAX
    || get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME || g_newround || g_endround)
    {
        remove_task(TASK_SUPPLYBOX2)
        return
    }
    
    supplybox_count++
    g_supplybox_num++

    new ent = create_entity("info_target")
    
    entity_set_string(ent, EV_SZ_classname, SUPPLYBOX_CLASSNAME)
    entity_set_model(ent, supplybox_model)    
    entity_set_size(ent,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0})
    entity_set_int(ent,EV_INT_solid,1)
    entity_set_int(ent,EV_INT_movetype,6)
    //entity_set_int(ent, EV_INT_iuser1, item)
    entity_set_int(ent, EV_INT_iuser2, supplybox_count)
    
    do_random_spawn(ent, MAX_RETRY)
    
    supplybox_ent[supplybox_count] = ent

    if ((g_supplybox_num >= SUPPLYBOX_NUM) && task_exists(TASK_SUPPLYBOX2)) 
        remove_task(TASK_SUPPLYBOX2)
}

public fw_Touch_SupplyBox(ent, id)
{
    if(!pev_valid(ent))
        return
    if(!is_user_alive(id))
        return
    if(zp_get_user_zombie(id))
        return
    
    get_random_weapon(id)
    emit_sound(id, CHAN_VOICE, supplybox_pickup_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)

    new num_box = entity_get_int(ent, EV_INT_iuser2)
    supplybox_ent[num_box] = 0
    remove_entity(ent)

    g_supplybox_wait[id] = 1
    if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
    set_task(2.0, "remove_supplybox_wait", id+TASK_SUPPLYBOX_WAIT)
    
    return
}

public get_random_weapon(id)
{
    switch(random_num(0,82))
    {
        case 0..20: get_dmp7a1(id)
        case 21..31: get_cyclone(id)
        case 32..43: get_ethereal(id)
        case 44..51: get_railcannon(id)
        case 52..67: get_bloodhunter(id)
        case 68..82: get_sgdrill(id)
    }
}

public remove_supplybox_wait(id)
{
    id -= TASK_SUPPLYBOX_WAIT
    
    g_supplybox_wait[id] = 0
    if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
}

public get_total_supplybox()
{
    new total
    for (new i = 1; i <= supplybox_count; i++)
    {
        if (supplybox_ent[i]) total += 1
    }
    return total
}

public do_random_spawn(id, retry_count)
{
    if(!pev_valid(id))
        return
    
    static hull, Float:Origin[3], random_mem
    hull = (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN
    
    random_mem = random_num(0, player_spawn_point_count - 1)
    Origin[0] = player_spawn_point[random_mem][0]
    Origin[1] = player_spawn_point[random_mem][1]
    Origin[2] = player_spawn_point[random_mem][2]
    
    if(is_hull_vacant(Origin, hull))
        engfunc(EngFunc_SetOrigin, id, Origin)
    else
    {
        if(retry_count > 0)
        {
            retry_count--
            do_random_spawn(id, retry_count)
        }
    }
}

stock is_hull_vacant(Float:origin[3], hull)
{
    engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, 0)
    
    if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen))
        return true;
    
    return false;
}

stock create_icon_origin(id, ent, sprite) // By sontung0
{
    if (!pev_valid(ent)) return;
    if(!is_user_alive(id)) return
    
    new Float:fMyOrigin[3]
    entity_get_vector(id, EV_VEC_origin, fMyOrigin)
    
    new target = ent
    new Float:fTargetOrigin[3]
    entity_get_vector(target, EV_VEC_origin, fTargetOrigin)
    fTargetOrigin[2] += 40.0
    
    if (!is_in_viewcone(id, fTargetOrigin)) return;

    new Float:fMiddle[3], Float:fHitPoint[3]
    xs_vec_sub(fTargetOrigin, fMyOrigin, fMiddle)
    trace_line(-1, fMyOrigin, fTargetOrigin, fHitPoint)
                            
    new Float:fWallOffset[3], Float:fDistanceToWall
    fDistanceToWall = vector_distance(fMyOrigin, fHitPoint) - 10.0
    normalize(fMiddle, fWallOffset, fDistanceToWall)
    
    new Float:fSpriteOffset[3]
    xs_vec_add(fWallOffset, fMyOrigin, fSpriteOffset)
    new Float:fScale
    fScale = 0.01 * fDistanceToWall
    
    new scale = floatround(fScale)
    scale = max(scale, 1)
    scale = min(scale, SUPPLYBOX_ICON_SIZE)
    scale = max(scale, 1)

    te_sprite(id, fSpriteOffset, sprite, scale, SUPPLYBOX_ICON_LIGHT)
}

stock te_sprite(id, Float:origin[3], sprite, scale, brightness) // By sontung0
{    
    message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
    write_byte(TE_SPRITE)
    write_coord(floatround(origin[0]))
    write_coord(floatround(origin[1]))
    write_coord(floatround(origin[2]))
    write_short(sprite)
    write_byte(scale) 
    write_byte(brightness)
    message_end()
}

stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul) // By sontung0
{
    new Float:fLen = xs_vec_len(fIn)
    xs_vec_copy(fIn, fOut)
    
    fOut[0] /= fLen, fOut[1] /= fLen, fOut[2] /= fLen
    fOut[0] *= fMul, fOut[1] *= fMul, fOut[2] *= fMul
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1066\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1254\\ deff0\\ deflang1055{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/

 

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

Konu Sahibi
holigan
Mesajlar: 1531
Kayıt: Sal May 10, 2016 12:21 pm
Konum: İstanbul
Server Ip/DNS: 213.238.173.117
Clan İsmi: Holigan | Clan

Hatalı Eklenti - Error Logları

Mesaj gönderen holigan »

Uzman şu yorumuma bakarmısın sayfa 4 te
holigan yazdı:Zombie hero modun supply box eklentisi var uyarlamaya çalıştım farklı sıkıntılar çıktı.

İNC;

Kod: Tümünü seç

enum
{
	SYNCHUD_NOTICE = 2,
	SYNCHUD_HUMANZOMBIE_ITEM,
	SYNCHUD_ZBHM_SKILL1,
	SYNCHUD_ZBHM_SKILL2,
	SYNCHUD_ZBHM_SKILL3,
	SYCHUDD_EFFECTKILLER
}

enum
{
	SEX_MALE = 0,
	SEX_FEMALE
}

enum // Win Team
{
	WIN_ALL = 0,
	WIN_ZOMBIE,
	WIN_HUMAN
}

enum // This is Shop
{
	TEAM_ALL = 0,
	TEAM_ZOMBIE,
	TEAM_HUMAN
}

enum
{
	HUMAN_NORMAL = 0,
	HUMAN_SIDEKICK,
	HUMAN_HERO
}

/* ============================
-- Zombie Class Secret Code
- Berserker: 1912
- Light: 1942
- Heal: 1957
- Deimos: 1962
- Banshee: 1975
- Stamper: 1986
- Sting Finger: 1996
==============================*/

// Get Native
native zbheroex_get_round_damage(id);
native zbheroex_get_round_score(id);
native zbheroex_get_synchud_id(hudtype);
native zbheroex_get_user_zombie(id); // Return if User is A Zombie
native zbheroex_get_user_zombie_class(id); // Return id class of zombie
native zbheroex_get_user_hero(id);
native zbheroex_set_user_speed(id, Speed);
native zbheroex_reset_user_speed(id);
native zbheroex_set_user_health(id, Health, Full);
native zbheroex_get_maxhealth(id);
native zbheroex_set_user_rendering(id, fx, r, g, b, render, amount);
native zbheroex_get_user_time(id);
native zbheroex_set_user_time(id, Time);
native zbheroex_set_user_nvg(id, Give, On, Sound, IgnoreHadNVG);
native zbheroex_get_user_nvg(id, Have, On);
native zbheroex_get_user_female(id);
native zbheroex_set_user_female(id);
native zbheroex_get_user_level(id);
native zbheroex_set_user_level(id, Level);
native zbheroex_set_max_level(id, Level);
native zbheroex_get_zombiecode(ClassID);
native zbheroex_set_zombiecode(ClassID, Code);
native zbheroex_set_respawntime(id, Time);
native zbheroex_get_user_nightstalker(id);
native zbheroex_get_user_survivor(id);

// From Other
native zbheroex_show_attachment(id, const Sprite[], Float:Time, Float:Scale, Float:FrameRate, TotalFrame);
native zbheroex_register_specialweapon(const Name[], Type);

// Shop
native zbheroex_set_item_status(id, ItemID, Unlock);
native zbheroex_register_item(const Name[], const Desc[], Cost, Team);
forward zbheroex_shop_item_bought(id, ItemId);

// Register Zombie Class
native zbheroex_register_zombie_class(const Name[], const Desc[], Sex, LockCost, Float:Gravity, Float:Speed, Float:KnockBack);
native zbheroex_set_zombie_class_data1(const ModelHost[], const ModelOrigin[], const ClawsModel_Host[], const ClawsModel_Origin[]);
native zbheroex_set_zombie_class_data2(const DeathSound1[], const DeathSound2[], const HurtSound1[], const HurtSound2[], const HealSound[], const EvolSound[]);

// Shop
native zbheroex_register_weapon(const Name[], Type, BasedOn, Cost);
forward zbheroex_weapon_bought(id, ItemID);
forward zbheroex_weapon_remove(id, ItemID);

// Forward
forward zbheroex_user_infected(id, infector, infection);
forward zbheroex_user_nightstalker(id);
forward zbheroex_user_survivor(id);
forward zbheroex_user_spawned(id, Zombie);
forward zbheroex_user_died(id, attacker, headshot);
forward zbheroex_class_active(id, ClassID);
forward zbheroex_class_unactive(id, ClassID);
forward zbheroex_time_change();
forward zbheroex_skill_show(id, Zombie);
forward zbheroex_zombie_skill(id, ClassID);
forward zbheroex_user_evolved(id, Level);
forward zbheroex_user_hero(id, FemaleHero);
forward zbheroex_round_new();
forward zbheroex_round_start();
forward zbheroex_round_end(WinTeam);
forward zbheroex_game_start();
forward zbheroex_user_nvg(id, on, zombie);
forward zbheroex_round_damage(id, Damage);

forward zbheroex_specialweapon(id, PlayerSubType, ItemID);
forward zbheroex_specialweapon_remove(id, ItemID);
forward zbheroex_specialweapon_refill(id, ItemID);
Kutu eklentisi ve Modun .sma dosyası da burada.

Kutudaki zombie hero moduna ait bölümler;
zbheroex_round_new
zbheroex_game_start
zbheroex_get_user_zombie

Sadece bu 3 kod var ve zbheroex_get_user_zombie zaten zp_get_user_zombie olarak değiştirildiğinde geriye sadece ;
zbheroex_round_new
zbheroex_game_start
Bu iki kod kalıyor onlarada siz bir bakın.

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

uzman59
Mesajlar: 624
Kayıt: Çrş Nis 06, 2016 7:40 pm
Konum: Tekirdağ İlçesi
Server Ip/DNS: cs11.csduragi.net
Clan İsmi: HospitaL 卍 KLan

Hatalı Eklenti - Error Logları

Mesaj gönderen uzman59 »

@holigan

Holigan biz derleyip atıyoruz sonradan sende eklenti üzerinde değişikler mi yapıyorsun ?

Native ekledim diyorsun madem sen bastan editle nativeleride ekle öyle bakalım çünkü sen native eklediğin zaman log yazmaya başladığında hata vermiş olan satır numarasına göre biz düzenleme yapıyoruz ,biz editleyip sana attık tan sonra sen eklenti üzerinde değişiklik yaptığında hata bulunun satır farklı çıkar ve bir hatanın nerden kaynaklandığını bulamayız..

Ayrıca debug yazmayı unutmuşsun unutma ,sana attığım her iki eklentiyi yeniden debug yaz dene , çünkü iki eklentide de aynı hatayı vermez yada aynı hatayı varse bile aynı satır da vermez hatayı ..nativelerini eklemeden de bize yollama eklentiyi..

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

Konu Sahibi
holigan
Mesajlar: 1531
Kayıt: Sal May 10, 2016 12:21 pm
Konum: İstanbul
Server Ip/DNS: 213.238.173.117
Clan İsmi: Holigan | Clan

Hatalı Eklenti - Error Logları

Mesaj gönderen holigan »

uzman59 yazdı:@holigan

Holigan biz derleyip atıyoruz sonradan sende eklenti üzerinde değişikler mi yapıyorsun ?

Native ekledim diyorsun madem sen bastan editle nativeleride ekle öyle bakalım çünkü sen native eklediğin zaman log yazmaya başladığında hata vermiş olan satır numarasına göre biz düzenleme yapıyoruz ,biz editleyip sana attık tan sonra sen eklenti üzerinde değişiklik yaptığında hata bulunun satır farklı çıkar ve bir hatanın nerden kaynaklandığını bulamayız..

Ayrıca debug yazmayı unutmuşsun unutma ,sana attığım her iki eklentiyi yeniden debug yaz dene , çünkü iki eklentide de aynı hatayı vermez yada aynı hatayı varse bile aynı satır da vermez hatayı ..nativelerini eklemeden de bize yollama eklentiyi..
Dediğin gibi ayarladım.

İlk eklenti logu;

Kod: Tümünü seç

L 06/30/2017 - 23:10:40: [AMXX] Run time error 4: index out of bounds 
L 06/30/2017 - 23:10:40: [AMXX]    [0] zp_addon_supply_box_4.3.sma::research_map (line 85)
L 06/30/2017 - 23:10:40: [AMXX]    [1] zp_addon_supply_box_4.3.sma::plugin_cfg (line 72)
İkinci Eklenti logu;

Kod: Tümünü seç

L 07/01/2017 - 13:27:03: [AMXX] Run time error 4: index out of bounds 
L 07/01/2017 - 13:27:03: [AMXX]    [0] zp_supply_box.sma::research_map_edit (line 99)
L 07/01/2017 - 13:27:03: [AMXX]    [1] zp_supply_box.sma::plugin_cfg (line 73)
Bu en son attığın eklenti gereken ayarlamaları yaptım daha oynama yapmayacağım yani şuan çalışır halde ama yukarıdaki logu veriyor.

Kod: Tümünü seç

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <xs>
#include <zombieplague>

#define PLUGIN "[Zombie: The Hero] Addon: SupplyBox"
#define VERSION "2.0"
#define AUTHOR "Dias"

native get_dmp7a1(id)
native get_cyclone(id)
native get_ethereal(id)
native get_railcannon(id)
native get_sgdrill(id)

// Config
const MAX_SUPPLYBOX_ENT = 100

new const supplybox_model[] = "models/supply/supplybox4.mdl"
new const supplybox_drop_sound[] = "supply/supply_drop.wav"
new const supplybox_pickup_sound[] = "supply/supply_pickup.wav"
new const supplybox_icon_spr[] = "sprites/supply/icon_supplybox.spr"

#define SUPPLYBOX_CLASSNAME "supplybox"
#define SUPPLYBOX_MAX 16
#define SUPPLYBOX_NUM 2
#define SUPPLYBOX_TOTAL_IN_TIME 4
#define SUPPLYBOX_DROPTIME 30
#define SUPPLYBOX_RADARNICON_DELAY 0.01
#define SUPPLYBOX_ICON 1
#define SUPPLYBOX_ICON_SIZE 2
#define SUPPLYBOX_ICON_LIGHT 70

#define TASK_SUPPLYBOX 128256
#define TASK_SUPPLYBOX2 138266
#define TASK_SUPPLYBOX_HELP 129257
#define TASK_SUPPLYBOX_WAIT 130259

// Hard Code
new g_supplybox_num, g_supplybox_wait[33], supplybox_count, supplybox_ent[MAX_SUPPLYBOX_ENT],
g_supplybox_icon_id, bool:made_supplybox, g_newround, g_endround, Float:g_hud_supplybox_delay[33]

// Spawn Point Research
#define MAX_SPAWN_POINT 40
#define MAX_RETRY 33
new Float:player_spawn_point[MAX_SPAWN_POINT][3]
new player_spawn_point_count

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_event("HLTV", "Event_Newround", "a", "1=0", "2=0")
	register_touch(SUPPLYBOX_CLASSNAME, "player", "fw_Touch_SupplyBox")
	//register_logevent("logevent_round_start", 2, "1=Round_Start")
	register_logevent("logevent_round_end", 2, "1=Round_End")
}

public plugin_precache()
{
	engfunc(EngFunc_PrecacheModel, supplybox_model)
	
	engfunc(EngFunc_PrecacheSound, supplybox_drop_sound)
	engfunc(EngFunc_PrecacheSound, supplybox_pickup_sound)
	
	g_supplybox_icon_id = engfunc(EngFunc_PrecacheModel, supplybox_icon_spr)
}

public plugin_cfg()
{
	research_map()
	research_map_edit()
}

public research_map()
{
	static player
	
	while((player = find_ent_by_class(player, "info_player_deathmatch")) != 0)
	{
		if(!pev_valid(player))
			continue
			
		pev(player, pev_origin, player_spawn_point[player_spawn_point_count])
		player_spawn_point_count++
	}

}
public research_map_edit()
{
	static player
	
	while((player = find_ent_by_class(player, "info_player_start")) != 0)
	{
		if(!pev_valid(player))
			continue		
		
		pev(player, pev_origin, player_spawn_point[player_spawn_point_count])
		player_spawn_point_count++
	}	
}
public client_PostThink(id)
{
	if(get_gametime() - SUPPLYBOX_RADARNICON_DELAY <= g_hud_supplybox_delay[id])
		return
		
	g_hud_supplybox_delay[id] = get_gametime()
		
	if(!is_user_alive(id))
		return
	if(zp_get_user_zombie(id))
		return
	if(!supplybox_count)
		return
		
	static i, next_ent
	i = 1
	while(i <= supplybox_count)
	{
		next_ent = supplybox_ent[i]
		if (next_ent && pev_valid(next_ent))
		{
			create_icon_origin(id, next_ent, g_supplybox_icon_id)
		}

		i++
	}			
}

public Event_Newround()
{
	made_supplybox = false
	g_newround = 1
	g_endround = 0
	
	remove_supplybox()
	supplybox_count = 0
	
	if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
	if(task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
	if(task_exists(TASK_SUPPLYBOX_HELP)) remove_task(TASK_SUPPLYBOX_HELP)	
}

public remove_supplybox()
{
	remove_entity_name(SUPPLYBOX_CLASSNAME)
	
	new supplybox_ent_reset[MAX_SUPPLYBOX_ENT]
	supplybox_ent = supplybox_ent_reset
}

public logevent_round_end() g_endround = 1
public zp_user_infected_post()
{
	if(!made_supplybox)
	{
		g_newround = 0
		made_supplybox = true
		
		if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
		set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
	}
}

public create_supplybox()
{
	if (supplybox_count >= SUPPLYBOX_MAX || g_newround || g_endround) 
		return

	if (task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
	set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
	
	if (get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME) 
		return

	g_supplybox_num = 0
	create_supplybox2()
	
	client_cmd(0, "spk ^"%s^"", supplybox_drop_sound)
	client_print(0, print_center, "Malzeme Kutusu Geldi !!!")
	
	if (task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
	set_task(0.5, "create_supplybox2", TASK_SUPPLYBOX2, _, _, "b")	
}

public create_supplybox2()
{
	if (supplybox_count >= SUPPLYBOX_MAX
	|| get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME || g_newround || g_endround)
	{
		remove_task(TASK_SUPPLYBOX2)
		return
	}
	
	supplybox_count++
	g_supplybox_num++

	new ent = create_entity("info_target")
	
	entity_set_string(ent, EV_SZ_classname, SUPPLYBOX_CLASSNAME)
	entity_set_model(ent, supplybox_model)	
	entity_set_size(ent,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0})
	entity_set_int(ent,EV_INT_solid,1)
	entity_set_int(ent,EV_INT_movetype,6)
	//entity_set_int(ent, EV_INT_iuser1, item)
	entity_set_int(ent, EV_INT_iuser2, supplybox_count)
	
	do_random_spawn(ent, MAX_RETRY)
	
	supplybox_ent[supplybox_count] = ent

	if ((g_supplybox_num >= SUPPLYBOX_NUM) && task_exists(TASK_SUPPLYBOX2)) 
		remove_task(TASK_SUPPLYBOX2)
}

public fw_Touch_SupplyBox(ent, id)
{
	if(!pev_valid(ent))
		return
	if(!is_user_alive(id))
		return
	if(zp_get_user_zombie(id))
		return
	
	get_random_weapon(id)
	emit_sound(id, CHAN_VOICE, supplybox_pickup_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)

	new num_box = entity_get_int(ent, EV_INT_iuser2)
	supplybox_ent[num_box] = 0
	remove_entity(ent)

	g_supplybox_wait[id] = 1
	if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
	set_task(2.0, "remove_supplybox_wait", id+TASK_SUPPLYBOX_WAIT)
	
	return
}

public get_random_weapon(id)
{
	switch(random_num(0,67))
	{
		case 0..20: get_dmp7a1(id)
		case 21..31: get_cyclone(id)
		case 32..43: get_ethereal(id)
		case 44..51: get_railcannon(id)
		case 52..67: get_sgdrill(id)
	}
}

public remove_supplybox_wait(id)
{
	id -= TASK_SUPPLYBOX_WAIT
	
	g_supplybox_wait[id] = 0
	if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
}

public get_total_supplybox()
{
	new total
	for (new i = 1; i <= supplybox_count; i++)
	{
		if (supplybox_ent[i]) total += 1
	}
	return total
}

public do_random_spawn(id, retry_count)
{
	if(!pev_valid(id))
		return
	
	static hull, Float:Origin[3], random_mem
	hull = (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN
	
	random_mem = random_num(0, player_spawn_point_count - 1)
	Origin[0] = player_spawn_point[random_mem][0]
	Origin[1] = player_spawn_point[random_mem][1]
	Origin[2] = player_spawn_point[random_mem][2]
	
	if(is_hull_vacant(Origin, hull))
		engfunc(EngFunc_SetOrigin, id, Origin)
	else
	{
		if(retry_count > 0)
		{
			retry_count--
			do_random_spawn(id, retry_count)
		}
	}
}

stock is_hull_vacant(Float:origin[3], hull)
{
	engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, 0)
	
	if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen))
		return true;
	
	return false;
}

stock create_icon_origin(id, ent, sprite) // By sontung0
{
	if (!pev_valid(ent)) return;
	if(!is_user_alive(id)) return
	
	new Float:fMyOrigin[3]
	entity_get_vector(id, EV_VEC_origin, fMyOrigin)
	
	new target = ent
	new Float:fTargetOrigin[3]
	entity_get_vector(target, EV_VEC_origin, fTargetOrigin)
	fTargetOrigin[2] += 40.0
	
	if (!is_in_viewcone(id, fTargetOrigin)) return;

	new Float:fMiddle[3], Float:fHitPoint[3]
	xs_vec_sub(fTargetOrigin, fMyOrigin, fMiddle)
	trace_line(-1, fMyOrigin, fTargetOrigin, fHitPoint)
							
	new Float:fWallOffset[3], Float:fDistanceToWall
	fDistanceToWall = vector_distance(fMyOrigin, fHitPoint) - 10.0
	normalize(fMiddle, fWallOffset, fDistanceToWall)
	
	new Float:fSpriteOffset[3]
	xs_vec_add(fWallOffset, fMyOrigin, fSpriteOffset)
	new Float:fScale
	fScale = 0.01 * fDistanceToWall
	
	new scale = floatround(fScale)
	scale = max(scale, 1)
	scale = min(scale, SUPPLYBOX_ICON_SIZE)
	scale = max(scale, 1)

	te_sprite(id, fSpriteOffset, sprite, scale, SUPPLYBOX_ICON_LIGHT)
}

stock te_sprite(id, Float:origin[3], sprite, scale, brightness) // By sontung0
{	
	message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
	write_byte(TE_SPRITE)
	write_coord(floatround(origin[0]))
	write_coord(floatround(origin[1]))
	write_coord(floatround(origin[2]))
	write_short(sprite)
	write_byte(scale) 
	write_byte(brightness)
	message_end()
}

stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul) // By sontung0
{
	new Float:fLen = xs_vec_len(fIn)
	xs_vec_copy(fIn, fOut)
	
	fOut[0] /= fLen, fOut[1] /= fLen, fOut[2] /= fLen
	fOut[0] *= fMul, fOut[1] *= fMul, fOut[2] *= fMul
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1066\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1254\\ deff0\\ deflang1055{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

uzman59
Mesajlar: 624
Kayıt: Çrş Nis 06, 2016 7:40 pm
Konum: Tekirdağ İlçesi
Server Ip/DNS: cs11.csduragi.net
Clan İsmi: HospitaL 卍 KLan

Hatalı Eklenti - Error Logları

Mesaj gönderen uzman59 »

@holigan

Deneyiniz...
Sorun varsa bildirin..
info_player_start kullanımdan kaldırılmış..

Kod: Tümünü seç

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <xs>
#include <zombieplague>

#define PLUGIN "[Zombie: The Hero] Addon: SupplyBox"
#define VERSION "2.0"
#define AUTHOR "Dias"

native get_dmp7a1(id)
native get_cyclone(id)
native get_ethereal(id)
native get_railcannon(id)
native get_sgdrill(id)

// Config
const MAX_SUPPLYBOX_ENT = 100

new const supplybox_model[] = "models/supply/supplybox4.mdl"
new const supplybox_drop_sound[] = "supply/supply_drop.wav"
new const supplybox_pickup_sound[] = "supply/supply_pickup.wav"
new const supplybox_icon_spr[] = "sprites/supply/icon_supplybox.spr"

#define SUPPLYBOX_CLASSNAME "supplybox"
#define SUPPLYBOX_MAX 16
#define SUPPLYBOX_NUM 2
#define SUPPLYBOX_TOTAL_IN_TIME 4
#define SUPPLYBOX_DROPTIME 30
#define SUPPLYBOX_RADARNICON_DELAY 0.01
#define SUPPLYBOX_ICON 1
#define SUPPLYBOX_ICON_SIZE 2
#define SUPPLYBOX_ICON_LIGHT 70

#define TASK_SUPPLYBOX 128256
#define TASK_SUPPLYBOX2 138266
#define TASK_SUPPLYBOX_HELP 129257
#define TASK_SUPPLYBOX_WAIT 130259

// Hard Code
new g_supplybox_num, g_supplybox_wait[33], supplybox_count, supplybox_ent[MAX_SUPPLYBOX_ENT],
g_supplybox_icon_id, bool:made_supplybox, g_newround, g_endround, Float:g_hud_supplybox_delay[33]

// Spawn Point Research
#define MAX_SPAWN_POINT 40
#define MAX_RETRY 33
new Float:player_spawn_point[MAX_SPAWN_POINT][3]
new player_spawn_point_count

public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR)
   
   register_event("HLTV", "Event_Newround", "a", "1=0", "2=0")
   register_touch(SUPPLYBOX_CLASSNAME, "player", "fw_Touch_SupplyBox")
   //register_logevent("logevent_round_start", 2, "1=Round_Start")
   register_logevent("logevent_round_end", 2, "1=Round_End")
}

public plugin_precache()
{
   engfunc(EngFunc_PrecacheModel, supplybox_model)
   
   engfunc(EngFunc_PrecacheSound, supplybox_drop_sound)
   engfunc(EngFunc_PrecacheSound, supplybox_pickup_sound)
   
   g_supplybox_icon_id = engfunc(EngFunc_PrecacheModel, supplybox_icon_spr)
}

public plugin_cfg()
{
   research_map()
}

public research_map()
{
   static player
   
   while((player = find_ent_by_class(player, "info_player_deathmatch")) != 0)
   {
      if(!pev_valid(player))
         continue
         
      pev(player, pev_origin, player_spawn_point[player_spawn_point_count])
      player_spawn_point_count++
   }

}

public client_PostThink(id)
{
   if(get_gametime() - SUPPLYBOX_RADARNICON_DELAY <= g_hud_supplybox_delay[id])
      return
      
   g_hud_supplybox_delay[id] = get_gametime()
      
   if(!is_user_alive(id))
      return
   if(zp_get_user_zombie(id))
      return
   if(!supplybox_count)
      return
      
   static i, next_ent
   i = 1
   while(i <= supplybox_count)
   {
      next_ent = supplybox_ent[i]
      if (next_ent && pev_valid(next_ent))
      {
         create_icon_origin(id, next_ent, g_supplybox_icon_id)
      }

      i++
   }         
}

public Event_Newround()
{
   made_supplybox = false
   g_newround = 1
   g_endround = 0
   
   remove_supplybox()
   supplybox_count = 0
   
   if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
   if(task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
   if(task_exists(TASK_SUPPLYBOX_HELP)) remove_task(TASK_SUPPLYBOX_HELP)   
}

public remove_supplybox()
{
   remove_entity_name(SUPPLYBOX_CLASSNAME)
   
   new supplybox_ent_reset[MAX_SUPPLYBOX_ENT]
   supplybox_ent = supplybox_ent_reset
}

public logevent_round_end() g_endround = 1
public zp_user_infected_post()
{
   if(!made_supplybox)
   {
      g_newround = 0
      made_supplybox = true
      
      if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
      set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
   }
}

public create_supplybox()
{
   if (supplybox_count >= SUPPLYBOX_MAX || g_newround || g_endround) 
      return

   if (task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
   set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
   
   if (get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME) 
      return

   g_supplybox_num = 0
   create_supplybox2()
   
   client_cmd(0, "spk ^"%s^"", supplybox_drop_sound)
   client_print(0, print_center, "Malzeme Kutusu Geldi !!!")
   
   if (task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
   set_task(0.5, "create_supplybox2", TASK_SUPPLYBOX2, _, _, "b")   
}

public create_supplybox2()
{
   if (supplybox_count >= SUPPLYBOX_MAX
   || get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME || g_newround || g_endround)
   {
      remove_task(TASK_SUPPLYBOX2)
      return
   }
   
   supplybox_count++
   g_supplybox_num++

   new ent = create_entity("info_target")
   
   entity_set_string(ent, EV_SZ_classname, SUPPLYBOX_CLASSNAME)
   entity_set_model(ent, supplybox_model)   
   entity_set_size(ent,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0})
   entity_set_int(ent,EV_INT_solid,1)
   entity_set_int(ent,EV_INT_movetype,6)
   //entity_set_int(ent, EV_INT_iuser1, item)
   entity_set_int(ent, EV_INT_iuser2, supplybox_count)
   
   do_random_spawn(ent, MAX_RETRY)
   
   supplybox_ent[supplybox_count] = ent

   if ((g_supplybox_num >= SUPPLYBOX_NUM) && task_exists(TASK_SUPPLYBOX2)) 
      remove_task(TASK_SUPPLYBOX2)
}

public fw_Touch_SupplyBox(ent, id)
{
   if(!pev_valid(ent))
      return
   if(!is_user_alive(id))
      return
   if(zp_get_user_zombie(id))
      return
   
   get_random_weapon(id)
   emit_sound(id, CHAN_VOICE, supplybox_pickup_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)

   new num_box = entity_get_int(ent, EV_INT_iuser2)
   supplybox_ent[num_box] = 0
   remove_entity(ent)

   g_supplybox_wait[id] = 1
   if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
   set_task(2.0, "remove_supplybox_wait", id+TASK_SUPPLYBOX_WAIT)
   
   return
}

public get_random_weapon(id)
{
   switch(random_num(0,67))
   {
      case 0..20: get_dmp7a1(id)
      case 21..31: get_cyclone(id)
      case 32..43: get_ethereal(id)
      case 44..51: get_railcannon(id)
      case 52..67: get_sgdrill(id)
   }
}

public remove_supplybox_wait(id)
{
   id -= TASK_SUPPLYBOX_WAIT
   
   g_supplybox_wait[id] = 0
   if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
}

public get_total_supplybox()
{
   new total
   for (new i = 1; i <= supplybox_count; i++)
   {
      if (supplybox_ent[i]) total += 1
   }
   return total
}

public do_random_spawn(id, retry_count)
{
   if(!pev_valid(id))
      return
   
   static hull, Float:Origin[3], random_mem
   hull = (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN
   
   random_mem = random_num(0, player_spawn_point_count - 1)
   Origin[0] = player_spawn_point[random_mem][0]
   Origin[1] = player_spawn_point[random_mem][1]
   Origin[2] = player_spawn_point[random_mem][2]
   
   if(is_hull_vacant(Origin, hull))
      engfunc(EngFunc_SetOrigin, id, Origin)
   else
   {
      if(retry_count > 0)
      {
         retry_count--
         do_random_spawn(id, retry_count)
      }
   }
}

stock is_hull_vacant(Float:origin[3], hull)
{
   engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, 0)
   
   if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen))
      return true;
   
   return false;
}

stock create_icon_origin(id, ent, sprite) // By sontung0
{
   if (!pev_valid(ent)) return;
   if(!is_user_alive(id)) return
   
   new Float:fMyOrigin[3]
   entity_get_vector(id, EV_VEC_origin, fMyOrigin)
   
   new target = ent
   new Float:fTargetOrigin[3]
   entity_get_vector(target, EV_VEC_origin, fTargetOrigin)
   fTargetOrigin[2] += 40.0
   
   if (!is_in_viewcone(id, fTargetOrigin)) return;

   new Float:fMiddle[3], Float:fHitPoint[3]
   xs_vec_sub(fTargetOrigin, fMyOrigin, fMiddle)
   trace_line(-1, fMyOrigin, fTargetOrigin, fHitPoint)
                     
   new Float:fWallOffset[3], Float:fDistanceToWall
   fDistanceToWall = vector_distance(fMyOrigin, fHitPoint) - 10.0
   normalize(fMiddle, fWallOffset, fDistanceToWall)
   
   new Float:fSpriteOffset[3]
   xs_vec_add(fWallOffset, fMyOrigin, fSpriteOffset)
   new Float:fScale
   fScale = 0.01 * fDistanceToWall
   
   new scale = floatround(fScale)
   scale = max(scale, 1)
   scale = min(scale, SUPPLYBOX_ICON_SIZE)
   scale = max(scale, 1)

   te_sprite(id, fSpriteOffset, sprite, scale, SUPPLYBOX_ICON_LIGHT)
}

stock te_sprite(id, Float:origin[3], sprite, scale, brightness) // By sontung0
{   
   message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
   write_byte(TE_SPRITE)
   write_coord(floatround(origin[0]))
   write_coord(floatround(origin[1]))
   write_coord(floatround(origin[2]))
   write_short(sprite)
   write_byte(scale) 
   write_byte(brightness)
   message_end()
}

stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul) // By sontung0
{
   new Float:fLen = xs_vec_len(fIn)
   xs_vec_copy(fIn, fOut)
   
   fOut[0] /= fLen, fOut[1] /= fLen, fOut[2] /= fLen
   fOut[0] *= fMul, fOut[1] *= fMul, fOut[2] *= fMul
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1066\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1254\\ deff0\\ deflang1055{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
 
Bu mesaja eklenen dosyaları görüntülemek için gerekli izinlere sahip değilsiniz.

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

Konu Sahibi
holigan
Mesajlar: 1531
Kayıt: Sal May 10, 2016 12:21 pm
Konum: İstanbul
Server Ip/DNS: 213.238.173.117
Clan İsmi: Holigan | Clan

Hatalı Eklenti - Error Logları

Mesaj gönderen holigan »

Hiç bir oynama yapmadan panele yükledim.

L 07/01/2017 - 21:55:53: [AMXX] Run time error 4: index out of bounds
L 07/01/2017 - 21:55:53: [AMXX] [0] btsz.sma::research_map (line 84)
L 07/01/2017 - 21:55:53: [AMXX] [1] btsz.sma::plugin_cfg (line 72)

uzman59 yazdı:@holigan

Deneyiniz...
Sorun varsa bildirin..
info_player_start kullanımdan kaldırılmış..

Kod: Tümünü seç

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <xs>
#include <zombieplague>

#define PLUGIN "[Zombie: The Hero] Addon: SupplyBox"
#define VERSION "2.0"
#define AUTHOR "Dias"

native get_dmp7a1(id)
native get_cyclone(id)
native get_ethereal(id)
native get_railcannon(id)
native get_sgdrill(id)

// Config
const MAX_SUPPLYBOX_ENT = 100

new const supplybox_model[] = "models/supply/supplybox4.mdl"
new const supplybox_drop_sound[] = "supply/supply_drop.wav"
new const supplybox_pickup_sound[] = "supply/supply_pickup.wav"
new const supplybox_icon_spr[] = "sprites/supply/icon_supplybox.spr"

#define SUPPLYBOX_CLASSNAME "supplybox"
#define SUPPLYBOX_MAX 16
#define SUPPLYBOX_NUM 2
#define SUPPLYBOX_TOTAL_IN_TIME 4
#define SUPPLYBOX_DROPTIME 30
#define SUPPLYBOX_RADARNICON_DELAY 0.01
#define SUPPLYBOX_ICON 1
#define SUPPLYBOX_ICON_SIZE 2
#define SUPPLYBOX_ICON_LIGHT 70

#define TASK_SUPPLYBOX 128256
#define TASK_SUPPLYBOX2 138266
#define TASK_SUPPLYBOX_HELP 129257
#define TASK_SUPPLYBOX_WAIT 130259

// Hard Code
new g_supplybox_num, g_supplybox_wait[33], supplybox_count, supplybox_ent[MAX_SUPPLYBOX_ENT],
g_supplybox_icon_id, bool:made_supplybox, g_newround, g_endround, Float:g_hud_supplybox_delay[33]

// Spawn Point Research
#define MAX_SPAWN_POINT 40
#define MAX_RETRY 33
new Float:player_spawn_point[MAX_SPAWN_POINT][3]
new player_spawn_point_count

public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR)
   
   register_event("HLTV", "Event_Newround", "a", "1=0", "2=0")
   register_touch(SUPPLYBOX_CLASSNAME, "player", "fw_Touch_SupplyBox")
   //register_logevent("logevent_round_start", 2, "1=Round_Start")
   register_logevent("logevent_round_end", 2, "1=Round_End")
}

public plugin_precache()
{
   engfunc(EngFunc_PrecacheModel, supplybox_model)
   
   engfunc(EngFunc_PrecacheSound, supplybox_drop_sound)
   engfunc(EngFunc_PrecacheSound, supplybox_pickup_sound)
   
   g_supplybox_icon_id = engfunc(EngFunc_PrecacheModel, supplybox_icon_spr)
}

public plugin_cfg()
{
   research_map()
}

public research_map()
{
   static player
   
   while((player = find_ent_by_class(player, "info_player_deathmatch")) != 0)
   {
      if(!pev_valid(player))
         continue
         
      pev(player, pev_origin, player_spawn_point[player_spawn_point_count])
      player_spawn_point_count++
   }

}

public client_PostThink(id)
{
   if(get_gametime() - SUPPLYBOX_RADARNICON_DELAY <= g_hud_supplybox_delay[id])
      return
      
   g_hud_supplybox_delay[id] = get_gametime()
      
   if(!is_user_alive(id))
      return
   if(zp_get_user_zombie(id))
      return
   if(!supplybox_count)
      return
      
   static i, next_ent
   i = 1
   while(i <= supplybox_count)
   {
      next_ent = supplybox_ent[i]
      if (next_ent && pev_valid(next_ent))
      {
         create_icon_origin(id, next_ent, g_supplybox_icon_id)
      }

      i++
   }         
}

public Event_Newround()
{
   made_supplybox = false
   g_newround = 1
   g_endround = 0
   
   remove_supplybox()
   supplybox_count = 0
   
   if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
   if(task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
   if(task_exists(TASK_SUPPLYBOX_HELP)) remove_task(TASK_SUPPLYBOX_HELP)   
}

public remove_supplybox()
{
   remove_entity_name(SUPPLYBOX_CLASSNAME)
   
   new supplybox_ent_reset[MAX_SUPPLYBOX_ENT]
   supplybox_ent = supplybox_ent_reset
}

public logevent_round_end() g_endround = 1
public zp_user_infected_post()
{
   if(!made_supplybox)
   {
      g_newround = 0
      made_supplybox = true
      
      if(task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
      set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
   }
}

public create_supplybox()
{
   if (supplybox_count >= SUPPLYBOX_MAX || g_newround || g_endround) 
      return

   if (task_exists(TASK_SUPPLYBOX)) remove_task(TASK_SUPPLYBOX)
   set_task(float(SUPPLYBOX_DROPTIME), "create_supplybox", TASK_SUPPLYBOX)
   
   if (get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME) 
      return

   g_supplybox_num = 0
   create_supplybox2()
   
   client_cmd(0, "spk ^"%s^"", supplybox_drop_sound)
   client_print(0, print_center, "Malzeme Kutusu Geldi !!!")
   
   if (task_exists(TASK_SUPPLYBOX2)) remove_task(TASK_SUPPLYBOX2)
   set_task(0.5, "create_supplybox2", TASK_SUPPLYBOX2, _, _, "b")   
}

public create_supplybox2()
{
   if (supplybox_count >= SUPPLYBOX_MAX
   || get_total_supplybox() >= SUPPLYBOX_TOTAL_IN_TIME || g_newround || g_endround)
   {
      remove_task(TASK_SUPPLYBOX2)
      return
   }
   
   supplybox_count++
   g_supplybox_num++

   new ent = create_entity("info_target")
   
   entity_set_string(ent, EV_SZ_classname, SUPPLYBOX_CLASSNAME)
   entity_set_model(ent, supplybox_model)   
   entity_set_size(ent,Float:{-2.0,-2.0,-2.0},Float:{5.0,5.0,5.0})
   entity_set_int(ent,EV_INT_solid,1)
   entity_set_int(ent,EV_INT_movetype,6)
   //entity_set_int(ent, EV_INT_iuser1, item)
   entity_set_int(ent, EV_INT_iuser2, supplybox_count)
   
   do_random_spawn(ent, MAX_RETRY)
   
   supplybox_ent[supplybox_count] = ent

   if ((g_supplybox_num >= SUPPLYBOX_NUM) && task_exists(TASK_SUPPLYBOX2)) 
      remove_task(TASK_SUPPLYBOX2)
}

public fw_Touch_SupplyBox(ent, id)
{
   if(!pev_valid(ent))
      return
   if(!is_user_alive(id))
      return
   if(zp_get_user_zombie(id))
      return
   
   get_random_weapon(id)
   emit_sound(id, CHAN_VOICE, supplybox_pickup_sound, 1.0, ATTN_NORM, 0, PITCH_NORM)

   new num_box = entity_get_int(ent, EV_INT_iuser2)
   supplybox_ent[num_box] = 0
   remove_entity(ent)

   g_supplybox_wait[id] = 1
   if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
   set_task(2.0, "remove_supplybox_wait", id+TASK_SUPPLYBOX_WAIT)
   
   return
}

public get_random_weapon(id)
{
   switch(random_num(0,67))
   {
      case 0..20: get_dmp7a1(id)
      case 21..31: get_cyclone(id)
      case 32..43: get_ethereal(id)
      case 44..51: get_railcannon(id)
      case 52..67: get_sgdrill(id)
   }
}

public remove_supplybox_wait(id)
{
   id -= TASK_SUPPLYBOX_WAIT
   
   g_supplybox_wait[id] = 0
   if (task_exists(id+TASK_SUPPLYBOX_WAIT)) remove_task(id+TASK_SUPPLYBOX_WAIT)
}

public get_total_supplybox()
{
   new total
   for (new i = 1; i <= supplybox_count; i++)
   {
      if (supplybox_ent[i]) total += 1
   }
   return total
}

public do_random_spawn(id, retry_count)
{
   if(!pev_valid(id))
      return
   
   static hull, Float:Origin[3], random_mem
   hull = (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN
   
   random_mem = random_num(0, player_spawn_point_count - 1)
   Origin[0] = player_spawn_point[random_mem][0]
   Origin[1] = player_spawn_point[random_mem][1]
   Origin[2] = player_spawn_point[random_mem][2]
   
   if(is_hull_vacant(Origin, hull))
      engfunc(EngFunc_SetOrigin, id, Origin)
   else
   {
      if(retry_count > 0)
      {
         retry_count--
         do_random_spawn(id, retry_count)
      }
   }
}

stock is_hull_vacant(Float:origin[3], hull)
{
   engfunc(EngFunc_TraceHull, origin, origin, 0, hull, 0, 0)
   
   if (!get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen))
      return true;
   
   return false;
}

stock create_icon_origin(id, ent, sprite) // By sontung0
{
   if (!pev_valid(ent)) return;
   if(!is_user_alive(id)) return
   
   new Float:fMyOrigin[3]
   entity_get_vector(id, EV_VEC_origin, fMyOrigin)
   
   new target = ent
   new Float:fTargetOrigin[3]
   entity_get_vector(target, EV_VEC_origin, fTargetOrigin)
   fTargetOrigin[2] += 40.0
   
   if (!is_in_viewcone(id, fTargetOrigin)) return;

   new Float:fMiddle[3], Float:fHitPoint[3]
   xs_vec_sub(fTargetOrigin, fMyOrigin, fMiddle)
   trace_line(-1, fMyOrigin, fTargetOrigin, fHitPoint)
                     
   new Float:fWallOffset[3], Float:fDistanceToWall
   fDistanceToWall = vector_distance(fMyOrigin, fHitPoint) - 10.0
   normalize(fMiddle, fWallOffset, fDistanceToWall)
   
   new Float:fSpriteOffset[3]
   xs_vec_add(fWallOffset, fMyOrigin, fSpriteOffset)
   new Float:fScale
   fScale = 0.01 * fDistanceToWall
   
   new scale = floatround(fScale)
   scale = max(scale, 1)
   scale = min(scale, SUPPLYBOX_ICON_SIZE)
   scale = max(scale, 1)

   te_sprite(id, fSpriteOffset, sprite, scale, SUPPLYBOX_ICON_LIGHT)
}

stock te_sprite(id, Float:origin[3], sprite, scale, brightness) // By sontung0
{   
   message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
   write_byte(TE_SPRITE)
   write_coord(floatround(origin[0]))
   write_coord(floatround(origin[1]))
   write_coord(floatround(origin[2]))
   write_short(sprite)
   write_byte(scale) 
   write_byte(brightness)
   message_end()
}

stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul) // By sontung0
{
   new Float:fLen = xs_vec_len(fIn)
   xs_vec_copy(fIn, fOut)
   
   fOut[0] /= fLen, fOut[1] /= fLen, fOut[2] /= fLen
   fOut[0] *= fMul, fOut[1] *= fMul, fOut[2] *= fMul
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1066\\ f0\\ fs16 \n\\ par }
*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1254\\ deff0\\ deflang1055{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

XhobLe
Yasaklı Üye
Yasaklı Üye
Mesajlar: 522
Kayıt: Cum Haz 30, 2017 7:58 pm
Konum: Istanbul
Server Ip/DNS: csxx.csduragi.com
Clan İsmi: xxx - נв

Hatalı Eklenti - Error Logları

Mesaj gönderen XhobLe »

Yanlış anlamadıysam "plugin_cfg" research_mapın calısmasını sağlamakta ve research_mapta oyunda acılan mapı tarayarak kutu atıyor ? yanlış anladıysam yorum olarak belirtin bu publiclerin sıkıntı cıkartacagını sanmıyorum...

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

Konu Sahibi
holigan
Mesajlar: 1531
Kayıt: Sal May 10, 2016 12:21 pm
Konum: İstanbul
Server Ip/DNS: 213.238.173.117
Clan İsmi: Holigan | Clan

Hatalı Eklenti - Error Logları

Mesaj gönderen holigan »

XhobLe yazdı:Yanlış anlamadıysam "plugin_cfg" research_mapın calısmasını sağlamakta ve research_mapta oyunda acılan mapı tarayarak kutu atıyor ? yanlış anladıysam yorum olarak belirtin bu publiclerin sıkıntı cıkartacagını sanmıyorum...
Map değişim sırasında çökme yaratıyor bu eklenti hangi durumlarda olduğunu bilmiyorum ama sanırım X mapı açıldı süre bitti Y mapı açıldı tekrar X mapı seçilirse açılırken çökme yaratıyor.
Tam bu olmasada bu tarz birşey :)

Link:
Linklerini gizle
Linki Kopyala
Cevapla