Raised This Month: $ Target: $400
 0% 

help with arrays and vars


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mexykanu
Member
Join Date: Oct 2006
Old 02-11-2007 , 04:56   Re: help with arrays and vars
Reply With Quote #1

i've got another question.. it's related with this plugin so it's no use to make another topic

the script is supposed to do this: (amx_giveweapon name m4a1)
-give weapon
-give ammo X times ( X clips )

the script works, but like this: ( same command )
-give weapon
-nothing

if you run it again, it gives you the ammo for that weapon , but just one clip at a time (same command )

this is the script
Code:
}else if(equali(g_weapon_name, "m4a1" )) {
   give_item(id, "weapon_m4a1") 
   give_item(id, "ammo_556nato")
   give_item(id, "ammo_556nato")
   give_item(id, "ammo_556nato")
   }else
i don't know how to "pause" between actions, do you know what i can do ?
mexykanu is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 02-11-2007 , 05:59   Re: help with arrays and vars
Reply With Quote #2

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> new const g_Weapons[33][] = {     "", "p228", "shield", "scout", "hegrenade",     "xm1014","c4", "mac10", "aug", "smokegrenade",     "elite", "fiveseven", "ump45", "sg550", "galil",     "famas", "usp", "glock18", "awp", "mp5",     "m249", "m3", "m4a1", "tmp", "g3sg1",     "flashbang", "deagle", "sg552", "ak47", "knife",     "p90", "kevlar", "assault" } new g_MaxBPAmmo[33] = {0,52,0,90,0,32,0,100,90,0,120,100,100,90,90,90,100,120,30,120,200,21,90,120,90,0,35,90,90,0,100,0,0} public plugin_init() {     register_plugin("", "", "")     register_concmd("amx_giveweapon", "cmd_giveweapon") } public cmd_giveweapon(id) {     if ( ! ( get_user_flags(id) & ADMIN_KICK ) )         return PLUGIN_CONTINUE         new arg1[32], arg2[32]         read_argv(1, arg1, 31)     read_argv(2, arg2, 31)          new target = cmd_target(id, arg1, 0)         if ( ! target )         return PLUGIN_CONTINUE         new weap[40] = "weapon_"         for ( new i = 1; i < 33; i++ ) {                 if( equali(arg2, g_Weapons[i]) ) {                         copy(weap[7], 32, g_Weapons[i])                         give_item(target , weap)                         if ( i != 2 && i != 4 && i != 6 && i != 9 && i != 25 && i != 29 && i != 31 && i != 32 )                 cs_set_user_bpammo(id, i, g_MaxBPAmmo[i])                         return PLUGIN_CONTINUE         }     }         client_print(id, print_console, "Weapon ^"%s^" was not found", arg2)         return PLUGIN_CONTINUE }
[ --<-@ ] Black Rose 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 00:44.


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