Raised This Month: $ Target: $400
 0% 

Solved foreach() equivalent in AMXX?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 06-20-2017 , 21:30   foreach() equivalent in AMXX?
Reply With Quote #1

Hello

I have these groups of arrays

Code:
//this group appears in HALF-LIFE new const g_sMonsterGroup1[][] = {     "monster_alien_controller",     "monster_alien_grunt",     "monster_alien_slave",     "monster_apache",     "monster_babycrab",     "monster_barnacle",     "monster_barney",     "monster_bigmomma",     "monster_bullchicken",     //"monster_cockroach",     "monster_gargantua",     "monster_grunt_repel",     "monster_headcrab",     "monster_houndeye",     "monster_human_assassin",     "monster_human_grunt",     "monster_ichthyosaur",     "monster_leech",     "monster_miniturret",     "monster_nihilanth",     "monster_osprey",     "monster_rat",     "monster_scientist",     "monster_sentry",     "monster_snark",     "monster_tentacle",     "monster_turret",     "monster_zombie" } //this group appears in COUNTER-STRIKE new const g_sMonsterGroup2[][] = {     "func_hostage" } //this group appears in OPPOSING FORCE new const g_sMonsterGroup3[][] = {     "monster_alien_babyvoltigore",     "monster_alien_voltigore",     "monster_assassin_repel",     "monster_blkop_osprey",     "monster_blkop_apache",     "monster_cleansuit_scientist",     "monster_gonome",     "monster_grunt_ally_repel",     "monster_human_grunt_ally",     "monster_human_medic_ally",     "monster_human_torch_ally",     "monster_male_assassin",     "monster_medic_ally_repel",     "monster_otis",     "monster_pitdrone",     "monster_shockroach",     "monster_shocktrooper",     "monster_torch_ally_repel",     "monster_zombie_barney",     "monster_zombie_soldier",     "monster_geneworm",     "monster_pitworm" } //this group appears in SVEN COOP new const g_sMonsterGroup4[][] = {     "monster_alien_tor",     "monster_babygarg",     "monster_bodyguard",     "monster_chumtoad",     "monster_hwgrunt",     "monster_hwgrunt_repel",     "monster_kingpin",     "monster_robogrunt",     "monster_robogrunt_repel",     "monster_sqknest" } //this group appears in TEAM FORTRESS CLASSIC new const g_sMonsterGroup5[][] = {     "building_sentrygun_base",     "building_sentrygun",     "building_teleporter",     "building_dispenser" }

How can I make an equivalent of this, for example, in AMXX?

Code:
foreach(string in g_sMonsterGroup5)
{
	RegisterHam(Ham_TakeDamage, string, "eventDamage", 1);
}
Thanks in advance
__________________

Last edited by gabuch2; 06-20-2017 at 21:42.
gabuch2 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-20-2017 , 21:31   Re: foreach() equivalent in AMXX?
Reply With Quote #2

PHP Code:
for(new 0sizeof(g_sMonsterGroup5); i++)
{
    
RegisterHam(Ham_TakeDamageg_sMonsterGroup5[i], "eventDamage"1);

klippy is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 06-20-2017 , 21:33   Re: foreach() equivalent in AMXX?
Reply With Quote #3

Now I feel dumb.

Thank you so much Klippy!
__________________
gabuch2 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 23:03.


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