Raised This Month: $ Target: $400
 0% 

Help finding bombsite :)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ke3ller
Member
Join Date: Feb 2013
Old 05-14-2013 , 19:11   Help finding bombsite :)
Reply With Quote #1

This code doesn't want to give the player the defuser, there is a better way? I just don't want to give defuser to CT's on fy_snow
PHP Code:
new bool:g_bHasBombSite;
................................................................................
if( 
find_ent_by_class(-1"func_bomb_target") || find_ent_by_class(-1"info_bomb_target") )
    {
        
g_bHasBombSite true;
    }
...............................................................................
if(
g_bHasBombSite && cs_get_user_team(id) == CS_TEAM_CT
       {
                
give_item(id"item_thighpack");
       } 
ke3ller is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-15-2013 , 01:26   Re: Help finding bombsite :)
Reply With Quote #2

Code is ok, seems that you made a mistake somewhere else, or that you don't give defuser at correct place.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ke3ller
Member
Join Date: Feb 2013
Old 05-15-2013 , 17:04   Re: Help finding bombsite :)
Reply With Quote #3

I give it at player spawn, I also use CSDM and uwc3x but nothing strips weapons or interfere with this, the plugin just dont't see if map has bombsite...
ke3ller is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-15-2013 , 17:16   Re: Help finding bombsite :)
Reply With Quote #4

You don't know, you just guess.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ke3ller
Member
Join Date: Feb 2013
Old 05-15-2013 , 17:19   Re: Help finding bombsite :)
Reply With Quote #5

well if I use just "give_item(id, "item_thighpack");" it gives the defuser...
ke3ller is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-15-2013 , 17:21   Re: Help finding bombsite :)
Reply With Quote #6

PHP Code:
if( find_ent_by_class(-1"func_bomb_target") || find_ent_by_class(-1"info_bomb_target") )
    {
        
g_bHasBombSite true;
    } 
->

PHP Code:
if( find_ent_by_class(-1"func_bomb_target") || find_ent_by_class(-1"info_bomb_target") )
    {
        
// put debug there
        
g_bHasBombSite true;
    }
else
{
    
// put debug there


That's how plugins coders usually debug their plugin.

I'm smelling a little mistake, could you post the whole function where you make that check please ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ke3ller
Member
Join Date: Feb 2013
Old 05-16-2013 , 05:19   Re: Help finding bombsite :)
Reply With Quote #7

Its a simplified vip plugin

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

#define MAX_PLAYERS 32

static const COLOR[] = "^x04" //green
static const CONTACT[] = ""
new maxplayers
new gmsgSayText
new g_awp_active
new bool:g_bHasBombSite;

public 
plugin_init()
{
register_plugin("VIP RO""2.09""Autor")
g_awp_active register_cvar("awp_active""1")
register_clcmd("awp","HandleCmd")
         
register_clcmd("sg550","HandleCmd")
         
register_clcmd("g3sg1","HandleCmd")
         
register_event("CurWeapon""event_CurWeapon""be""1=1")
         
register_event("CurWeapon""event_CurWeaponn""be""1=1")
         
register_event("CurWeapon""event_CurWeaponnn""be""1=1")
register_clcmd("say /vip","ShowMotd")
maxplayers get_maxplayers()
gmsgSayText get_user_msgid("SayText")
register_clcmd("say""handle_say")
register_cvar("amx_contactinfo"CONTACTFCVAR_SERVER)
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
register_event("DeathMsg""hook_death""a""1>0")
register_event("Damage""on_damage""b""2!0""3=0""4!0")
if( 
find_ent_by_class(-1"func_bomb_target") || find_ent_by_class(-1"info_bomb_target") ) //Checks if the map has bombsite
    
{
        
g_bHasBombSite true//If the map has bombsite it is set to true
    
}
}

public 
fwHamPlayerSpawnPost(id
{
    if( 
is_user_alive(id) && get_user_flagsid ) & ADMIN_LEVEL_H )
                {
                        
give_item(id"weapon_hegrenade")
                        
set_user_maxspeedid get_user_maxspeedid ) + 100.0 )
            
cs_set_user_moneyid cs_get_user_moneyid ) + 2500 )
            
set_user_armorid get_user_armorid ) + 50)
            
give_itemid "item_assaultsuit")
            
give_item(id"weapon_flashbang");
            
give_item(id"weapon_flashbang");
                        if(
g_bHasBombSite && cs_get_user_team(id) == CS_TEAM_CT)
                {
                    
give_item(id"item_thighpack");
                }
}   
}  


public 
HandleCmd(id){
    if (!
get_pcvar_num(g_awp_active))
         return 
PLUGIN_CONTINUE
    
if(get_user_flags(id) & ADMIN_LEVEL_H)
    return 
PLUGIN_CONTINUE
    client_print
(idprint_center"Sniperele sunt doar pentru VIP-uri !!!")
    return 
PLUGIN_HANDLED
}

public 
event_CurWeapon(id)
{
if(
read_data(2) == CSW_AWP)
{
if(!(
get_user_flags(id) & ADMIN_LEVEL_H))
{
client_print(idprint_center"Sniperele sunt doar pentru VIP-uri !!!")
client_cmd(id"drop")
}
}
return 
PLUGIN_HANDLED
}
public 
event_CurWeaponn(id)
{
if(
read_data(2) == CSW_SG550)
{
if(!(
get_user_flags(id) & ADMIN_LEVEL_H))
{
client_print(idprint_center"Sniperele sunt doar pentru VIP-uri !!!")
client_cmd(id"drop")
}
}
return 
PLUGIN_HANDLED
}
public 
event_CurWeaponnn(id)
{
if(
read_data(2) == CSW_G3SG1)
{
if(!(
get_user_flags(id) & ADMIN_LEVEL_H))
{
client_print(idprint_center"Sniperele sunt doar pentru VIP-uri !!!")
client_cmd(id"drop")
}
}
return 
PLUGIN_HANDLED
}
public 
ShowMotd(id)
{
show_motd(id"vip.txt")
}
public 
client_authorized(id)
{
set_task(30.0"PrintText" ,id)
}
public 
PrintText(id)
{
client_print(idprint_chat"[VIP] Scrie in chat /vip pentru a vedea beneficiile unui VIP")
}
public 
handle_say(id) {
new 
said[192]
read_args(said,192)
if( ( 
containi(said"who") != -&& containi(said"admin") != -) || contain(said"/vips") != -)
set_task(0.1,"print_adminlist",id)
return 
PLUGIN_CONTINUE
}
public 
print_adminlist(user)
{
new 
adminnames[33][32]
new 
message[256]
new 
contactinfo[256], contact[112]
new 
idcountxlen

for(id id <= maxplayers id++)
if(
is_user_connected(id))
if(
get_user_flags(id) & ADMIN_LEVEL_H)
get_user_name(idadminnames[count++], 31)
len format(message255"%s VIP CONECTAT: ",COLOR)
if(
count 0) {
for(
count x++) {
len += format(message[len], 255-len"%s%s "adminnames[x], < (count-1) ? ", ":"")
if(
len 96 ) {
print_message(usermessage)
len format(message255"%s ",COLOR)
}
}
print_message(usermessage)
}
else {
len += format(message[len], 255-len"Nu sunt VIP-uri conectate.")
print_message(usermessage)
}

get_cvar_string("amx_contactinfo"contact63)
if(
contact[0]) {
format(contactinfo111"%s Contact -- %s"COLORcontact)
print_message(usercontactinfo)
}
}
print_message(idmsg[]) {
message_begin(MSG_ONEgmsgSayText, {0,0,0}, id)
write_byte(id)
write_string(msg)
message_end()


Last edited by ke3ller; 05-19-2013 at 16:02.
ke3ller is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-16-2013 , 13:52   Re: Help finding bombsite :)
Reply With Quote #8

Seems that you forgot function on_damage in plugin, so bombsite detection code is never executed.
You can see it in amxmodx/logs/error****.log
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 05-16-2013 at 13:55.
ConnorMcLeod is offline
ke3ller
Member
Join Date: Feb 2013
Old 05-19-2013 , 14:09   Re: Help finding bombsite :)
Reply With Quote #9

it still doesn't give the defuser...

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

#define MAX_PLAYERS 32
#define MAXPLAYERS 32 + 1

static const COLOR[] = "^x04" //green
static const CONTACT[] = ""
new maxplayers
new gmsgSayText
new g_awp_active
new bool:g_bHasBombSite;
#if defined DAMAGE_RECIEVED
new g_MsgSync2
#endif

public plugin_init()
{
register_plugin("VIP RO""2.06""Autor")
g_awp_active register_cvar("awp_active""1")
register_event("Damage","Damage","b")
register_event("DeathMsg","death_msg","a")
register_clcmd("awp","HandleCmd")
register_clcmd("sg550","HandleCmd")
register_clcmd("g3sg1","HandleCmd")
register_event("CurWeapon""event_CurWeapon""be""1=1")
register_event("CurWeapon""event_CurWeaponn""be""1=1")
register_event("CurWeapon""event_CurWeaponnn""be""1=1")
register_clcmd("say /vip","ShowMotd")
maxplayers get_maxplayers()
gmsgSayText get_user_msgid("SayText")
register_clcmd("say""handle_say")
register_cvar("amx_contactinfo"CONTACTFCVAR_SERVER)
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
register_event("HLTV""event_new_round""a""1=0""2=0")
register_event("TextMsg","Event_RoundRestart","a","2&#Game_w")
register_event("DeathMsg""hook_death""a""1>0")
register_event("Damage""on_damage""b""2!0""3=0""4!0")
if( 
find_ent_by_class(-1"func_bomb_target") || find_ent_by_class(-1"info_bomb_target") ) //Checks if the map has bombsite
    
{
        
g_bHasBombSite true//If the map has bombsite it is set to true
    
}
}

public 
fwHamPlayerSpawnPost(id
{
    if( 
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT )
    {
        
give_item(id,"weapon_m4a1")
        
cs_set_user_bpammo(idCSW_M4A190);
        
set_user_armorid 90)
        
give_item(id"weapon_smokegrenade")
    }
    if( 
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T )
    {
        
give_item(id,"weapon_m4a1")
        
cs_set_user_bpammo(idCSW_M4A190);
        
set_user_armorid 90)
        
give_item(id"weapon_smokegrenade")
    }
    if( 
is_user_alive(id) && get_user_flagsid ) & ADMIN_LEVEL_H )
    {
        
give_item(id"weapon_hegrenade")
        
give_item(id"item_assaultsuit");
        
set_user_maxspeedid get_user_maxspeedid ) + 50.0 )
        
give_item(id"weapon_flashbang");
        
give_item(id"weapon_flashbang");
        
set_user_armorid get_user_armorid ) + 50)
        if(
g_bHasBombSite && cs_get_user_team(id) == CS_TEAM_CT)
        {
            
give_item(id"item_thighpack");
        }
    }   
}

public 
HandleCmd(id){
if (!
get_pcvar_num(g_awp_active))
         return 
PLUGIN_CONTINUE
if(get_user_flags(id) & ADMIN_LEVEL_H)
return 
PLUGIN_CONTINUE
client_print
(idprint_center"Sniperele sunt doar pentru VIP-uri !!!")
return 
PLUGIN_HANDLED
}

public 
event_CurWeapon(id)
{
if(
read_data(2) == CSW_AWP)
{
if(!(
get_user_flags(id) & ADMIN_LEVEL_H))
{
client_print(idprint_center"Sniperele sunt doar pentru VIP-uri !!!")
client_cmd(id"drop")
}
}
return 
PLUGIN_HANDLED
}
public 
event_CurWeaponn(id)
{
if(
read_data(2) == CSW_SG550)
{
if(!(
get_user_flags(id) & ADMIN_LEVEL_H))
{
client_print(idprint_center"Sniperele sunt doar pentru VIP-uri !!!")
client_cmd(id"drop")
}
}
return 
PLUGIN_HANDLED
}
public 
event_CurWeaponnn(id)
{
if(
read_data(2) == CSW_G3SG1)
{
if(!(
get_user_flags(id) & ADMIN_LEVEL_H))
{
client_print(idprint_center"Sniperele sunt doar pentru VIP-uri !!!")
client_cmd(id"drop")
}
}
return 
PLUGIN_HANDLED
}
public 
ShowMotd(id)
{
show_motd(id"vip.txt")
}
public 
client_authorized(id)
{
set_task(30.0"PrintText" ,id)
}
public 
PrintText(id)
{
client_print(idprint_chat"[VIP] Scrie in chat /vip pentru a vedea beneficiile unui VIP")
}
public 
handle_say(id) {
new 
said[192]
read_args(said,192)
if( ( 
containi(said"who") != -&& containi(said"admin") != -) || contain(said"/vips") != -)
set_task(0.1,"print_adminlist",id)
return 
PLUGIN_CONTINUE
}
public 
print_adminlist(user)
{
new 
adminnames[33][32]
new 
message[256]
new 
contactinfo[256], contact[112]
new 
idcountxlen

for(id id <= maxplayers id++)
if(
is_user_connected(id))
if(
get_user_flags(id) & ADMIN_LEVEL_H)
get_user_name(idadminnames[count++], 31)
len format(message255"%s VIP ONLINE: ",COLOR)
if(
count 0) {
for(
count x++) {
len += format(message[len], 255-len"%s%s "adminnames[x], < (count-1) ? ", ":"")
if(
len 96 ) {
print_message(usermessage)
len format(message255"%s ",COLOR)
}
}
print_message(usermessage)
}
else {
len += format(message[len], 255-len"Nu sunt VIP-uri conectate.")
print_message(usermessage)
}

get_cvar_string("amx_contactinfo"contact63)
if(
contact[0]) {
format(contactinfo111"%s Contact Server Admin -- %s"COLORcontact)
print_message(usercontactinfo)
}
}
print_message(idmsg[]) {
message_begin(MSG_ONEgmsgSayText, {0,0,0}, id)
write_byte(id)
write_string(msg)
message_end()


PS: Dunno's or Unkolix's codes run rly bad on my sv, I found this old code and it works fine (except the defuser thing)

Last edited by ke3ller; 05-19-2013 at 16:03.
ke3ller is offline
ke3ller
Member
Join Date: Feb 2013
Old 05-19-2013 , 16:20   Re: Help finding bombsite :)
Reply With Quote #10

How can I debug?
ke3ller 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 16:27.


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