Raised This Month: $ Target: $400
 0% 

plugin error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
El Abuelo Loco
Senior Member
Join Date: Jun 2020
Old 12-07-2020 , 07:08   plugin error
Reply With Quote #1

Good morning, does anyone have an idea why it doesn't work for me? It compiles fine but when installing it it doesn't work I get an error. and in the log it does not leave me any file at all.

PHP Code:
                                       /* 

Description:                                       
    Hi all! :) With this plugin round end will not be forced , when bomb has 
    been defused or it has exploded.. Also fixed bug when fake team bots get 
    bomb and so until round end U can't use it. After bomb defused/expoded 
    it's spawning again.. It's advatage among others Like Fake c4.. that it is
    not changing the whole Counter-Strike Planting system, 
    but just the last milliseconds, so bots will equally use this system, 
    and ofcource it looks same like real..

Cvars:

    amx_defusemessage - Enable message "Bomb Has Been Defused"
    Default:1

    amx_defusesound - if 1: sound when bomb defused would be "CT's win", if 2: "Bomb Has Been Defused", 0: Disabled
    Default:1

    amx_plantmessage - Enable message "Bomb Has Been Planted"
    Default:1

    amx_plantsound - Enable sound "Bomb Has Been Planted"
    Default:1

    amx_defuserfrags - How many frags player get for defusing the bomb
    Default:3

    amx_scoreblowup - How many score points team get for Exploding the bomb
    Default:1

    amx_scoredefuse - How many score points team get for Defusing the bomb
    Default:1

    amx_c4damage - bomb expolosion max damage
    Default:400.0

    amx_c4radius - bomb explosion radius
    Default:1000.0


changelog:
    *v1.0 - First relese

    *v1.1 - Fixed Bug when after death, droping bomb and respawning
    user couldn't see the bomb on radar.
    
    - support "Roundend Blocker"  fake team bots (by Nextra)
    - fixed small bug in score attribute message code

    *v1.2 - fixed bug in fake team bots check code

P.s:        
    Great Thx to VEN for "CS Bomb Scripting tutorial", to Alka for fakedamage 
    stock code and to jim_yang for msghelper module.                           */


#include <amxmodx>
#include <fakemeta_util>
#include <csdm>

#define CAN_PLANT_BOMB                (1<<8)

#if cellbits == 32
    
const OFFSET_CSTEAMS 114
    
const OFFSET_BOMB_DEFUSE 193
    
const OFFSET_CSDEATHS 444
#else
    
const OFFSET_CSTEAMS 139
    
const OFFSET_BOMB_DEFUSE 219
    
const OFFSET_CSDEATHS 493
#endif

const OFFSET_LINUX 5

enum
{
    
CS_TEAM_UNASSIGNED 0,
    
CS_TEAM_T,
    
CS_TEAM_CT,
    
CS_TEAM_SPECTATOR
}

new 
g_MaxPlayersg_Sprite
new g_LastDefusingg_DefusingDurationg_Defuser

new g_msgScoreInfog_msgTextMsgg_msgTeamScoreg_msgSendAudio,
g_msgBombPickupg_msgStatusIcong_msgScoreAttribg_msgBombDrop 

new cvar_DefuseMessagecvar_DefuseSoundcvar_PlantSoundcvar_PlantMessage,
cvar_DefuserFragscvar_c4Damagecvar_c4Radiuscvar_ScorePlantcvar_ScoreDefuse

new Faketeambot[33], RefreshBomb[33]

public 
plugin_init() {
    
register_plugin("Planting Normalizer""1.2""Empower")

    
// if there is no plant on current map stop the plugin
    
if(!bomb_target_exists()) 
        return 
PLUGIN_HANDLED_MAIN;
        
    
register_event("Scenario""event_CheckBombExplode""a""1=0")
    
register_event("BarTime""event_StopDefusing""b""1=0")
    
register_logevent("defusing_with_kit"3"2=Begin_Bomb_Defuse_With_Kit")
    
register_logevent("defusing_without_kit"3"2=Begin_Bomb_Defuse_Without_Kit")
    
register_logevent("droped_bomb"3"2=Dropped_The_Bomb")
    
    
register_forward(FM_CmdStart,"fw_CmdStart")
    
    
g_msgBombDrop =    get_user_msgid("BombDrop");
    
g_msgBombPickup get_user_msgid("BombPickup");
    
g_msgScoreAttrib get_user_msgid("ScoreAttrib");
    
g_msgScoreInfo get_user_msgid("ScoreInfo");
    
g_msgSendAudio get_user_msgid("SendAudio");
    
g_msgStatusIcon get_user_msgid("StatusIcon");
    
g_msgTeamScore get_user_msgid("TeamScore");
    
g_msgTextMsg get_user_msgid("TextMsg");
    
    
cvar_DefuseMessage register_cvar("amx_defusemessage""1")
    
cvar_DefuseSound register_cvar("amx_defusesound""1")
    
cvar_PlantSound register_cvar("amx_plantsound","1")
    
cvar_PlantMessage register_cvar("amx_plantmessage","1")
    
cvar_DefuserFrags register_cvar("amx_defuserfrags","3")
    
cvar_ScorePlant register_cvar("amx_scoreblowup","1")
    
cvar_ScoreDefuse register_cvar("amx_scoredefuse","1")
    
cvar_c4Damage register_cvar("amx_c4damage","400.0")
    
cvar_c4Radius register_cvar("amx_c4radius","1000.0")
    
    
g_MaxPlayers get_maxplayers();
    
    return 
PLUGIN_CONTINUE;
}
    
public 
plugin_precache()
    
g_Sprite precache_model("sprites/eexplo.spr");
    
// here we check if the player is fake team bot
public client_putinserver(id)
{
    if(!
is_user_bot(id))
        return;
        
    static 
user_name[32]
    
get_user_name(id,user_name,31)
    
    
//for old round_nonstop versions (by Simon Logic)
    
if(equal(user_name,".") || equal(user_name,":"))
    {
        
Faketeambot[id] = true;
        return;
    }
    
    
//for new versions of round_nonstop (by Simon Logic)
    
if(cvar_exists("amx_round_nonstop_botname_t"))
    {
        static 
botnameT[32], botnameCT[32]
        
get_cvar_string("amx_round_nonstop_botname_t",botnameT,31)
        
get_cvar_string("amx_round_nonstop_botname_ct",botnameCT,31)
        
        if(
equal(user_name,botnameT) || equal(user_name,botnameCT))
        {
            
Faketeambot[id] = true;
            return;
        }
    }
    
    
//for Roundend Blocker (by Nextra) Default names
    
if(equal(user_name,"Have Fun") || equal(user_name,"Good Luck"))
    {
        
Faketeambot[id] = true;
        return;
    }
    
    
//for Roundend Blocker (by Nextra) cvars
    
if(cvar_exists("reb_name1"))
    {
        static 
botname[32],szTmp[16]
        
        for( new 
1<= 32i++ )
        {
            
formatexszTmpcharsmax(szTmp), "reb_name%i"i);
            
            
//if no name cvars next then return function
            
if(!cvar_exists(szTmp))
                return;
                
            
get_cvar_string(szTmpbotname,31)
                
            if(
equal(user_name,botname))
            {
                
Faketeambot[id] = true;
                return;
            }
        }
    }
        
}

public 
client_disconnected(id)
    
Faketeambot[id] = false;

public 
fw_CmdStart(idhandle)
{
    if(!
g_LastDefusing)
        return;
    
    
//if(get_gametime()-g_LastDefusing>=g_DefusingDuration) <---- this doesn't work as needed so I used floatadd
    
if(float:floatadd(floatmul(Float:g_LastDefusing,-1.0),get_gametime())>=float:g_DefusingDuration)
    {
        
// unpressing USE key 0.1 sec berofe defused, so round end wouldn't be forced
        
set_uc(handleUC_Buttonsget_uc(handleUC_Buttons) & ~IN_USE)
        
        
//engclient_cmd(g_Defuser,"-use") <--- this is worst way could not affect in time
        
        
new ent;
        if( (
ent fm_find_ent_by_model(-1"grenade""models/w_c4.mdl")) )
            
fm_remove_entity(ent// remove real bomb
        
        
ct_win() // show message and play sound and give score points;
        
        
if(is_user_connected(g_Defuser))
        {
            
//give frags to defuser
            
set_pev(g_Defuserpev_frags,float(pev(g_Defuserpev_frags)+get_pcvar_num(cvar_DefuserFrags)))
            
updatefrags(g_Defuser// update scoreboard
        
}
        
        
g_LastDefusing 0
    
}
}

public 
csdm_PostSpawn(id)
{
    
//refresh the radar (bugfix)
    
if(RefreshBomb[id])
    {
        
drawradar_bomb(id)
        
RefreshBomb[id] = false;
        
        return;
    }
    
    if(!
is_user_connected(id) || Faketeambot[id] || fm_get_user_team(id)!=CS_TEAM_T)
        return;
        
    new 
bomb

    
// if someone has the bomb
    
if((bomb fm_find_ent_by_class(-1"weapon_c4")))
    {
        new 
owner pev(bomb,pev_owner)
        
        if(!
is_user_connected(owner))
            return;
        
        
// if  fake team bot has the bomb    
        
if(!Faketeambot[owner])
            return;
        
        
// transfer bomb to player that is respawning
        
fm_transfer_user_gun(owneridCSW_C4)
    }
    
    
// if no bomb planted
    
else if(!fm_find_ent_by_model(-1"grenade""models/w_c4.mdl"))
    {
        
//give it to user that is respawning
        
fm_give_item(id"weapon_c4")
        
        
// set him planting valid, 
        //draw hud icon and set score attribute
        
fm_set_user_plant(id)
    }
}

// called before bomb explosion
public event_CheckBombExplode()
{    
    new 
ent
    
    
// check is bomb planted
    
if( (ent fm_find_ent_by_model(-1"grenade""models/w_c4.mdl")) )
    {        
        static 
Float:vOrigin[3];
        
pev(entpev_originvOrigin);
        
        
// making fakedamage and explosion
        
fakedamage(vOriginget_pcvar_float(cvar_c4Damage), get_pcvar_float(cvar_c4Radius)) // making fake dmg and explosion
        
        
terrorist_win() // show message and play sound and give score points;
        
        
if(pev_valid(ent))
            
fm_remove_entity(ent// remove real bomb so round end wouldn't be forced
    
}
}

public 
event_StopDefusing()
    
g_LastDefusing 0
    
public defusing_with_kit()
{
    
g_Defuser get_loguser_index();
    
g_LastDefusing float:get_gametime()
    
g_DefusingDuration float:4.9
    
}

public 
defusing_without_kit()
{
    
g_Defuser get_loguser_index()
    
g_LastDefusing float:get_gametime()
    
g_DefusingDuration float:9.9
}

public 
droped_bomb()
{
    new 
Droper get_loguser_index()
    
    
//if user droped  bomb and died
    
if(is_user_alive(Droper))
        return;
    
    
// refresh his radar when he will respawn (bugfix)
    
RefreshBomb[Droper] = true;
        
}

public 
task_respawn(id)    
{
    if(!
is_user_alive(id))
        
csdm_respawn(id)
}

//updates bomb on radar (buxfix)
stock drawradar_bomb(id)
{
    if(!
is_user_connected(id))
        return;
    
    new 
bomb fm_find_ent_by_class(-1"weapon_c4")
    
    
//check if bomb is steal droped
    
if (bomb && pev(bombpev_owner) > get_maxplayers())
    {
        new 
Float:fOrigin[3]
        
pev(bomb,pev_origin,fOrigin)
        
        
// draw bomb on radar
        
message_begin(MSG_ONEg_msgBombDrop_id)
        
write_coord(floatround(fOrigin[0])) // coord X
        
write_coord(floatround(fOrigin[1])) // coord Y
        
write_coord(floatround(fOrigin[2])) // coord Z
        
write_byte(0// droped
        
message_end()
    }
}

//by Alka
stock fakedamage(Float:origin[3], Float:damageFloat:range)
{
    
// creates explosion
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY); 
    
write_byte(TE_EXPLOSION);
    
write_coord(floatround(origin[0])); 
    
write_coord(floatround(origin[1]));      
    
write_coord(floatround(origin[2]));
    
write_short(g_Sprite);
    
write_byte(80);
    
write_byte(15); 
    
write_byte(0); 
    
message_end();
    
    static 
Float:vOrigin[3], Float:fDistanceFloat:fTmpDmg;
    
    
// loop through all player
    
for(new <= g_MaxPlayers i++)
    {
        if(!
is_user_alive(i))
            continue;
        
        
// get user position
        
pev(ipev_originvOrigin);
        
        
// check the distance to the bomb
        
fDistance vector_distance(originvOrigin);
        
        
//if player is in explode range
        
if(fDistance <= range)
        {
            
// calculate damage
            
fTmpDmg damage - (damage range) * fDistance;
            
            
// hurt him
            
fm_fakedamage(i"trigger_hurt" fTmpDmgDMG_BLAST)
            
            
// respawn player (bugfix) sometimes csdm doesn't do it automaticaly
            // after bomb explosion
            
set_task(3.0,"task_respawn",i
        }
    }
}

stock terrorist_win()
{
    
// sound "Terrorist win"
    
if(get_pcvar_num(cvar_PlantSound))
    {
        
message_begin(MSG_BROADCASTg_msgSendAudio_0)
        
write_byte(0)
        
write_string("%!MRAD_terwin")
        
write_short(100)
        
message_end()
    }
    
    
// message "Target Bombed"
    
if(get_pcvar_num(cvar_PlantMessage))
    {
        
message_begin(MSG_ALLg_msgTextMsg_0)
        
write_byte(4)
        
write_string("#Target_Bombed")
        
message_end()
    }

    
// give a score points to terrorist
    
message_begin(MSG_ONEg_msgTeamScore_1)
    
write_string("TERRORIST")
    
write_short(get_pcvar_num(cvar_ScorePlant))
    
message_end()
    
    
//remove bomb from the radar
    
message_begin(MSG_ALLg_msgBombPickup_0)
    
message_end()
}

stock ct_win()
{
    
// sound "counter-terrorist win"
    
if(get_pcvar_num(cvar_DefuseSound)==1)
    {
        
message_begin(MSG_BROADCASTget_user_msgid("SendAudio"), _0)
        
write_byte(0)    
        
write_string("%!MRAD_ctwin")
        
write_short(100)
        
message_end()
    }
    
// sound "bomb has been defused"
    
else if(get_pcvar_num(cvar_DefuseSound)==2)
    {
        
message_begin(MSG_BROADCASTget_user_msgid("SendAudio"), _0)
        
write_byte(0)
        
write_string("%!MRAD_BOMBDEF")
        
write_short(100)
        
message_end()
    }

    
// message "bomb has been defused"
    
if(get_pcvar_num(cvar_DefuseMessage))
    {
        
message_begin(MSG_ALLget_user_msgid("TextMsg"), _0)
        
write_byte(4)
        
write_string("#Bomb_Defused")
        
message_end()
    }
    
    
// give a score points to ct
    
message_begin(MSG_ONEg_msgTeamScore_1)
    
write_string("CT")
    
write_short(get_pcvar_num(cvar_ScoreDefuse))
    
message_end()
    
    
//remove bomb from the radar
    
message_begin(MSG_ALLg_msgBombPickup_0)
    
message_end()
    
    
}

stock updatefrags(index)
{
        
message_begin(MSG_BROADCASTg_msgScoreInfo)
        
write_byte(index// id
        
write_short(pev(indexpev_frags)) // frags
        
write_short(fm_get_user_deaths(index)) // deaths
        
write_short(0// class?
        
write_short(fm_get_user_team(index)) // team
        
message_end()
}

// by Ven
stock get_loguser_index() 
{
    new 
szLoguser[64], szName[32];
    
read_logargv(0szLogusersizeof szLoguser 1);
    
parse_loguser(szLoguserszNamesizeof szName 1);
    
    return 
get_user_index(szName);


stock bomb_target_exists()
{
    if(
fm_find_ent_by_class(-1"func_bomb_target") || fm_find_ent_by_class(-1"info_bomb_target"))
        return 
1;
        
    return 
0;
}

stock fm_set_user_plant(client)
{    
    new 
kit get_pdata_int(clientOFFSET_BOMB_DEFUSEOFFSET_LINUX);
    
    if( !(
kit CAN_PLANT_BOMB) )
    {
        
set_pdata_int(clientOFFSET_BOMB_DEFUSE, (kit CAN_PLANT_BOMB), OFFSET_LINUX);
        
        
// show hud icon
        
message_begin(MSG_ONEg_msgStatusIcon_client);
        
write_byte(1);
        
write_string("c4");
        
write_byte(0);
        
write_byte(160);
        
write_byte(0);
        
message_end();
        
        
// show attribute "Bomb" on the score board
        
emessage_begin(MSG_ALLg_msgScoreAttrib_client)
        
ewrite_byte(client)
        
ewrite_byte(2)
        
emessage_end()
    }
}

stock fm_get_user_deaths(id)
    return 
get_pdata_int(idOFFSET_CSDEATHSOFFSET_LINUX);

stock fm_get_user_team(id)
    return 
get_pdata_int(idOFFSET_CSTEAMSOFFSET_LINUX); 
El Abuelo Loco is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:22.


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