AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   HomeFree v0.7 (https://forums.alliedmods.net/showthread.php?t=87132)

Nextra 03-08-2009 15:24

Re: HomeFree
 
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).

Nextra 03-09-2009 14:39

Re: HomeFree
 
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.:up:

Exolent[jNr] 03-29-2009 16:07

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

Unapproved.

ConnorMcLeod 08-22-2009 04:32

Re: HomeFree
 
Your use of client_PreThink is not justified, use proper events/forwards instead.

Nur56 09-29-2011 09:47

Re: HomeFree
 
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 :)

Arkshine 09-29-2011 11:05

Re: HomeFree
 
re-submit it on author's request.

ConnorMcLeod 09-30-2011 01:57

Re: HomeFree
 
* 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.

Nur56 09-30-2011 05:43

Re: HomeFree
 
Quote:

Originally Posted by ConnorMcLeod (Post 1565710)
* 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 :mrgreen:
* 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 :mrgreen:
* 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)

Arkshine 09-30-2011 06:58

Re: HomeFree
 
- 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.

Nur56 09-30-2011 08:33

Re: HomeFree
 
Quote:

Originally Posted by Arkshine (Post 1565771)
- 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:mrgreen:


All times are GMT -4. The time now is 05:58.

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