help with arrays and vars
i'm trying to make something to give people weapons.
i've given at the begining of the plugin the var new g_weapon_name[20] now in the "main" public i'm trying to look in g_weapon_name, as folows: Code:
if(g_weapon_name=="m4a1") {but it won't work... it gives me this message: "Array must be indexed (variable g_weapon_name)" |
Re: help with arrays and vars
give_item(id, "weapon_m4a1")
This is how you compare a string. Code:
or Code:
but if you wanna give a user by a cmd and is reading the weapon from an argument: Code:
|
Re: help with arrays and vars
now.. the strangest thing is... i tried this before
Code:
if ( equali(g_weapon_name, "m4a1") )the second strange thing is that Code:
give_item(id, "weapon_m4a1")thanks a lot. i hope it will get approved :D |
Re: help with arrays and vars
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" )) { |
Re: help with arrays and vars
Code:
|
Re: help with arrays and vars
i'll use this:
Code:
cs_set_user_bpammo ( id, i, g_MaxBPAmmo[i]) )edit: still not giving ammo... ( i also tried your script ) |
Re: help with arrays and vars
show me how you used it in your script.
|
Re: help with arrays and vars
Code:
}else if(equali(g_weapon_name, "m4a1" )) {i think i'll make another public, to give ammo to all weapons. it will be called when the "main" public is finished. |
| All times are GMT -4. The time now is 00:44. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.