Raised This Month: $ Target: $400
 0% 

Random Equip


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
TaRgEt*TuRkEy
Member
Join Date: Oct 2004
Old 01-15-2005 , 03:05   Random Equip
Reply With Quote #1

Hello guys, this is my second plugin. Basically what it does is gives each player a random weapon or grenade at the start of the round with a desired ammount of ammo set by the commands.

Cvars:

amx_random_weaponammo <any>
  • Sets how much ammo is given with each gun. The guns will already have one full clip no matter what.

amx_random_grenadeammo <any>
  • Sets how many grenades are given to you when you recieve them.

-----

Thanks for everybody that helped me with this one.

Note: If you set a value of ammo over 254, it will not display the correct ammount of ammo, but you will still have it (this is limitation in CS).

Code:
/***********************************************************
	Random Equip
	Author: TaRgEt*TuRkEy
	Version: 1.1
	Mod: Counter-Strike
	Requires: AMX Mod X v1.0 
	Description: 
		Gives each player a random weapon or grenade
		at the start of the round with a desired ammount 
		of ammo set by the commands.
		
	
	Notes:
		Thanks everybody who replied to my scripting
		help thread. Thanks to Sanji for idea, and
		some code.
	
	v.1.1
		-Gives the random equip when user physically
		 spawns now (so no more waiting for 
		 freezetime).
		-Added some commands to set the for ammo
		 configuration.

	Cvars:
	
	amx_random_weaponammo <any>
		-Sets how much ammo is given with each gun.
		 The guns will already have one full clip
		 no matter what.
	amx_random_grenadeammo <any>
		-Sets how many grenades are given to you
		 when you recieve them.
	
***********************************************************/
[/list]
Attached Files
File Type: sma Get Plugin or Get Source (randomequip.sma - 1321 views - 5.6 KB)
__________________
TaRgEt*TuRkEy is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-15-2005 , 03:10  
Reply With Quote #2

Nice job on the second plugin, and good to see that you finally got it working. The next step I'd work to, if I were you, is issuing the items immediately on a new round (so that they don't buy a grenade not knowing that they would be rewarded with in in 5 seconds), and not giving them a primary weapon if they already have one (or secondary, or grenades).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
TaRgEt*TuRkEy
Member
Join Date: Oct 2004
Old 01-15-2005 , 03:24  
Reply With Quote #3

Do you know if there is way to actually find when a new round before the freezetime ends? I've looked around a bit and haven't found anything.

I never even thought about disabling the ability to get more than one primary or secondary. I kind of like it, but since you asked, there will probably be others that will want it too. The thing is...

I know how to check for which gun the user is holding, but is there a way to see how many primary, or secondary that user has without the user holding that current gun?

EXAMPLE:
I could easily check and block primary if the user is holding a primary, but how would i know if the user has a secondary without him holding it.
__________________
TaRgEt*TuRkEy is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-15-2005 , 03:30  
Reply With Quote #4

Get when they spawn:

Code:
register_event("ResetHUD","event_resethud","b"); ... public event_resethud(id) {   if(is_user_connected(id)) {     set_task(0.3,"check_for_life",id);   } } public check_for_life(id) {   if(is_user_alive(id)) {     functionhere(id);   } }

Theoretically when a user spawns and ResetHUD is called they are technically dead, which is why I have it check to see if they are alive in 0.3 seconds. As for getting weapons:

Code:
new weapons[32], num; get_user_weapons(id,weapons,num); for(new i=0;i<num;i++) {   weapon = weapons[i];   // from here you can compare the weapon   // variable to that of a CSW_ value or you   // can use get_weaponname with it and then   // compare its name as a string (ie: glock18) }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Kamikaze
Senior Member
Join Date: Mar 2004
Location: Butler, PA
Old 01-16-2005 , 02:30  
Reply With Quote #5

Nice job, if you add what XxAvalanchexX posted I think I'll make use of this plugin, gj on your second AMXX plugin.
Kamikaze is offline
Send a message via ICQ to Kamikaze Send a message via AIM to Kamikaze Send a message via MSN to Kamikaze Send a message via Yahoo to Kamikaze
TaRgEt*TuRkEy
Member
Join Date: Oct 2004
Old 01-16-2005 , 07:24  
Reply With Quote #6

*UPDATE*
v.1.1
  • Gives the random equip when user physically spawns now (so no more waiting for freezetime).
    Added some commands to set the for ammo configuration.

----

Sorry, but no weapon checking in this version YET. I still haven't found a good way to disallow getting random weapons if you already have a certain weapons, because if you have a primary, but no secondary, i will have to make checks to both, but if you end up getting a primary from randominity, i will have to randomize another until a secondary (or grenade) is drawn, and vice versa for no primarys. So you see there wll need to be alot of checking. Well, anyways, have fun.
__________________
TaRgEt*TuRkEy is offline
The-56k-LaggA
Senior Member
Join Date: Apr 2004
Location: Germany, Hanover
Old 01-16-2005 , 08:58  
Reply With Quote #7

How can I turn off/on the plugin? O_o
The-56k-LaggA is offline
Send a message via ICQ to The-56k-LaggA
m4best1
Junior Member
Join Date: Jan 2005
Old 01-16-2005 , 10:17  
Reply With Quote #8

thats a sweet plug in its in my server!
__________________
m4best1 is offline
Send a message via AIM to m4best1
XxKpAznGuyxX
Senior Member
Join Date: Dec 2004
Location: EARTH!!
Old 01-16-2005 , 10:35  
Reply With Quote #9

shouldn't the commands you have right now be cvar? and make a amxx command to turn it off/on. and you should like disable all the rest of the weapons like when you 1st respawn like the pistol you get... and in FY-maps..... you can pick up weapons from the floor.
__________________
24/7 Chicago Terror-8.9.2.120:27015
XxKpAznGuyxX is offline
Send a message via AIM to XxKpAznGuyxX Send a message via MSN to XxKpAznGuyxX
TaRgEt*TuRkEy
Member
Join Date: Oct 2004
Old 01-16-2005 , 17:08  
Reply With Quote #10

Actually, they are cvars, I just have a habbit of calling all of them commands, I will change to make it less confusing .

Thanks for the suggestion, I will have it turn off on specific maps. And the ability to turn off and on, on the fly. What maps should I add on the turn off list though?

awp_
fy_
kz_

What other maps should I block? You'll see these new changes in the new version.
__________________
TaRgEt*TuRkEy 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 15:08.


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