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

Custom Start Weapons ( 24/02/2014 )


Post New Thread Reply   
 
Thread Tools Display Modes
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 10-14-2013 , 06:42   Re: Custom Start Guns ( Updated 12/06/2013 )
Reply With Quote #21

Quote:
Originally Posted by YamiKaitou View Post
Seeing as there is no link to other include files in the main post, I see no reason to upload a compiled copy. If someone does not know how to compile plugins, then they need to search and figure it out otherwise they are going to have a hard time running servers.
true thats a fair call.. thanks.
__________________
Blizzard_87 is offline
Old 10-14-2013, 11:02
veliflst
This message has been deleted by veliflst.
wickedd
Veteran Member
Join Date: Nov 2009
Old 10-14-2013 , 11:43   Re: Custom Start Guns ( Updated 12/06/2013 )
Reply With Quote #22

Quote:
Originally Posted by JuanPabloOlivosCordova View Post
the compile.exe is in my server, in scripting folder, but I dditn know how to put the sma file into it
Really?

Quote:
Originally Posted by JuanPabloOlivosCordova View Post
also I dont need to search, coz I thought this site, ur suposed to ask a question and ge4t help, not get peopel saying, hey try google, of course I tried google
Before you ask a question, you should SEARCH. Because the question may have been asked and answered already.

Quote:
Originally Posted by JuanPabloOlivosCordova View Post
and anyways I read the compile plugin bit, it says drag the sma file into compile.exe, but I dont know how to do it
What do you know how to do? How old are you?
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Old 10-14-2013, 13:08
veliflst
This message has been deleted by veliflst.
Old 10-17-2013, 04:28
LordOfNothing
This message has been deleted by ConnorMcLeod. Reason: troll, or posting random confusing code, or posting for posts count
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 10-17-2013 , 04:39   Re: Custom Start Guns ( Updated 12/06/2013 )
Reply With Quote #23

Quote:
Originally Posted by LordOfNothing View Post
Can give the link please ???
There is no reference to that part as it was not a code I found on this site but im sure someone has asked howto do it some here. Plus if you look thru my code you will find the code in there.
__________________
Blizzard_87 is offline
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
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 10-17-2013 , 08:52   Re: Custom Start Guns ( Updated 12/06/2013 )
Reply With Quote #25

Quote:
Originally Posted by hornet View Post
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.
Updated Version 1.0.5

i think ive done all you suggested except for the read_file & config setup as im still learning the newer read file codes... once i get better at them i shall do another update...

i hope this is ok for now?
__________________

Last edited by Blizzard_87; 10-17-2013 at 08:53.
Blizzard_87 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 11-03-2013 , 18:03   Re: Custom Start Guns ( Updated 17/10/2013 )
Reply With Quote #26

Code:
public CBase_PlayerPre_Spawn( id ) 
{
	if( !get_pcvar_num( g_iSpawnMode ) || !is_user_connected( id ) )
		return HAM_HANDLED;
Connected check should come first. So if it is a player joining ( Spawn() called on connect ) then your not checking the cvar for no reason.

Also here:

Code:
public CBase_PlayerPost_Spawn( id ) 
{
	if( !get_pcvar_num( g_iSpawnMode ) )
		return HAM_HANDLED;
	
	if( g_bDiedLastRound[ id ] ) 
	{ 
		if( is_user_alive( id ) )
			GiveStartWeapons( id, cs_get_user_team( id ), get_pcvar_num( g_iSpawnMode ) );
Alive check should come before all others, again so your not checking the cvar and bool if its just a player joining.

Other thing I would recommend is caching the cvar once per round at start, since it will only have an effect once per round.

Also your code hurts my eyes a bit - perhaps you should consider using a bit of spacing between lines where necessary
hornet is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 11-03-2013 , 20:57   Re: Custom Start Guns ( Updated 17/10/2013 )
Reply With Quote #27

Ok thanks. Will get to it when get home

Updated Version 1.0.6
__________________

Last edited by Blizzard_87; 11-03-2013 at 23:00.
Blizzard_87 is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 11-11-2013 , 06:34   Re: Custom Start Weapons ( Updated 11/11/2013 )
Reply With Quote #28

Major Update!

Version 1.0.7


Taken away Cvars for loading weapons.
Added config file for more customization.

Example.
Code:
setting up default.ini file

for Terrorist Start Weapons
[TE]
PRIMARY=ak47
PRIMARY2=m4a1
SECONDARY=degale
NADE=HE
NADE=SMOKE
NADE=FLASH

same goes for Counter-Terroist just put [CT] above setup
[CT]
PRIMARY=ak47
PRIMARY2=m4a1
SECONDARY=degale
NADE=HE
NADE=SMOKE
NADE=FLASH
__________________
Blizzard_87 is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Location: Siiiiiiiiuu
Old 11-11-2013 , 14:04   Re: Custom Start Weapons ( Updated 11/11/2013 )
Reply With Quote #29

Quote:
Originally Posted by Blizzard_87 View Post
Major Update!

Version 1.0.7


Taken away Cvars for loading weapons.
Added config file for more customization.

Example.
Code:
setting up default.ini file

for Terrorist Start Weapons
[TE]
PRIMARY=ak47
PRIMARY2=m4a1
SECONDARY=degale
NADE=HE
NADE=SMOKE
NADE=FLASH

same goes for Counter-Terroist just put [CT] above setup
[CT]
PRIMARY=ak47
PRIMARY2=m4a1
SECONDARY=degale
NADE=HE
NADE=SMOKE
NADE=FLASH
I think it would be more be more easy if you do
Code:
TE_GUNS = ak47, deagle, HE, SMOKE, SMOKE, SMOKE
CT_GUNS = m4a1, ak47, glock, FLASH
__________________
Jhob94 is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 11-11-2013 , 18:15   Re: Custom Start Weapons ( Updated 11/11/2013 )
Reply With Quote #30

Quote:
Originally Posted by Jhob94 View Post
I think it would be more be more easy if you do
Code:
TE_GUNS = ak47, deagle, HE, SMOKE, SMOKE, SMOKE
CT_GUNS = m4a1, ak47, glock, FLASH
wont work with how my code reads file....

UPDATED VERSION 1.0.8

now reads grenades differently.

instead of

Code:
NADE=HE
NADE=SMOKE
NADE=FLASH
you can now format it this way

Code:
NADES=HE|SMOKE|FLASH
__________________
Blizzard_87 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:01.


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