Raised This Month: $248 Target: $400
 62% 

Entity Resources Replacement[ V 1.4 ]


Post New Thread Reply   
 
Thread Tools Display Modes
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Location: Portugal
Old 10-21-2014 , 10:49   Re: Weapons Model Replacement[ OKAPI ]
Reply With Quote #11

Well, when you have your definitive final version, you should request an approver/moderator to add everything to zip file including amxx for make the job easier to who doesn't knows how to compile localy.
And nice that you added sounds support
__________________
Jhob94 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-21-2014 , 10:52   Re: Weapons Model Replacement[ OKAPI ]
Reply With Quote #12

Quote:
Originally Posted by Jhob94 View Post
Well, when you have your definitive final version, you should request an approver/moderator to add everything to zip file including amxx for make the job easier to who doesn't knows how to compile localy.
And nice that you added sounds support
Thx for your advice, I will do it.
__________________
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-21-2014 , 13:03   Re: Weapons Model Replacement[ OKAPI ]
Reply With Quote #13

I don't have much to say for now, but I think you should review your "Usage" section. It's confusing and kind of unreadable.

Like for example:
- you say in 1. to create a file, but you provide already a config file.
- The config file should contain a dummy example with explanations.
- Make sure to warn about not using mp3 sounds.
- Make sure to emphasis about the length restriction.
- Make sure to emphasis about putting the map name.
- Your example should follow your current config file syntax, and you should not hesitate to use [code] bbcode.
- No need to duplicate 2 times your examples
- Basically rewrite the whole section \o/.
__________________

Last edited by Arkshine; 10-21-2014 at 13:05.
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-21-2014 , 13:15   Re: Weapons Model Replacement[ OKAPI ]
Reply With Quote #14

Ok, this is for the topic, about the code do you spot some problems ? Yeah, I will rewrite it.

Edit: done, new file uploaded.
__________________

Last edited by HamletEagle; 10-21-2014 at 13:45.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-21-2014 , 13:50   Re: Weapons Model Replacement[ OKAPI ]
Reply With Quote #15

Code as it is seems ok.

Though you can always improve a bit:
  • If g_arraySize is empty, you could already destroy the Array and not calling patchMemory.
  • Put some comment about what does the plugin and cvar. Best practice would be an admin doesn't need to check the first post of the plugin thread to know how about what plugin does/how to config/how to insall etc.
  • I think you should check the string size in plugin and warn about it (meaning ignoring it in case new size > original one + log_amx for example).
  • Increase buffer for get_configsdir ; remember that's something that any admin could change in core.ini. 32 might a bit short.
  • I'm not sure to like how you parse the section in your config file. For safety, you should explicitly check for section name. Even better, you don't need section at all, there is no reason to separate like that, you can always do that with comments and in your code, just a matter to check extension for example. Less prone to user's error.
__________________

Last edited by Arkshine; 10-21-2014 at 13:51.
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-21-2014 , 14:07   Re: Weapons Model Replacement[ OKAPI ]
Reply With Quote #16

I like too much my parsing method and if a user simply fallow the instructions he can't be wrong
Everything else updated.
__________________
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-21-2014 , 15:20   Re: Weapons Model Replacement[ OKAPI ]
Reply With Quote #17

But I don't care you like much your method.
You should also be aware that you can be sure user won't follow instructions. Never trust user. A gold rule. This is not a joke.

When you think again, more things:
  • You must check if file exists before and warn about it if not (optional but welcomed). This means you will have to deal with "sound/" because you need the full path with file_exists, and best would be probably to force user to prepend sound/, then in the code just a matter to do string[6] to ignore it. You can do the reverse too.
  • Actually you don't need to precache. Since you're using a way to replace directly in memory, this means, file will be precached properly by the game. No need to duplicate this. At the end, this makes your section totally pointless since you're using that only for precache. That's simplify your code.

Since I'm a evil bastard, the last point should make you realize your plugin is no more about only Weapon Model anymore but a generic memory replacer for entity's resources. That's it, your plugin can replace any sounds/models/sprites that the game precaches. You should rename your plugin to something else. Don't tell me you want to keep only for weapons, it would not make sense at all since your plugin would already allows that \o/, and it's better to be generic so your plugin has more chance to be used for more things.

If you are a masochist, you could take the thing a bit further, like config file allows to replace any string (so not a file, your have already the code ready).
If you are a masochist, you could add some parameter in config file to replace any string in the engine library as well.
__________________

Last edited by Arkshine; 10-21-2014 at 16:30.
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-22-2014 , 11:14   Re: Weapons Model Replacement[ OKAPI ]
Reply With Quote #18

Quote:
Originally Posted by Arkshine View Post
But I don't care you like much your method.
You should also be aware that you can be sure user won't follow instructions. Never trust user. A gold rule. This is not a joke.

When you think again, more things:
  • You must check if file exists before and warn about it if not (optional but welcomed). This means you will have to deal with "sound/" because you need the full path with file_exists, and best would be probably to force user to prepend sound/, then in the code just a matter to do string[6] to ignore it. You can do the reverse too.
  • Actually you don't need to precache. Since you're using a way to replace directly in memory, this means, file will be precached properly by the game. No need to duplicate this. At the end, this makes your section totally pointless since you're using that only for precache. That's simplify your code.

Since I'm a evil bastard, the last point should make you realize your plugin is no more about only Weapon Model anymore but a generic memory replacer for entity's resources. That's it, your plugin can replace any sounds/models/sprites that the game precaches. You should rename your plugin to something else. Don't tell me you want to keep only for weapons, it would not make sense at all since your plugin would already allows that \o/, and it's better to be generic so your plugin has more chance to be used for more things.

If you are a masochist, you could take the thing a bit further, like config file allows to replace any string (so not a file, your have already the code ready).
If you are a masochist, you could add some parameter in config file to replace any string in the engine library as well.
Now it has suport for sprites, sounds and weapons
__________________
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-22-2014 , 11:33   Re: Weapons Resources Replacement[ OKAPI ]
Reply With Quote #19

You did not rename your plugin. What plugin does is not related to weapon specifically anymore, but to entities more generally. An entity can be a weapon, an item, or anything else like func_*, env_* etc. Such entities precaches resources as well (just look at HLSDK.
__________________
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-22-2014 , 11:51   Re: Weapons Resources Replacement[ OKAPI ]
Reply With Quote #20

Quote:
Originally Posted by Arkshine View Post
You did not rename your plugin. What plugin does is not related to weapon specifically anymore, but to entities more generally. An entity can be a weapon, an item, or anything else like func_*, env_* etc. Such entities precaches resources as well (just look at HLSDK.
You forgot to close )
Check the code, forget the name, it can be easely changed I'm sure you still have a lot of suggestions.
__________________

Last edited by HamletEagle; 10-22-2014 at 11:51.
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 16:19.


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