Raised This Month: $32 Target: $400
 8% 

[CS:S] Random weapon loop in CS:S DM


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Voltron
Senior Member
Join Date: Jun 2007
Location: Above the battlefield.
Old 05-20-2018 , 08:44   [CS:S] Random weapon loop in CS:S DM
Reply With Quote #1

Hello my friends!

I'm looking at Bail's code in dm_equipment.sp, which gives random weapons.

PHP Code:
/**
 * Gives a primary weapon to a client.
 * If the list_index is > the count, we choose one randomly.
 * This is a hack so we can append "Random" to the choice list.
 */
GivePrimary(clientlist_index)
{
    if (
list_index 0)
    {
        return;
    }
    
    new 
weapon_index;
    if (
list_index >= g_PrimaryCount)
    {
        if (
g_PrimaryCount 1)
        {
            
weapon_index GetRandomInt(0g_PrimaryCount-1);
            
weapon_index g_PrimaryList[weapon_index];
        } else if (
g_PrimaryCount == 1) {
            
weapon_index g_PrimaryList[0];
        } else {
            return;
        }
    } else {
        
weapon_index g_PrimaryList[list_index];
    }
    
    
g_PrimaryChoices[client] = list_index;
    
    
GiveWeapon(clientweapon_index);

How can it be modified so that once you're given a weapon, you will not get it again until you have gone through all the other weapons?
__________________
Voltron 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 20:22.


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