Raised This Month: $12 Target: $400
 3% 

Deathrun: CTSafe buttons (prevent CTs from activating traps)


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Server Management        Approver:   HamletEagle (36)
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 05-30-2016 , 15:34   Deathrun: CTSafe buttons (prevent CTs from activating traps)
Reply With Quote #1



Deathrun: CTSafe buttons (prevent CTs from activating traps)

Description
  • This plugin prevents the Counter-Terrorists from activating traps after they finish the map or traps that can be activated through thin walls, bugs on the map etc. By default, CT players are unable to press any buttons on the map, but you can enable them to do so on specific ones, by holding down the "R" button and pressing "G" while at the same time looking at the button. On some maps the button is inside a wall, so in such cases you can hold down "R" and press the button with "E". This is needed for maps that have buttons who must be pressed by CTs in order to continue playing. The files are saved in data/CTSafeButtons/mapname.txt.



Translations
  • English: by me (OciXCrom)
  • Macedonian: by me (OciXCrom)
  • Bulgarian: by Unbr3akable
  • Romanian: by HamletEagle
  • Spanish: by ACM1PT
  • Brazil Portuguese: by EFFx
  • Hungarian: by RaZ_HU





Last edited by OciXCrom; 07-17-2018 at 09:04.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
ComedyShotsGamer
Senior Member
Join Date: Mar 2016
Old 05-31-2016 , 10:53   Re: Deathrun: CTSafe buttons (prevent CTs from activating traps)
Reply With Quote #2

Wow
ComedyShotsGamer is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-05-2016 , 09:18   Re: Deathrun: CTSafe buttons (prevent CTs from activating traps)
Reply With Quote #3

I can give you some suggestions:
1. Use button id instead of model
2. Save buttons to one file

You can look into this post:

https://forums.alliedmods.net/showth...16#post2433716

It works with button id , why you use model?

Look:

PHP Code:
if(pev_valid(iEnt) && pev(iEntpev_iuser2) == MARKED_BUTTON)
{
    
pev(iEntpev_modelszModelcharsmax(szModel))
    
fprintf(iFilePointer"%s %s %d^n"g_szButtons[i], szModeliEnt)
    
iCount++



PHP Code:
if(pev_valid(iEnt) && pev(iEntpev_iuser2) == MARKED_BUTTON)
{
    
fprintf(iFilePointer"%s %d^n"g_szButtons[i],  iEnt// button class and button's id , why to save by model if you can simply add iEnt ,which is button id?
    
iCount++


Last edited by siriusmd99; 07-05-2016 at 09:19.
siriusmd99 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-05-2016 , 10:31   Re: Deathrun: CTSafe buttons (prevent CTs from activating traps)
Reply With Quote #4

I used xPaw's method in this plugin. It saves it by model. Is there actually a difference? If it's better, I'll remake it with id.

I prefer saving them in different files because it's much easier to transfer files from one server to another instead of adding lines in a single file. I'm talking about when you need to make a small change to a button on a map, not transfering all of them at once.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
safetymoose
Senior Member
Join Date: Feb 2015
Old 07-05-2016 , 10:55   Re: Deathrun: CTSafe buttons (prevent CTs from activating traps)
Reply With Quote #5

IMO using the model works better, xPaw knows his stuff. It's better to use different files because you can customize them for each map and it's easier to find the map file, rather than searching a big file for the correct line. Also, way more readable and organized.

Last edited by safetymoose; 07-05-2016 at 10:55.
safetymoose is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-05-2016 , 11:31   Re: Deathrun: CTSafe buttons (prevent CTs from activating traps)
Reply With Quote #6

Using entity id is totally unreliable, because if another entity is spawned it could break the code(since index will be changed). Also using multiple files is more organized, so don't change.

PHP Code:
new g_szDirectory[512], g_szFilename[512
Way too much, 256 would be just enough.

PHP Code:
new iEnt find_ent_by_model(-1szClassszModel
Create iEnt var before looping.

PHP Code:
fclose(iFilePointer
should be inside if(iFilePointer) check.

Since pev_mins and pev_maxs give you float values use EngFunc_WriteCoord instead of converting float to int.
__________________

Last edited by HamletEagle; 07-05-2016 at 11:44.
HamletEagle is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-05-2016 , 11:36   Re: Deathrun: CTSafe buttons (prevent CTs from activating traps)
Reply With Quote #7

Thanks for the advices. I'm keeping it this way then.

Everything else is fixed and code is updated.
__________________

Last edited by OciXCrom; 07-05-2016 at 12:48.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-05-2016 , 13:08   Re: Deathrun: CTSafe buttons (prevent CTs from activating traps)
Reply With Quote #8

Also check if iFilePointer is non 0 in case 1.

I don't like that all configurations are hardcoded, but they don't look like things that one would like to change, so I guess it's fine.
__________________
HamletEagle is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-05-2016 , 13:27   Re: Deathrun: CTSafe buttons (prevent CTs from activating traps)
Reply With Quote #9

Done.

I made the configurations that way because I don't think it's necessary stuff like that to be changed. It would be rather dumb to make cvars for them. Like you said - I don't think someone would like to change them. Hope it's not a problem.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-05-2016 , 14:08   Re: Deathrun: CTSafe buttons (prevent CTs from activating traps)
Reply With Quote #10

Remove iCount var from fileRead, it does nothing.
Again, wrong use of ML system. To print in player language, use player id instead of LANG_PLAYER.
__________________

Last edited by HamletEagle; 07-05-2016 at 14:13.
HamletEagle 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 10:26.


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