Raised This Month: $ Target: $400
 0% 

How to give defuser to a CT player?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Strick3n
Member
Join Date: Apr 2013
Old 11-17-2023 , 08:12   How to give defuser to a CT player?
Reply With Quote #1

hello i need to give a defuser to a player.
i need the item name.
__________________
Strick3n is offline
Hakim Azizov
Member
Join Date: Mar 2023
Old 11-17-2023 , 11:11   Re: How to give defuser to a CT player?
Reply With Quote #2

Quote:
Originally Posted by Strick3n View Post
hello i need to give a defuser to a player.
i need the item name.
this will help u
Attached Files
File Type: sma Get Plugin or Get Source (free_defuser.sma - 13 views - 1.7 KB)
Hakim Azizov is offline
Tote
Member
Join Date: Jul 2023
Old 11-17-2023 , 12:40   Re: How to give defuser to a CT player?
Reply With Quote #3

if (find_ent_by_class(-1, "func_bomb_target") != 0 || find_ent_by_class(-1, "info_bomb_target") != 0)
u dont need to do this when u have already put a check of "if player is not ct then return" cuz it will only work on ct

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
RegisterHam(Ham_Spawn"player""ham_spawn_post"1)
    
}

public 
ham_spawn_post(id)
{
    if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
    {
        if (!
cs_get_user_defuse(id))
        {
            
give_item(id"item_thighpack")
            
client_print(idprint_chat"You've got free defuse kit.")
        }
    }

Tote is offline
Strick3n
Member
Join Date: Apr 2013
Old 11-17-2023 , 13:12   Re: How to give defuser to a CT player?
Reply With Quote #4

it gives the defuser but cant see the defuser statusicon
__________________
Strick3n is offline
mlibre
Senior Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 11-17-2023 , 17:15   Re: How to give defuser to a CT player?
Reply With Quote #5

Quote:
Originally Posted by Hakim Azizov View Post
this will help u
what kind of futuristic language did you apply

sma
__________________

Last edited by mlibre; 11-17-2023 at 17:17.
mlibre is offline
Hakim Azizov
Member
Join Date: Mar 2023
Old 11-18-2023 , 04:03   Re: How to give defuser to a CT player?
Reply With Quote #6

Quote:
Originally Posted by Tote View Post
if (find_ent_by_class(-1, "func_bomb_target") != 0 || find_ent_by_class(-1, "info_bomb_target") != 0)
u dont need to do this when u have already put a check of "if player is not ct then return" cuz it will only work on ct
this code : "if (find_ent_by_class(-1, "func_bomb_target") != 0 || find_ent_by_class(-1, "info_bomb_target") != 0)" prevents to call "ham_spawn_post" function in other prefixed maps (cs_, zm_, ze_ , etc.)


for seeing defuser icon, you can change codes to:

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <hamsandwich>

#define PLUGIN "Free Defuser"
#define VERSION "1.0"
#define AUTHOR "HakimKILLER44"

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
		
	if (find_ent_by_class(-1, "func_bomb_target") != 0 || find_ent_by_class(-1, "info_bomb_target") != 0)
		RegisterHam(Ham_Spawn, "player", "ham_spawn_post", 1)
}

public client_putinserver(id)
{
	if (is_user_bot(id))
		set_task(0.1, "task_bot_hams", id)
}

public task_bot_hams(id)
{
	if (!is_user_connected(id))
		return
	
	RegisterHamFromEntity(Ham_Spawn, id, "ham_spawn_post", 1)
}

public ham_spawn_post(id)
{
	if (!is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT || cs_get_user_defuse(id))
		return
	
	give_item(id, "item_thighpack")
        cs_set_user_defuse(id, 1)
	client_print(id, print_chat, "You got free DEFUSER KIT")
}

Last edited by Hakim Azizov; 11-18-2023 at 04:06.
Hakim Azizov is offline
Reply


Thread Tools
Display Modes

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 06:57.


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