Issues with Ghost Plugin [NEED HELP]

Сообщения
213
Реакции
71
Помог
2 раз(а)
Ошибка
The purpose of this plugin is to allow players to become ghosts after they die. It works well, but unfortunately, when players respawn in the next round, the plugin gives them weapons like the glock or usp. This causes problems in certain maps, such as 35hp where players are only supposed to use knives. Additionally, in maps like awp_scout, the plugin prevents the player from receiving a scout and instead gives them a glock or usp.
ОС
Windows
Amx Mod X
AMX Mod X 1.9.0.5271 (http://www.amxmodx.org)
Билд
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.10.0.760-dev
Build date: 13:06:48 Jun 23 2021 (2629)
ReGamedll
ReGameDLL version: 5.20.0.516-dev
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Список метамодулей
description       stat pend  file                        vers             src  load  unload
[ 1] SafeNameAndChat RUN - SafeNameAndChat.so v1.1 ini ANY ANY
[ 2] Reunion RUN - reunion_mm_i386.so v0.1.0.137 ini Start Never
[ 3] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5271 ini Start ANY
[ 4] Print Center Fix RUN - printcenterfix_mm_i386.so v1.0.1 ini ANY Never
[ 5] Revoice RUN - revoice_mm_i386.so v0.1.0.34 ini Start Never
[ 6] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 7] WHBlocker RUN - whblocker_mm_i386.so v1.5.697 ini Chlvl ANY
[ 8] Fun RUN - fun_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[ 9] Engine RUN - engine_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[10] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[11] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[12] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[13] CSX RUN - csx_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[14] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
[15] ReAPI RUN - reapi_amxx_i386.so v5.19.0.217-dev pl3 ANY Never
[16] hackdetector RUN - hackdetector_amxx_i386.so v0.15.328.lite pl3 ANY ANY
[17] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl3 ANY Never
[18] MySQL RUN - mysql_amxx_i386.so v1.9.0.5271 pl3 ANY ANY
Список плагинов
name                    version     author            file             status   
[ 1] K@[L]@uz Ban System 1.1.2 K@[L]@uz kalauz_ban_syst running
[ 2] Admin Spectator ESP 1.5 KoST admin_spectator running
[ 3] Online Logger 1.0.3 mx?! online_logger.a running
[ 4] Real Game Time 1.0 mx?! real_game_time. running
[ 5] Admin Base 1.9.0.5271 AMXX Dev Team admin.amxx running
[ 6] Admin Commands 1.9.0.5271 AMXX Dev Team admincmd.amxx running
[ 7] Admin Help 1.9.0.5271 AMXX Dev Team adminhelp.amxx running
[ 8] Multi-Lingual System 1.9.0.5271 AMXX Dev Team multilingual.am running
[ 9] Menus Front-End 1.9.0.5271 AMXX Dev Team menufront.amxx running
[ 10] Commands Menu 1.9.0.5271 AMXX Dev Team cmdmenu.amxx running
[ 11] New KickMenu 2.0 Flash kickmenu.amxx running
[ 12] Players Menu 1.9.0.5271 AMXX Dev Team plmenu.amxx running
[ 13] Maps Menu 1.9.0.5271 AMXX Dev Team mapsmenu.amxx running
[ 14] Plugin Menu 1.9.0.5271 AMXX Dev Team pluginmenu.amxx running
[ 15] Chat Manager 1.1.1-11 Mistrick PSL_GREEN_chatm running
[ 16] Chat Manager: Addon 0.0.4-70 Mistrick PSL_chatmanager running
[ 17] Anti Flood 1.9.0.5271 AMXX Dev Team antiflood.amxx running
[ 18] Admin Votes 1.9.0.5271 AMXX Dev Team adminvote.amxx running
[ 19] NextMap 1.9.0.5271 AMXX Dev Team nextmap.amxx running
[ 20] Roundsleft 0.2 JGHG roundsleft_nosp running
[ 21] Stats Configuration 1.9.0.5271 AMXX Dev Team statscfg.amxx running
[ 22] StatsX 1.9.0.5271 AMXX Dev Team statsx.amxx running
[ 23] CS Misc. Stats 1.9.0.5271 AMXX Dev Team miscstats.amxx running
[ 24] Map Spawns Editor 1.0.16 iG_os Map_Spawns_Edit running
[ 25] Accuracy Fix 3.0 Numb accuracy_fix.am running
[ 26] [PSL] Admin Color Chat 1.0 Edit By Alber PSL_admin_color running
[ 27] Admin Chat 1.9.0.5271 AMXX Dev Team adminchat.amxx running
[ 28] Reset Score 0.0.2f wopox1337 PSL_ResetScore. running
[ 29] Block IP Messages 1.0 Alpha Alik Inline Asla PSL_AFK_BlockIp running
[ 30] [PSL] Info Rounds By A 1.0 K@[L]@uz PSL_inforounds. running
[ 31] Played Time 1.4 Alka > Edit By A PSL_played_time running
[ 32] Invisible Spectator 0.2 ConnorMcLeod PSL_Invis_Spec. running
[ 33] FragCounter 1.01 Scarzzurs fragcounter.amx running
[ 34] Spec Money Save 0.2 F@nt0M spec_money_save running
[ 35] KGB Bots 2.3 OvidiuS & Desika kgbbots.amxx running
[ 36] Steamers Info 1.0 K@[L]@uz steamers_info.a running
[ 37] AMX Client Exec 0.03 v3x PSL_amx_exec.am running
[ 38] Advanced Bullet Damage 1.0 Sn!ff3r abd.amxx running
[ 39] AMXX Gag 1.5.0 xPaw & Exolent amx_gag.amxx running
[ 40] Autoresponder 0.5 MaximusBrood ad_manager.amxx running
[ 41] AutoReloadAdmins 1.0 BS autoreloadadmin running
[ 42] Fast Sniper Switch 1.3 Numb fast_sniper_swi running
[ 43] Anti sv_password Chang 1.0 BesT autopassremover running
[ 44] Block Advertising 1.3 Alka block_advertisi running
[ 45] Block IP 1.0 bad_boy Anti_IP_With_Sp running
[ 46] Admin Commands Log 1.2.1 twisterniq admin_commands_ running
[ 47] Parachute 1.3 KRoT@L/JTP10181 amx_parachute.a running
[ 48] Bhop Abilities 0.5.2 ConnorMcLeod amx_bhop.amxx running
[ 49] RockTheVote 1.8 DA rockthevote_cus running
[ 50] Grenade Trail 1.0 Jim grenade_trail.a running
[ 51] unknown unknown unknown hp_regain.amxx running
[ 52] Back Weapons 1.87 hoboman313/cheap backweapons.amx running
[ 53] Santa Hat + Snow 1.3 xPaw santa_hat.amxx running
[ 54] XP + LEVEL + RANK SYST 1.1 CrAzY MaN cs_rank_system. running
[ 55] Super Shop 1.3 GlaDiuS shopping.amxx running
[ 56] Spawn Protection 1.0.1 OciXCrom crx_spawn_prote running
[ 57] unknown unknown unknown crx_team_advant bad load
[ 58] MultiJump 1.1 twistedeuphoria multijump.amxx running
[ 59] Real Weapon Drop 2.3 Numb real_weapon_dro running
[ 60] Weapon Trail 2.0 anakin_cstrike WeaponTrail.amx running
[ 61] Fall Scream 0.2 VEN fallscream.amxx running
[ 62] Ghost Respawning 1.1 MaTTe ghost.amxx running
[ 63] GHW Pet Followers 2.2 GHW_Chronic GHW_Pet_Followe running
[ 64] Deathtype Effects 1.0 anakin_cstrike deathtype_effec running
[ 65] MG Grab 1.0 Nickron mg_grab.amxx running
[ 66] get_user_info 0.0.1 holy new_hook.amxx running
Автор плагина
HoLLyWooD
Версия плагина
1.7
Исходный код
/*
Плагин позволяет игрокам стать призраком после смерти.
Призраки летают по всей карте.
Призрака видно только вблизи.

This plugin allows players to become a ghost after death.
Ghosts are flying all over the map.
The ghost is visible only at close range.

Спасибо:
за идеи, тестирование и помощь: H0R1ZON
Модель призрака:
LARS

THX:
for ideas, testing and care: H0R1ZON
Model ghost:
LARS

Посетите наш портал: kodportal.ru
Visit our portal: kodportal.ru
*/

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <fakemeta_util>
#include <engine>

#define PLUGIN "Ghost After Death"
#define VERSION "1.7"
#define AUTHOR "HoLLyWooD"

enum(+=100){
TASK_HUD = 100,
TASK_RESPAWN,
TASK_STRIP,
TASK_BACK
}

new bool:is_ghost[33];
new CsTeams:old_team[33];
new bool:use_menu[33];
new bool:endround;
new sprite_death;

new g_hideHUD;

new cvar_admin;

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar( "death_ghost", VERSION, FCVAR_SERVER | FCVAR_SPONLY );

// Cvars
cvar_admin = register_cvar("ghost_admin","0");

// Dicrionary
register_dictionary("death_ghost.txt");

// forwards && Hams
RegisterHam(Ham_Touch, "weaponbox", "fw_Touch");
RegisterHam(Ham_Touch, "armoury_entity", "fw_Touch");
RegisterHam(Ham_Touch, "weapon_shield", "fw_Touch");
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_forward(FM_ClientKill, "Forward_ClientKill")
register_forward(FM_AddToFullPack, "AddToFullPack", 1)

// messages
new g_Server_Message = get_user_msgid("SayText");
register_message(g_Server_Message,"ghostMessage");

//Events
register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
register_logevent("event_round_end",2,"1=Round_End");
register_event("DeathMsg","DeathMsg","ade") ;
register_event("ResetHUD", "ResetHUD", "abe");
register_event("CurWeapon","CurWeapon","be");

// clcmds
register_clcmd("say /ghost","ghost_use_menu");

// GMSG
g_hideHUD = get_user_msgid("HideWeapon");

// Menus
register_clcmd("ghost_menu", "ghost_menu");

}

public plugin_precache(){
precache_model("models/player/ghost/ghost.mdl")
precache_model("models/rpgrocket.mdl")
sprite_death = precache_model("sprites/93skull1.spr")
}

public client_connect(id){
is_ghost[id] = false;
use_menu[id] = false;
}

public client_disconnect(id){
is_ghost[id] = false;
use_menu[id] = false;
}

public CurWeapon(id){
if(is_user_connected(id) && is_user_alive(id) && is_ghost[id]){
if(get_user_weapon(id) != CSW_KNIFE)
set_task(0.1,"strip_user_weap",id+TASK_STRIP);
}
}

public event_round_start(){
new i;
for(i=1;i<=get_maxplayers();i++){
if(is_ghost[i]){
if(task_exists(i+TASK_BACK))
remove_task(i+TASK_BACK);

set_task(1.0,"back_item",i+TASK_BACK);

cs_set_user_team(i,old_team[i]);
set_user_noclip(i);
set_view(i, CAMERA_NONE)
set_user_godmode(i,0);
}
is_ghost[i] = false;
}
endround = false;
}

public strip_user_weap(id){
id-=TASK_STRIP;
strip_user_weapons(id);
}

public back_item(id){
id-=TASK_BACK;
give_item(id,"weapon_knife");
switch(old_team[id]){
case CS_TEAM_CT: give_item(id,"weapon_usp");
case CS_TEAM_T: give_item(id,"weapon_glock");
}
}

public ResetHUD(id){
cs_reset_user_model(id);
set_rendering ( id, kRenderFxNone, 0,0,0, kRenderTransAlpha, 255 )
set_task(0.5,"ghost_bonuses",id+TASK_HUD);
}

public ghost_bonuses(id){
id-=TASK_HUD;

if(!is_ghost[id] || !is_user_connected(id) && !is_user_bot(id))
return;

// Hide hud for ghost
message_begin(MSG_ONE, g_hideHUD, _, id)
write_byte( 1<<0 | 1<<1 | 1<<3 | 1<<4 | 1<<5 | 1<<6 )
message_end()

set_user_noclip(id,1);
set_user_godmode(id,1);
cs_set_user_model(id,"ghost");

entity_set_int(id, EV_INT_solid, SOLID_NOT)
set_user_rendering(id, kRenderFxHologram, 0, 0, 0, kRenderTransAlpha, 125)
set_view(id, CAMERA_3RDPERSON);
}

public event_round_end(){
endround = true;
}

public DeathMsg(){
if(endround)
return;

if(get_pcvar_num(cvar_admin) != 0){
if(!is_user_admin(read_data(2)))
return;
}

ghost(read_data(2));
}

public ghost(id){
if(!is_user_connected(id) && !is_user_bot(id))
return;

if(is_user_alive(id)){
client_print(id,print_chat,"%L",id,"USER_ALIVE");
return;
}

if(is_ghost[id]){
client_print(id,print_chat,"%L",id,"USER_GHOST");
return;
}

if(endround){
client_print(id,print_chat,"%L",id,"ROUND_END");
return;
}

if(use_menu[id])
set_task(0.1,"ghost_respawn",id+TASK_RESPAWN);
else
ghost_menu(id);
}

public ghost_respawn(id){
id -= TASK_RESPAWN;

old_team[id] = cs_get_user_team(id);

if(is_user_alive(id) || is_user_bot(id) || old_team[id] == CS_TEAM_SPECTATOR || old_team[id] == CS_TEAM_UNASSIGNED)
return;

is_ghost[id] = true;
cs_set_user_team(id,CS_TEAM_SPECTATOR);

new origin[3];
get_user_origin(id,origin);

// Write death sprite
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_SPRITE)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_short(sprite_death)
write_byte(15)
write_byte(255)
message_end()

ExecuteHamB(Ham_CS_RoundRespawn,id)
set_user_origin(id,origin);
}

public fw_Touch(weapon,id){
if(!is_user_connected(id))
return HAM_IGNORED;

if(is_ghost[id])
return HAM_SUPERCEDE;

return HAM_IGNORED;
}

public ghost_menu(id){
new textmenu[200];
format(textmenu,199,"%L",id,"MENU_HEAD");
new g_menu = menu_create(textmenu, "menu_handler");

format(textmenu,199,"%L",id,"MENU_YES");
menu_additem(g_menu, textmenu, "1", 0);
format(textmenu,199,"%L",id,"MENU_NO");
menu_additem(g_menu, textmenu, "2", 0);

format(textmenu,199,"%L",id,"MENU_ALWAYS_YES");
menu_additem(g_menu, textmenu, "3", 0);

menu_setprop(g_menu, MPROP_EXIT, MEXIT_ALL );
menu_display(id, g_menu, 0)
}

public menu_handler(id, menu, item){
if (item == MENU_EXIT){
menu_destroy(menu)
return PLUGIN_HANDLED
}

new s_Data[6], s_Name[64], i_Access, i_Callback
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

new key = str_to_num(s_Data)

switch(key){
case 1: ghost_respawn(id+TASK_RESPAWN)
case 3: {
use_menu[id] = true;
ghost_respawn(id+TASK_RESPAWN);
}
default:{
menu_destroy(menu)
return PLUGIN_HANDLED
}
}

menu_destroy(menu)
return PLUGIN_HANDLED
}

public ghost_use_menu(id){
if(!is_user_bot(id) && is_user_connected(id) && use_menu[id])
use_menu[id] = false;
}

public Forward_ClientKill(id){
if(is_ghost[id] && is_user_alive(id)){
client_print(id,print_chat,"%L",id,"GHOST_SUICIDE");
return HAM_SUPERCEDE;
}

return HAM_IGNORED;
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type){
if(is_user_connected(attacker) && is_ghost[attacker])
return HAM_SUPERCEDE;
SetHamParamFloat(4, damage)
return HAM_IGNORED;
}

public ghostMessage(MsgID,MsgDest,id) {
new sender = get_msg_arg_int(1);

if(!is_ghost[sender])
return PLUGIN_CONTINUE;

new message[151] //Variable for the message
new sender_name[32] //Sender

get_msg_arg_string(4, message, 150);
get_user_name(sender, sender_name, 31);

if(is_user_connected(id) && (!is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)){
new ghost_msg[200];
format(ghost_msg,199,"%s%L: %s",sender_name,id,"GHOST_IN_SAY",message);
client_print(id,print_chat,ghost_msg);
}

return PLUGIN_HANDLED;
}

public AddToFullPack(es, e, iEnt, id, hostflags, player, pSet){
if( player && iEnt == id && get_orig_retval()){
if(is_ghost[iEnt]){
set_es(es, ES_RenderMode, entity_get_int(id, EV_INT_rendermode))
set_es(es, ES_RenderAmt, floatround(entity_get_float(id, EV_FL_renderamt)))
}
}
}
Could someone please assist me with this plugin? It has a few issues that I am unable to fix.

The purpose of this plugin is to allow players to become ghosts after they die. It works well, but unfortunately, when players respawn in the next round, the plugin gives them weapons like the glock or usp. This causes problems in certain maps, such as 35hp where players are only supposed to use knives. Additionally, in maps like awp_scout, the plugin prevents the player from receiving a scout and instead gives them a glock or usp.

What I would like is for the plugin to simply allow players to become ghosts, and in the next round, everything should be back to normal. The plugin should not provide any weapons or interfere with the gameplay.

Java:
/*
    Плагин позволяет игрокам стать призраком после смерти.
    Призраки летают по всей карте.
    Призрака видно только вблизи.
    
    This plugin allows players to become a ghost after death.
    Ghosts are flying all over the map.
    The ghost is visible only at close range.
    
    Спасибо:
    за идеи, тестирование и помощь: H0R1ZON
    Модель призрака:
    LARS
    
    THX:
    for ideas, testing and care: H0R1ZON
    Model ghost:
    LARS
    
    Посетите наш портал: kodportal.ru
    Visit our portal: kodportal.ru
*/

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <fakemeta_util>
#include <engine>

#define PLUGIN "Ghost After Death"
#define VERSION "1.7"
#define AUTHOR "HoLLyWooD"

enum(+=100){
    TASK_HUD = 100,
    TASK_RESPAWN,
    TASK_STRIP,
    TASK_BACK
}

new bool:is_ghost[33];
new CsTeams:old_team[33];
new bool:use_menu[33];
new bool:endround;
new sprite_death;

new g_hideHUD;

new cvar_admin;

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_cvar( "death_ghost", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
    
    // Cvars
    cvar_admin = register_cvar("ghost_admin","0");
    
    // Dicrionary
    register_dictionary("death_ghost.txt");
    
    // forwards && Hams
    RegisterHam(Ham_Touch, "weaponbox", "fw_Touch");
    RegisterHam(Ham_Touch, "armoury_entity", "fw_Touch");
    RegisterHam(Ham_Touch, "weapon_shield", "fw_Touch");
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    register_forward(FM_ClientKill, "Forward_ClientKill")
    register_forward(FM_AddToFullPack, "AddToFullPack", 1)
    
    // messages
    new g_Server_Message = get_user_msgid("SayText");
    register_message(g_Server_Message,"ghostMessage");
    
    //Events
    register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
    register_logevent("event_round_end",2,"1=Round_End");
    register_event("DeathMsg","DeathMsg","ade") ;
    register_event("ResetHUD", "ResetHUD", "abe");
    register_event("CurWeapon","CurWeapon","be");
    
    // clcmds
    register_clcmd("say /ghost","ghost_use_menu");
    
    // GMSG
    g_hideHUD = get_user_msgid("HideWeapon");
    
    // Menus
    register_clcmd("ghost_menu", "ghost_menu");
    
}

public plugin_precache(){
    precache_model("models/player/ghost/ghost.mdl")
    precache_model("models/rpgrocket.mdl")
    sprite_death = precache_model("sprites/93skull1.spr")
}

public client_connect(id){
    is_ghost[id] = false;
    use_menu[id] = false;
}

public client_disconnect(id){
    is_ghost[id] = false;
    use_menu[id] = false;
}

public CurWeapon(id){
    if(is_user_connected(id) && is_user_alive(id) && is_ghost[id]){
        if(get_user_weapon(id) != CSW_KNIFE)
            set_task(0.1,"strip_user_weap",id+TASK_STRIP);
    }
}

public event_round_start(){
    new i;
    for(i=1;i<=get_maxplayers();i++){
        if(is_ghost[i]){
            if(task_exists(i+TASK_BACK))
                remove_task(i+TASK_BACK);
                
            set_task(1.0,"back_item",i+TASK_BACK);
            
            cs_set_user_team(i,old_team[i]);
            set_user_noclip(i);
            set_view(i, CAMERA_NONE)
            set_user_godmode(i,0);
        }
        is_ghost[i] = false;
    }
    endround = false;
}

public strip_user_weap(id){
    id-=TASK_STRIP;
    strip_user_weapons(id);
}

public back_item(id){
    id-=TASK_BACK;
    give_item(id,"weapon_knife");
    switch(old_team[id]){
        case CS_TEAM_CT: give_item(id,"weapon_usp");
        case CS_TEAM_T: give_item(id,"weapon_glock");
    }
}

public ResetHUD(id){
    cs_reset_user_model(id);
    set_rendering ( id, kRenderFxNone, 0,0,0, kRenderTransAlpha, 255 )
    set_task(0.5,"ghost_bonuses",id+TASK_HUD);
}

public ghost_bonuses(id){
    id-=TASK_HUD;
    
    if(!is_ghost[id] || !is_user_connected(id) && !is_user_bot(id))
        return;
    
    // Hide hud for ghost
    message_begin(MSG_ONE, g_hideHUD, _, id)
    write_byte( 1<<0 | 1<<1 | 1<<3 | 1<<4 | 1<<5 | 1<<6 )
    message_end()
    
    set_user_noclip(id,1);
    set_user_godmode(id,1);
    cs_set_user_model(id,"ghost");
    
    entity_set_int(id, EV_INT_solid, SOLID_NOT)
    set_user_rendering(id, kRenderFxHologram, 0, 0, 0, kRenderTransAlpha, 125)
    set_view(id, CAMERA_3RDPERSON);   
}

public event_round_end(){
    endround = true;
}

public DeathMsg(){
    if(endround)
        return;
        
    if(get_pcvar_num(cvar_admin) != 0){
        if(!is_user_admin(read_data(2)))
            return;
    }
    
    ghost(read_data(2));
}

public ghost(id){
    if(!is_user_connected(id) && !is_user_bot(id))
        return;
        
    if(is_user_alive(id)){
        client_print(id,print_chat,"%L",id,"USER_ALIVE");
        return;
    }
        
    if(is_ghost[id]){
        client_print(id,print_chat,"%L",id,"USER_GHOST");
        return;
    }
    
    if(endround){
        client_print(id,print_chat,"%L",id,"ROUND_END");
        return;
    }
    
    if(use_menu[id])
        set_task(0.1,"ghost_respawn",id+TASK_RESPAWN);
    else
        ghost_menu(id);
}

public ghost_respawn(id){
    id -= TASK_RESPAWN;
    
    old_team[id] = cs_get_user_team(id);
    
    if(is_user_alive(id) || is_user_bot(id) || old_team[id] == CS_TEAM_SPECTATOR || old_team[id] == CS_TEAM_UNASSIGNED)
        return;
    
    is_ghost[id] = true;
    cs_set_user_team(id,CS_TEAM_SPECTATOR);
    
    new origin[3];
    get_user_origin(id,origin);
    
    // Write death sprite
    message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
    write_byte(TE_SPRITE)
    write_coord(origin[0])
    write_coord(origin[1])
    write_coord(origin[2])
    write_short(sprite_death)
    write_byte(15)
    write_byte(255)
    message_end()
    
    ExecuteHamB(Ham_CS_RoundRespawn,id)   
    set_user_origin(id,origin);
}

public fw_Touch(weapon,id){
    if(!is_user_connected(id))
        return HAM_IGNORED;
        
    if(is_ghost[id])
        return HAM_SUPERCEDE;
        
    return HAM_IGNORED;
}

public ghost_menu(id){
    new textmenu[200];
    format(textmenu,199,"%L",id,"MENU_HEAD");
    new g_menu = menu_create(textmenu, "menu_handler");
    
    format(textmenu,199,"%L",id,"MENU_YES");
    menu_additem(g_menu, textmenu, "1", 0);
    format(textmenu,199,"%L",id,"MENU_NO");
    menu_additem(g_menu, textmenu, "2", 0);
    
    format(textmenu,199,"%L",id,"MENU_ALWAYS_YES");
    menu_additem(g_menu, textmenu, "3", 0);
    
    menu_setprop(g_menu, MPROP_EXIT, MEXIT_ALL );
    menu_display(id, g_menu, 0)
}

public menu_handler(id, menu, item){
    if (item == MENU_EXIT){
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }

    new s_Data[6], s_Name[64], i_Access, i_Callback
    menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

    new key = str_to_num(s_Data)
    
    switch(key){
        case 1: ghost_respawn(id+TASK_RESPAWN)
        case 3: {
            use_menu[id] = true;
            ghost_respawn(id+TASK_RESPAWN);
        }
        default:{
            menu_destroy(menu)
            return PLUGIN_HANDLED
        }
    }

    menu_destroy(menu)
    return PLUGIN_HANDLED
}

public ghost_use_menu(id){
    if(!is_user_bot(id) && is_user_connected(id) && use_menu[id])
        use_menu[id] = false;
}

public Forward_ClientKill(id){
    if(is_ghost[id] && is_user_alive(id)){
        client_print(id,print_chat,"%L",id,"GHOST_SUICIDE");
        return HAM_SUPERCEDE;
    }
    
    return HAM_IGNORED;
} 

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type){   
    if(is_user_connected(attacker) && is_ghost[attacker])
        return HAM_SUPERCEDE;
    SetHamParamFloat(4, damage)
    return HAM_IGNORED;
}

public ghostMessage(MsgID,MsgDest,id) {
    new sender = get_msg_arg_int(1);
    
    if(!is_ghost[sender])
        return PLUGIN_CONTINUE;
    
    new message[151]            //Variable for the message
    new sender_name[32]       //Sender

    get_msg_arg_string(4, message, 150);
    get_user_name(sender, sender_name, 31);
    
    if(is_user_connected(id) && (!is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)){
        new ghost_msg[200];
        format(ghost_msg,199,"%s%L: %s",sender_name,id,"GHOST_IN_SAY",message);
        client_print(id,print_chat,ghost_msg);
    }
    
       return PLUGIN_HANDLED;
}

public AddToFullPack(es, e, iEnt, id, hostflags, player, pSet){
    if( player && iEnt == id && get_orig_retval()){
        if(is_ghost[iEnt]){
            set_es(es, ES_RenderMode, entity_get_int(id, EV_INT_rendermode))
            set_es(es, ES_RenderAmt, floatround(entity_get_float(id, EV_FL_renderamt)))
        }
    }
}
 
Сообщения
1,055
Реакции
212
Предупреждения
9
Помог
6 раз(а)
DrStrange, delete it
Код:
switch(old_team[id]){
        case CS_TEAM_CT: give_item(id,"weapon_usp");
        case CS_TEAM_T: give_item(id,"weapon_glock");
    }
in a function public back_item
 
Сообщения
213
Реакции
71
Помог
2 раз(а)
BiZaJe, This situation gives rise to a new problem where players in certain maps such as AWP_India do not receive an AWP automatically upon respawning, and are left with only a knife in hand.
 
Сообщения
1,055
Реакции
212
Предупреждения
9
Помог
6 раз(а)
Сообщения
147
Реакции
29
Or, on round_end do a user_silentkill if player is ghost? So he will be prepared for new, casual spawn on the new round
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу