View Single Post
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 10-17-2013 , 07:06   Re: Custom Start Guns ( Updated 12/06/2013 )
Reply With Quote #24

The plugin does exist however this method is more efficient.

My suggestion would be to have an option to set up spawn weapons by config file where you can choose what map, team, exactly what weapon/s and the amount of backpack ammo.
That way it would be completely customizable, suitable for multiple primary and secondary weapons, and you could also allow an admin to reload the config during game if they wanted to change it.

Set g_bDiedLastRound true when you create it, and change client_connect() to client_disconnect(). Remove client_putinserver() and remove g_bConnectedPlayers since it has no purpose.
read_file() is older, use fopen(), fgets() etc.
The trie could be done with out.
Be consistant where possible - it makes no sense to use both m_iTeam and cs_get_user_team() in the case where either of the one would suffice.
Don't use find_ent_by_owner() since give_item() returns the index of the newly created entity.
Use your alive check before you format the weapon names ( before cvar check aswell ), and a connected check before prespawn ( since spawn is called once on connect but the player is not set as connected yet ).
And lastly don't format the weapon names for each player since it only needs to be done once ( or once per round at round start to take cvar changes into account ).

Optional - Tidy up your code a bit, it's hard to read 10 lines one below the other when they are a whole mix of functions, new vars etc.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 10-17-2013 at 07:10.
hornet is offline