Raised This Month: $32 Target: $400
 8% 

C4 Taker


Post New Thread Reply   
 
Thread Tools Display Modes
hellmonja
Senior Member
Join Date: Oct 2015
Old 05-28-2016 , 04:48   Re: C4 Bot Taker - joaquimandrade & ConnorMcLeod
Reply With Quote #11

Quote:
Originally Posted by siriusmd99 View Post
Can you add a feature (for admins) to take c4 from a player and give to another.
amx_takebmb player_with_bomb target_player

Because if a noob doesn't plant it's annoying to find him and take c4 with aim.
Hmm, a nice idea indeed but I have very little experience coding admin, er, stuff. But it doesn't mean I can't study it. It may take some time though...

Quote:
Originally Posted by siriusmd99 View Post
BTW, nice plugin.
Thank you! I'm glad you liked the idea...

Last edited by hellmonja; 05-28-2016 at 04:49. Reason: A simple thanks goes a long way...
hellmonja is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-28-2016 , 05:54   Re: C4 Bot Taker - joaquimandrade & ConnorMcLeod
Reply With Quote #12

Let's begin with your presentation:
1.Naming it "C4 Bot Taker" it's misleading, since it works for humans too. Try something more generic, like "C4 Taker", you decide. Fix your description too.
2.Copy-pasting the code in your post is useless and can create confusion. Attaching the sma file is enough.

About your code, it's horrible.

PHP Code:
register_cvar("c4bt_take_from_humans""0"//set to '1' to enable to take C4 from human players
register_cvar("c4bt_max_distance""200"//max distance for the take
register_cvar("c4bt_hud""5"//number of instances the HUD Message appears. Set to '0' to disable. Can be set to '9999...'. 
Such long time since I saw something like this. Use pcvars, that's a base rule if you want your plugin approved, they are faster. What you have to do is to save the return value of register_cvar in a variable and switch from get_cvar_num("cvar_name") to get_pcvar_num(variable_that_store_cvar_pointe r).

Example:
PHP Code:
new cvar register_cvar("my_cvar""100")
get_pcvar_num(cvar
In EventStatusValue_PlayerID, is_user_alive(id) should be put at the beginning of the function. One thing that I don't get is why do you use get_user_aiming when you already know the player that you are aiming at from read_data(2).
Also fix your check, message will be show only for bots and never for humans. If you update your plugin, update it properly.

PHP Code:
MaxSlots 
Is never used.

Start with this.
__________________

Last edited by HamletEagle; 05-28-2016 at 07:06.
HamletEagle is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 05-28-2016 , 09:32   Re: C4 Bot Taker - joaquimandrade & ConnorMcLeod
Reply With Quote #13

Thanks for the heads up. Let me start with removing the code from the post. Sorry about that. I just tought if they could see the code there it save them the time of downloading it...

Oh! And about this:
Quote:
Originally Posted by HamletEagle View Post
One thing that I don't get is why do you use get_user_aiming
I just thought since get_user_aiming has distance, I could use that to have both the Take and HUD Message have the same max distance. Would that be ok?...

UPDATE v1.03
  • New plugin name
  • Removed unused 'MaxSlots' variable
  • Removed some redundancies on EventStatusValue_PlayerID
  • EventStatusValue_PlayerID now checks first if aiming player is alive
  • Switched from CVARS to PCVARS because my code is horrible
  • HUD Message now enabled when 'c4t_take_from_human' cvar is enabled

Last edited by hellmonja; 05-29-2016 at 02:13.
hellmonja is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 06-02-2016 , 01:00   Re: C4 Taker - joaquimandrade & ConnorMcLeod
Reply With Quote #14

UPDATE v.1.04
  • Added CVAR 'admin_only' which limits use for admins. It is set to '1' by default
  • HUD Message disappears immediately when you've stopped looking at bomb carrier
  • Changed max distance default from 200 to 120
Sorry guys I haven't updated in along time. New changes are coming at work and we've been pretty busy these couple of days. Tell what you think of the latest changes when you have time...

Last edited by hellmonja; 06-02-2016 at 01:05.
hellmonja is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 06-15-2016 , 14:03   Re: C4 Taker - joaquimandrade & ConnorMcLeod
Reply With Quote #15

UPDATE v1.05
  • c4t_admin_only cvar now has 3 modes
0 - Disables admin_only. Everyone can take the C4.
1 - Enabled. Only admin gets to take the C4 from a teammate.
2 - Every start of a round, the admin always gets the C4.
  • Carrier gets a HUD message when C4 is taken from them and who took it.

Last edited by hellmonja; 06-15-2016 at 14:10.
hellmonja is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-19-2016 , 10:32   Re: C4 Taker - joaquimandrade & ConnorMcLeod
Reply With Quote #16

Really, from where are you getting code help? 10 years old topics and plugins?

For approval:
PHP Code:
register_event("RoundTime""Event_New_Round""bc"
Don't use this for hooking new round, HLTV event is the proper way.
But, since you want to transfer the c4, you have few ways:

  • PHP Code:
    register_logevent("logevent_function_p"3"2=Spawned_With_The_Bomb"
    That one is called when someone spawn with bomb. You won't need to loop anymore to find the carrier, since you get the index by using VEN's get_loguser_index stock. https://forums.alliedmods.net/showthread.php?t=40164
  • Hooking Ham_AddPlayerItem. This one pass the player index and the weapon entity index(not the csw id). Use cs_get_weapon_id to get the CSW index and check if it is CSW_C4. Then you found your carrier.

If you want to improve your code logic, firstly check if the carrier is admin. If so, do nothing, else get a random player from tero team(no reason to loop all players, get_players can filter by team, flag "e", "TERRORIST").

In EventStatusValue_PlayerID:
As I told you before, is_user_alive(id) check should be at the beginning of the function.
Don't mix read_data(2) with get_user_aiming, this makes no sense. You either use read_data(2) to get aim index + get_distance_f for distance or simply use only get_user_aiming.

PHP Code:
new playername[36
Should be 32, that's the max dimension.

PHP Code:
get_user_name(idplayername35); 
Use charsmax() to get a string size.

Start with this.
__________________

Last edited by HamletEagle; 06-19-2016 at 10:34.
HamletEagle is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 06-19-2016 , 14:14   Re: C4 Taker - joaquimandrade & ConnorMcLeod
Reply With Quote #17

Quote:
Originally Posted by HamletEagle View Post
Really, from where are you getting code help? 10 years old topics and plugins?
Honestly, yes. Most of the stuff I need to learn I find first on old threads or .sma files...
hellmonja is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 06-19-2016 , 14:42   Re: C4 Taker - joaquimandrade & ConnorMcLeod
Reply With Quote #18

Lets go approve this plugin, do all what HamletEagle said hell. Your plugin is so good.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-19-2016 , 15:52   Re: C4 Taker - joaquimandrade & ConnorMcLeod
Reply With Quote #19

It's okay. Just do what I said and if you don't understand something ask. I did not mean to be rude, I was just surprised to see old practices.
__________________

Last edited by HamletEagle; 06-19-2016 at 15:54.
HamletEagle is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 06-19-2016 , 23:21   Re: C4 Taker - joaquimandrade & ConnorMcLeod
Reply With Quote #20

Quote:
Originally Posted by HamletEagle View Post
It's okay. Just do what I said and if you don't understand something ask. I did not mean to be rude, I was just surprised to see old practices.
No offense taken. It was a question I felt that needed an answer. I was also surprised you were exactly right.

I'm still swamped with work but I'll try and finish it this week. I still don't know how to do some of the stuff listed but I'll be asking around now instead of googling stuff I need...
hellmonja 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 02:55.


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