AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   Random Equip (https://forums.alliedmods.net/showthread.php?t=9343)

TaRgEt*TuRkEy 01-15-2005 03:05

Random Equip
 
1 Attachment(s)
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]

XxAvalanchexX 01-15-2005 03:10

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).

TaRgEt*TuRkEy 01-15-2005 03:24

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.

XxAvalanchexX 01-15-2005 03:30

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) }

Kamikaze 01-16-2005 02:30

Nice job, if you add what XxAvalanchexX posted I think I'll make use of this plugin, gj on your second AMXX plugin.

TaRgEt*TuRkEy 01-16-2005 07:24

*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.

The-56k-LaggA 01-16-2005 08:58

How can I turn off/on the plugin? O_o

m4best1 01-16-2005 10:17

thats a sweet plug in its in my server!

XxKpAznGuyxX 01-16-2005 10:35

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.

TaRgEt*TuRkEy 01-16-2005 17:08

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.


All times are GMT -4. The time now is 15:09.

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