Store custom command and value for each client which is callable and changeable
How do I create a custom command with value for each client which is callable and changeable
and stored for the time the player is on the server? I need something like that to make player pay any kind of virtual money for the ammo in menu. (See code) Code:
#include <amxmodx> |
Re: Store custom command and value for each client which is callable and changeable
Okay... I tried a lot but there was no success, yet,
just compiling errors, which includes "Too many errors in a line"! :O Please help! |
Re: Store custom command and value for each client which is callable and changeable
Your probably going to want to use a global variable for the clients money. Like
Code:
Then whenever somebody buys something you would do: Code:
Of course you will still need a way for giving players money. |
Re: Store custom command and value for each client which is callable and changeable
/home/groups/amxmodx/tmp3/textX8a1xw.sma(79 -- 80) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/textX8a1xw.sma(140) : warning 217: loose indentation 2 warnings :/ I now have this: Code:
/* AMX Mod X script. |
Re: Store custom command and value for each client which is callable and changeable
Use
Code:
|
Re: Store custom command and value for each client which is callable and changeable
ah yes you are right. thanks so far! I still need to know one more thing:
how do i register a command to set money for each player? I have: Code:
knows that the command needs a target/name and a value to work properly. Code:
public set_money(id, value)I need this to set the money value to 0 for each player connecting Or can I even save money by steamid in a cfg or so without php and mysql stuff? O_o Can i write that into plugin_init? Sorry, but I just started ^^" EDIT2: I used indenter and it did not place Tabstops correctly after some lines. (I manually corrected - indentation warning finally fixed) |
Re: Store custom command and value for each client which is callable and changeable
Ok put the register_concmd in plugin_init then for the actual function do something like this:
Code:
EDIT: Use Code:
|
Re: Store custom command and value for each client which is callable and changeable
O_o
Thanks a very lot! +Karma for you! :D Just some more things to master this plugin: - If i write %s this is replaced with a clients name, can i make something like %m to get replaced with users money? - How do i make a 2nd column in the menu, where i can list prices? - if i get the above 2 working i would love to know more about nVault :) edit: Code:
case 0:Now this one is very weird, as weapon_357 is, indeed, known as weapon_357. I guess I used this function in a wrong way, or i need to "#include" something. |
Re: Store custom command and value for each client which is callable and changeable
Quote:
>= means greater than or equal to. So if they have the same amout of money as the price or more it will purchase the item. For the undefined symbol I think you need to use the weapon's ID, which is probably in an include file, instead of weapon_357 which is something you never defined and doesnt exist in an include your using. |
Re: Store custom command and value for each client which is callable and changeable
Mh... I remain here:
if(get_user_ammo(id, get_weaponid(weapon_357), 0, 36) error 017: undefined symbol "weapon_357" If the id of a weapon is always the same in one game, i may just take the time and find out the id for every weapon?! edit: it says argument 3 (the 0) is a mismatch. And I still need to know how to make a second column in the menu for prices! :> Aaah! ingame error: ] amx_sc_buyammo L 07/15/2006 - 11:44:00: String formatted incorrectly - parameter 4 (total 3) L 07/15/2006 - 11:44:00: [AMXX] Run time error 25 (plugin "scbuyammo.amxx") - debug not enabled! L 07/15/2006 - 11:44:00: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes) EDIT: fixed. the %i did not work in the way how i used it. Please tell me how! :o edit: found out and it works fine :D and I also need the menu to stay open after selecting an item. may i add SCitemMenu(id) at the end of every case? edit: it works I would also apreciate a console message "[SC BUY AMMO] Target could not be found!" if amx_sc_buyammo_money_set targets non existing target and "[SC BUY AMMO] You set %i's Money to %i!" on admins chat who executed command and "[SC BUY AMMO] An Admin set your Money to %i!" on clients chat who got the %i money. edit: found it out So far! Now I really just need to know about that menu column and the get_user_ammo crap! |
| All times are GMT -4. The time now is 08:03. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.