AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need Help with Menu and get_user_ammo (https://forums.alliedmods.net/showthread.php?t=41452)

Silencer123 07-15-2006 17:41

Need Help with Menu and get_user_ammo
 
Question 1:
How do I make a second Menu Column?
Like this:
Code:

1.  Option 1          $100
2.  Option 2          $150
3.  Option 3          $300

Using this:
Code:

format(menuBody, 511, "Buy Ammo - Your Money: $%i^n^n 1.  Six 357 Rounds^n 2.  Twelve Shotgun Buckshots^n 3.  Five Sniper Rifle Bullets^n 4.  Five Crossbow Arrows^n 5.  20 Energy Cells^n 6.  Two RPG Rockets^n 7.  Two AR Grenades^n 8.  17 9mm Bullets^n 9.  100 Minigun Rounds^n^n 0.  Close",g_money[id])


Question 2:
How do I use get_user_ammo correctly? What to "#include"?
Code:

if(get_user_ammo(id, 3, 0, 36)
On compile it says that the 3rd argument is a mismatch
and how can I know what weapon has the ID "3"?
Is there a list?




Thanks in advance! I also will give Karma!
This are the last two problems on my way to the working plugin!

Shurik3n 07-15-2006 17:50

Re: Need Help with Menu and get_user_ammo
 
Ok well just add the prices to your format
Code:
format(menuBody, 511, "Buy Ammo - Your Money: $%i^n^n 1.  Six 357 Rounds $100^n 2.  Twelve Shotgun Buckshots $150...

Silencer123 07-15-2006 18:57

Re: Need Help with Menu and get_user_ammo
 
That is an option, but it does not look that ordinary...
:p

And as this makes me megalomaniacal, I want to know how I make the Plugin wait for a specific time, then do something. I got the idea to send a Message to a player, 60 Seconds after this Player connected.

VEN 07-15-2006 19:13

Re: Need Help with Menu and get_user_ammo
 
Quote:

How do I make a second Menu Column?
Like this
Use "\R" control caracter in front of the clumn's text, example: "\RThis is a righ-aligned menu text"

Quote:

How do I use get_user_ammo correctly?
Here is an example of how to get USP's clip and ammo with a client command "test", no additional includes required:

Code:
#include <amxmodx>   public plugin_init() {    register_clcmd("test", "func") }   public func(id) {    new clip, ammo    get_user_ammo(id, CSW_USP, clip, ammo)    server_print("Clip: %d, Ammo: %d", clip, ammo)      return PLUGIN_HANDLED }
Quote:

and how can I know what weapon has the ID "3"?
Is there a list?
Yes, here: http://www.amxmodx.org/funcwiki.php?...d=4#const_cswp

Quote:

how I make the Plugin wait for a specific time, then do something
Use set_task: http://www.amxmodx.org/funcwiki.php?...task&go=search

Silencer123 07-15-2006 19:40

Re: Need Help with Menu and get_user_ammo
 
so i have
1. 357 Ammo\R123$^n2. Sniper Ammo\R321$^n
and so on?


well, the list is for counter strike, not for sven cooperative, thanks anyways, if I ever script for cs ^^

and set_task does not look like i need to ask something :p

VEN 07-15-2006 20:20

Re: Need Help with Menu and get_user_ammo
 
Well, "\R" probably will not work for SvenCoop.

Silencer123 07-16-2006 10:40

Re: Need Help with Menu and get_user_ammo
 
I actually asked if \R works in the way I posted it:
1. 357 Ammo\R123$^n2. Sniper Ammo\R321$^n
and so on

and if i write:
Code:

new 357_clips, 357_rnds
get_user_ammo(id, 3, 357_clips, 357_rnds)

IT says this:
error 020: invalid symbol name ""
error 029: invalid expression, assumed zero
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
and those all go for the first line in mentioned code

EDIT: Fixed the kind of senceless bug: symbol must not start with a number -.-
changed 357_clips to a357_clips and 357_rnds to a357_rnds

EDIT: get_user_ammo(id, 3, a357_clips, a357_rnds)
does a357_rnds include the ammo in the current clip?
weapon_357 has 6 rounds per clip and you can carry 6 clips with the clip
in the weapon. so if my hud says (6|36), will a357_rnds be 36, or 42 (6 + 36)?

VEN 07-16-2006 15:50

Re: Need Help with Menu and get_user_ammo
 
Quote:

how can I know what weapon has the ID "3"?
Here is an example:
Code:
new wid = 3 new weapon[32] get_weaponname(wid, weapon, 31) server_print("WeaponID is ^"%d^", WeaponName is ^"%s^"", wid, weapon)


Quote:

so i have
1. 357 Ammo\R123$^n2. Sniper Ammo\R321$^n
and so on?
Yes.

Quote:

does a357_rnds include the ammo in the current clip?
No.

Quote:

will a357_rnds be 36
Yes, it should be 36.

Silencer123 07-16-2006 18:03

Re: Need Help with Menu and get_user_ammo
 
Thanks! I built a little script and got all IDs!
For who ever else needs this:


SC Sven Coop Sven Cooperative Weapon Constants Weapons Constants ID IDs
(Some similar repeating so you can find this with search)

WeaponID is 1, WeaponName is weapon_crowbar
WeaponID is 2, WeaponName is weapon_9mmhandgun
WeaponID is 3, WeaponName is weapon_357
WeaponID is 4, WeaponName is weapon_9mmAR
WeaponID is 5, WeaponName is
WeaponID is 6, WeaponName is weapon_crossbow
WeaponID is 7, WeaponName is weapon_shotgun
WeaponID is 8, WeaponName is weapon_rpg
WeaponID is 9, WeaponName is weapon_gauss
WeaponID is 10, WeaponName is weapon_egon
WeaponID is 11, WeaponName is weapon_hornetgun
WeaponID is 12, WeaponName is weapon_handgrenade
WeaponID is 13, WeaponName is weapon_tripmine
WeaponID is 14, WeaponName is weapon_satchel
WeaponID is 15, WeaponName is weapon_snark
WeaponID is 16, WeaponName is weapon_uziakimbo
WeaponID is 17, WeaponName is weapon_uzi
WeaponID is 18, WeaponName is weapon_medkit
WeaponID is 19, WeaponName is
WeaponID is 20, WeaponName is weapon_pipewrench
WeaponID is 21, WeaponName is weapon_minigun
WeaponID is 22, WeaponName is weapon_grapple
WeaponID is 23, WeaponName is weapon_sniperrifle
WeaponID is 24, WeaponName is
WeaponID is 25, WeaponName is
WeaponID is 26, WeaponName is
WeaponID is 27, WeaponName is
WeaponID is 28, WeaponName is
WeaponID is 29, WeaponName is
WeaponID is 30, WeaponName is

An ID where no weapon is shown does not have a weapon assigned (Do not use these IDs)


One Problem remains:
\R does not work. In the Menu I can read \R, it does not TAB or something.
Sven Cooperatives fault? Any other way?


EDIT: One weapon uses two ammo types, how can i get the amount of the second ammo type? (ammo_ARgrenades)
I tried to use ID 5 as a weapon ID, because it is right after weapon_9mmAR, but it is the same.


and a 3rd problem! client_spawn does not work:


Code:


public client_spawn(id)
{
 player_kits[id] = g_kits
 client_print(id,print_chat,"[SC STUFF PLUGIN] You spawned with %i Healthkits in your Backpack!",g_kits)
 return PLUGIN_HANDLED
}

EDIT: Just seeing that client_spawn is for ns :oops:
but what to use then?


All times are GMT -4. The time now is 08:04.

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