Raised This Month: $ Target: $400
 0% 

guess what? :D


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-02-2006 , 10:27   guess what? :D
Reply With Quote #1

well my new plugin was suposed to exchange an amout of HP of a clip of ammo (3shells with shotgun), but if i test it well euh it does.... nothing
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #include <amxconst> #include <cstrike> #define PLUGIN "ammoforhp" #define VERSION "1.0" #define AUTHOR "wouter" public plugin_init()     {       register_plugin(PLUGIN, VERSION, AUTHOR)       register_clcmd("say /ammo", "cmd_ammo")       register_clcmd("say_team /ammo", "cmd_ammo")       register_cvar("amxx_ammoforhp", "1") }     public cmd_ammo(id) {           if ( ! get_cvar_num("amxx_ammoforhp") )           return PLUGIN_HANDLED         new AmmoCost = 10     new life = get_user_health(id)             if ( !is_user_alive(id) || life <= AmmoCost) {           client_print(id, print_chat, "[AmmoForHp] You are not alive or do not have enough HP!")           return PLUGIN_HANDLED       }         new weapid = read_data(2);         switch(weapid) {                 case CSW_P228: {             give_item(id,"ammo_357sig")         }         case CSW_SCOUT: {             give_item(id,"ammo_762nato")         }         case CSW_HEGRENADE: {             client_print(id, print_chat, "[AmmoForHp] There is no ammo for this item!")               return PLUGIN_HANDLED         }         case CSW_XM1014: {             give_item(id,"ammo_buckshot")             give_item(id,"ammo_buckshot")             give_item(id,"ammo_buckshot")         }         case CSW_C4: {             client_print(id, print_chat, "[AmmoForHp] There is no ammo for this item!")               return PLUGIN_HANDLED         }         case CSW_MAC10: {             give_item(id,"ammo_45acp")         }         case CSW_AUG: {             give_item(id,"ammo_556nato")         }         case CSW_SMOKEGRENADE: {             client_print(id, print_chat, "[AmmoForHp] There is no ammo for this item!")               return PLUGIN_HANDLED         }         case CSW_ELITE: {             give_item(id,"ammo_9mm")         }         case CSW_FIVESEVEN: {             give_item(id,"ammo_57mm")         }         case CSW_UMP45: {             give_item(id,"ammo_45acp")         }         case CSW_SG550: {             give_item(id,"ammo_556nato")         }         case CSW_GALIL: {             give_item(id,"ammo_308")         }         case CSW_FAMAS: {             give_item(id,"ammo_556nato")         }         case CSW_USP: {             give_item(id,"ammo_45acp")         }         case CSW_GLOCK18: {             give_item(id,"ammo_9mm")         }         case CSW_AWP: {             give_item(id,"ammo_338magnum")         }         case CSW_MP5NAVY: {             give_item(id,"ammo_9mm")         }         case CSW_M249: {             give_item(id,"ammo_556natobox")         }         case CSW_M3: {             give_item(id,"ammo_buckshot")             give_item(id,"ammo_buckshot")             give_item(id,"ammo_buckshot")         }         case CSW_M4A1: {             give_item(id,"ammo_556nato")         }         case CSW_TMP: {             give_item(id,"ammo_9mm")         }         case CSW_G3SG1: {             give_item(id,"ammo_762nato")         }         case CSW_FLASHBANG: {             client_print(id, print_chat, "[AmmoForHp] There is no ammo for this item!")               return PLUGIN_HANDLED         }         case CSW_DEAGLE: {             give_item(id,"ammo_50ae")         }         case CSW_SG552: {             give_item(id,"ammo_556nato")         }         case CSW_AK47: {             give_item(id,"ammo_762nato")         }         case CSW_KNIFE: {             client_print(id, print_chat, "[AmmoForHp] There is no ammo for this item!")               return PLUGIN_HANDLED         }         case CSW_P90: {             give_item(id,"ammo_57mm")         }         default: return PLUGIN_CONTINUE     }         set_user_health(id, get_user_health(id) - AmmoCost)     client_print(id, print_chat, "[AmmoForHp] You have exchanged health for ammo!")     return PLUGIN_HANDLED }
wouter is offline
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-02-2006 , 16:47  
Reply With Quote #2

you cannot use read_data because no data was passed. use this to get their weapon instead:

Code:
new clip, ammo, weapon = get_user_weapon(id,clip,ammo);
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-03-2006 , 02:24  
Reply With Quote #3

oh
wouter is offline
Reply



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 20:15.


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