Raised This Month: $ Target: $400
 0% 

Store custom command and value for each client which is callable and changeable


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Silencer123
Veteran Member
Join Date: Jul 2006
Old 07-14-2006 , 15:00   Re: Store custom command and value for each client which is callable and changeable
Reply With Quote #4

/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.
* SC Give Ammo - Version 1.0 by Silencer
*/
#include <amxmodx>
#include <amxmisc>
#include <fun>
new g_money[33]
public plugin_init()
{
 register_plugin("SC Buy Ammo","1.0","Silencer")
 register_menucmd(register_menuid("Ammo Menu"),1023,"SCitemMenuChoice")
 register_concmd("amx_sc_buyammo", "check", 1, "- Enter amx_sc_buyammo and select an option")
 register_concmd("amx_sc_buyammo_status","toggle",ADMIN_LEVEL_A,"<1|0> - Turns SC Ammo Menu On or Off.")
 register_concmd("amx_sc_buyammo_money","g_money",ADMIN_LEVEL_A,"<Playername> <Value bigger than -1> - Set Players Money.")
 register_cvar("amx_sc_buyammo_toggle","1",FCVAR_SERVER)
 set_cvar_string("amx_sc_buyammo_toggle","1")
}
public toggle(id)
{
 if(get_cvar_num("amx_sc_buyammo_toggle")==1)
 {
  set_cvar_string("amx_sc_buyammo_toggle","0")
  client_print(0,print_chat,"[AMXX] SC Buy Ammo has been disabled by the admin!")
  server_print("SC Ammo menu has been disabled!")
 }
 else
 {
  set_cvar_string("amx_sc_buyammo_toggle","1")
  client_print(0,print_chat,"[AMXX] SC Buy Ammo has been enabled by the admin!")
  server_print("SC Ammo menu has been enabled!")
 }
 return PLUGIN_HANDLED
}
public check(id)
{
 if(get_cvar_num("amx_sc_buyammo_toggle")==0)
 {
  client_print(id,print_chat,"[AMXX] SC Buy Ammo menu is currently disabled!")
 }
 else
 {
  SCitemMenu(id)
 }
 return PLUGIN_HANDLED
}
public SCitemMenu(id)
{
 if (is_user_alive(id))
 {
  new menuBody[1024]
  new key
  
  format(menuBody, 1023, "Buy Ammo Menu^n^n 1.  Buy 357 Ammo^n 2.  Shotgun Ammo^n 3.  Sniperrifle Ammo^n 4.  Crossbow Ammo^n 5.  Energy Cells^n 6.  RPG Rockets^n 7.  AR Grenades^n 8.  9mm Ammo^n 9.  Minigun Rounds^n^n 0.  Cancel")
  key = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
  
  show_menu(id, key, menuBody)
 }
}
public SCitemMenuChoice(id, key)
{
 new Client[21]
 get_user_name(id,Client,20)
 
 switch(key)
{
 case 0:
{
 if(get_cvar_num("g_money")>99)
 {
  give_item(id,"ammo_357")
  client_print(id,print_chat,"[AMXX] You bought six Rounds for the 357!")
  g_money[id] - 100
 }
 else
 {
  client_print(id,print_chat,"[AMXX] You do not have enough money!")
 }
 return PLUGIN_HANDLED
}
case 1:
{
set_hudmessage(100,110,125, 0.02, 0.73, 0, 6.0, 2.0, 0.1, 0.2, 4)
show_hudmessage(0, "[AMXX] %s has got twelve Buckshots for the Shotgun",Client)
give_item(id,"ammo_buckshot")
}
case 2:
{
set_hudmessage(100,110,125, 0.02, 0.73, 0, 6.0, 2.0, 0.1, 0.2, 4)
show_hudmessage(0, "[AMXX] %s has got five Bullets for the Sniperrifle",Client)
give_item(id,"ammo_762")
}
case 3:
{
set_hudmessage(100,110,125, 0.02, 0.73, 0, 6.0, 2.0, 0.1, 0.2, 4)
show_hudmessage(0, "[AMXX] %s has got five Arrows for the Crossbow",Client)
give_item(id,"ammo_crossbow")
}
case 4:
{
set_hudmessage(100,110,125, 0.02, 0.73, 0, 6.0, 2.0, 0.1, 0.2, 4)
show_hudmessage(0, "[AMXX] %s has got 20 Energy Cells for the Gauss and Egon",Client)
give_item(id,"ammo_gaussclip")
}
case 5:
{
set_hudmessage(100,110,125, 0.02, 0.73, 0, 6.0, 2.0, 0.1, 0.2, 4)
show_hudmessage(0, "[AMXX] %s has got two Rockets for the RPG Launcher",Client)
give_item(id,"ammo_rpgclip")
}
case 6:
{
set_hudmessage(100,110,125, 0.02, 0.73, 0, 6.0, 2.0, 0.1, 0.2, 4)
show_hudmessage(0, "[AMXX] %s has got two AR Grenades for the 9mm AR",Client)
give_item(id,"ammo_ARgrenades")
}
case 7:
{
set_hudmessage(100,110,125, 0.02, 0.73, 0, 6.0, 2.0, 0.1, 0.2, 4)
show_hudmessage(0, "[AMXX] %s has got 17 9mm Bullets",Client)
give_item(id,"ammo_9mmclip")
}
case 8:
{
set_hudmessage(100,110,125, 0.02, 0.73, 0, 6.0, 2.0, 0.1, 0.2, 4)
show_hudmessage(0, "[AMXX] %s has got 100 Rounds for the Minigun",Client)
give_item(id,"ammo_556")
} 
case 9: 
{
} 
}
return PLUGIN_HANDLED
}
Silencer123 is offline
 



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 08:03.


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