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(client, list_index)
{
if (list_index < 0)
{
return;
}
new weapon_index;
if (list_index >= g_PrimaryCount)
{
if (g_PrimaryCount > 1)
{
weapon_index = GetRandomInt(0, g_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(client, weapon_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?
__________________