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

HomeFree v0.7


Post New Thread Reply   
 
Thread Tools Display Modes
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 03-08-2009 , 15:24   Re: HomeFree
Reply With Quote #11

Nice but you need to do

PHP Code:
svSpeed get_cvar_pointer("sv_maxspeed"
instead of

PHP Code:
svSpeed get_cvar_num("sv_maxspeed"
and then use

PHP Code:
[s|g]et_pcvar_numsvSpeed 
throughout the plugin.


You errorneously begin the loop at RoundStart with id zero but the players ids start with one. Also it is better if you store get_maxplayers() earlier or even globally.

Also, you redundantly set the players' money to zero twice. You only need to do that once.

Another little thing is that is_user_alive( id ) already includes the check for is_user_connected( id ) which you therefore don't need anymore (as you are checking this in one single if clause).
__________________
In Flames we trust!

Last edited by Nextra; 03-17-2009 at 15:48. Reason: some more things spotted
Nextra is offline
Old 03-09-2009, 09:38
Nur56
This message has been deleted by Nur56.
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 03-09-2009 , 14:39   Re: HomeFree
Reply With Quote #12

Your previous hook of the round start was entirely correct. You have to do the player spawn hook seperately to catch late connecting players. Then you obviously have to leave out the loop so the other players do not receive the message again.

A nice tutorial on how to hook round start and player spawn correctly can be found here: http://forums.alliedmods.net/showthread.php?t=42159

There is still a second money reset when the players' team is 2, this is not necessary.
__________________
In Flames we trust!

Last edited by Nextra; 03-17-2009 at 15:48.
Nextra is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-29-2009 , 16:07   Re: HomeFree
Reply With Quote #13

There are several errors within this plugin.
If you wish to know how to fix them, reply back.

Unapproved.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Old 08-21-2009, 04:32
Nur56
This message has been deleted by Nur56.
Old 08-22-2009, 03:09
Nur56
This message has been deleted by Nur56.
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-22-2009 , 04:32   Re: HomeFree
Reply With Quote #14

Your use of client_PreThink is not justified, use proper events/forwards instead.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Old 08-22-2009, 09:41
Nur56
This message has been deleted by Nur56.
Nur56
Member
Join Date: Apr 2007
Old 09-29-2011 , 09:47   Re: HomeFree
Reply With Quote #15

Sweet 2 year bump, COMPLETE re-code, edited first post, uploaded new sma(15kb up from 5kb). Contacted an approver to move this to new submissions.

a bit late, I know
Nur56 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-29-2011 , 11:05   Re: HomeFree
Reply With Quote #16

re-submit it on author's request.
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-30-2011 , 01:57   Re: HomeFree
Reply With Quote #17

* cache msg indexes into global variables
* cache maxplayers value into global variables
* don't change/supercede GameDescription if cvar is disabled
* use cvars pointers even for extra cvars (use get_cvar_pointer in plugin_init)
* don't use fm_ converted natives, use propers natives that are more efficient
* don't hook ResetHUD event for spawn, hook Ham_Spawn instead
* PreThink usage is not worth for lot of features such as Money set, maxspeed change, also, would be better to use engine prethink global forward for code extracted from parachute plugin

Consider this if you want your plugin to be reviewed.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 09-30-2011 at 02:00.
ConnorMcLeod is offline
Nur56
Member
Join Date: Apr 2007
Old 09-30-2011 , 05:43   Re: HomeFree
Reply With Quote #18

Quote:
Originally Posted by ConnorMcLeod View Post
* cache msg indexes into global variables
* cache maxplayers value into global variables
* don't change/supercede GameDescription if cvar is disabled
* use cvars pointers even for extra cvars (use get_cvar_pointer in plugin_init)
* don't use fm_ converted natives, use propers natives that are more efficient
* don't hook ResetHUD event for spawn, hook Ham_Spawn instead
* PreThink usage is not worth for lot of features such as Money set, maxspeed change, also, would be better to use engine prethink global forward for code extracted from parachute plugin

Consider this if you want your plugin to be reviewed.
* Done
* I don't use get_maxplayers() (ColorChat does, though)
* It doesn't change it if it's disabled, it has the gEnabled pcvar check
* I don't use any cvars other than the ones registered in plugin_init, as POINTERS
* No real alternative unless I use fun module. Changed a few to set_pev(id, pev_health) but changing ALL of them to float didn't work so I removed some. can't find any other alternative to strip weapons or give item, either.
* Done
* Engine would use more resources, SlowFall works fine as it is and there is no forward to hook pressing buttons. or money

If you could tell me some alternatives to the fun natives, or the forwards, I'd be more than happy to use them!

(updated new src)
Nur56 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-30-2011 , 06:58   Re: HomeFree
Reply With Quote #19

- The messages are still not cached.
- About get_maxplayers(), It doesn't change the fact it has to be cached.
- About GameDesc(), you still supercede all the time...
- To retrieve pointer from external cvars, use get_cvar_pointer, something you should cache also.
- fm_* functions are for most of them conversions of fun functions. So include fun, and remove fm_ and you have your functions. fm_ functions are less efficient then the ones from the fun modules. Remember : the less natives you call the more efficient your plugin will be.
- About get_players. You do something wrong. mPlayers will contain a list of player's index, and since it's stored in an array, index starts to 0. So your loop should look : for(i = 0; i < mCount; i++ ), then you can remove your "fix". Also, cache the player's index, i.e: id = mPlayers[i]
- Setting all the time the money to 0 is really a poor way. If you want to disable the ability to buy, use info_map_parameters entity.

Probably others things to say, start to fix what it has been said.
__________________

Last edited by Arkshine; 09-30-2011 at 07:58.
Arkshine is offline
Nur56
Member
Join Date: Apr 2007
Old 09-30-2011 , 08:33   Re: HomeFree
Reply With Quote #20

Quote:
Originally Posted by Arkshine View Post
- The messages are still not cached.
- About get_maxplayers(), It doesn't change the fact it has to be cached.
- About GameDesc(), you still supercede all the time...
- To retrieve pointer from external cvars, use get_cvar_pointer, something you should cache also.
- fm_* functions are for most of them conversions of fun functions. So include fun, and remove fm_ and you have your functions. fm_ functions are less efficient then the ones from the fun modules. Remember : the less natives you call the more efficient your plugin will be.
- About get_players. You do something wrong. mPlayers will contain a list of player's index, and since it's stored in an array, index starts to 0. So your loop should look : for(i = 0; i < mCount; i++ ), then you can remove your "fix". Also, cache the player's index, i.e: id = mPlayers[i]
- Setting all the time the money to 0 is really a poor way. If you want to disable the ability to buy, use info_map_parameters entity.

Probably others things to say, start to fix what it has been said.
-
PHP Code:
new gHF[] = "^x04[HomeFree]" //msg index

ColorChatid[0],BLUE,"^%s^x01 Type ^x03/help ^x01if you need help!",gHF 
But if that isn't caching then tell me because I don't know what it is
-Cached maxplayers in the function ColorChat uses
-FMRES_IGNORED now
-Done for sv_maxspeed & mp_freezetime( gSvMSpeed and gFrzTime )
-Removed all fm_ funcs, added fun module funcs instead
-Did that and it gave me a player out of range error, obviously because cs_get_user_team won't work with ID 0, id = mPlayers[i] is there now
-Thought about that when I removed PreThink, now I simply blocked buy function.


Added 2 commands, +sprint/-sprint and +slowfall/-slowfall
SlowFall is a bit more realistic now, you fall faster.
figured it's the only way to get rid of using PreThink(looking at you, connor)

updated src

Last edited by Nur56; 09-30-2011 at 08:38.
Nur56 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 21:03.


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