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
Author Message
Silencer123
Veteran Member
Join Date: Jul 2006
Old 07-13-2006 , 07:19   Store custom command and value for each client which is callable and changeable
Reply With Quote #1

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>
#include <fun>
public plugin_init()
{
  register_plugin("SC Give Ammo","1.0","Silencer")
  register_menucmd(register_menuid("Ammo Menu"),1023,"SCitemMenuChoice")
  register_concmd("sc_giveammo", "check", 1, "- Enter sc_giveammo and select an option")
  register_concmd("sc_toggle_giveammo","toggle",ADMIN_MENU,"<1|0> - Turns SC Ammo Menu On or Off.")
  register_cvar("scgiveammo_toggle","1",FCVAR_SERVER)
  set_cvar_string("scgiveammo_toggle","1")
}
public toggle(id)
{
 if(get_cvar_num("scgiveammo_toggle")==1)
 {
  set_cvar_string("scgiveammo_toggle","0")
  client_print(0,print_chat,"[AMXX] SC Ammo has been disabled by the admin!")
  server_print("SC Ammo menu has been disabled!")
 }
 else
 {
  set_cvar_string("scgiveammo_toggle","1")
  client_print(0,print_chat,"[AMXX] SC 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("scgiveammo_toggle")==0)
 {
  client_print(id,print_chat,"[AMXX] SC 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, "Ammo Menu^n^n 1.  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:
  {
   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 six Rounds for the 357",Client)
   give_item(id,"ammo_357")
 
  }
  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 
}

Last edited by Silencer123; 07-14-2006 at 11:38. Reason: Former Version was probably incomprehensible.
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