Raised This Month: $ Target: $400
 0% 

ready to post?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-03-2006 , 11:36   ready to post?
Reply With Quote #1

hi i have made some plugins and i would like to post them,
but before i do i would apreciate it if some experianced scripters check it (or it is well writen, no bug, etc.). thx for your time
Code:
/* Plugin generated by AMXX-Studio */ /* With help from: Kraugh */ /* cvar: "amxx_ammoforhp" "1/0" */ /* say /ammo    to gain ammo, loose HP */ /* say_team /ammo   to gain ammo, loose HP */ #include <amxmodx> #include <fun> #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     // Change how much hp you loose for the ammo     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 clip, ammo, weapon = get_user_weapon(id,clip,ammo);               switch(weapon) {                 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")                     }         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")                     }         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 }
end
Code:
/* Plugin generated by AMXX-Studio */       /* Many help form [ --<-@ ] Black Rose end ^_^Satan^_^ Thx you guys say \camouflage           // client cmd say_team \camouflage     // client cmd amxx_camouflage <1/0>   // enable / disable by admin */     #include <amxmodx>       #include <fun>       #include <cstrike>       new PLUGIN[]="Camouflage"   new AUTHOR[]="wouter"   new VERSION[]="1.00" new CamoCost = 16000  // Edit this to change the price of the Camouflage   new bool:HasCamo[33]   new CTModels[] =     {         "urban", "gsg9",       "gign", "sas"   }     new TModels[] =       {         "terror", "leet",       "artic", "guerilla"   }     public client_connect(id) {       HasCamo[id] = false   }   public plugin_init() {       register_plugin(PLUGIN, VERSION, AUTHOR)           register_event("DeathMsg", "DeathEvent", "a")       register_event("ResetHUD", "ResetHud", "a")           register_clcmd("say /camouflage", "cmd_camouflage")       register_clcmd("say_team /camouflage", "cmd_camouflage")           register_cvar("amxx_camouflage", "1")   }       public cmd_camouflage(id) {           if ( ! get_cvar_num("amxx_camouflage") )           return PLUGIN_HANDLED       new money = cs_get_user_money(id)       new CsTeams:team = cs_get_user_team(id)               if ( !is_user_alive(id) || money < CamoCost ) {           client_print(id, print_chat, "You are not alive or do not have enough money!")           return PLUGIN_HANDLED       }           if ( HasCamo[id] == false ) {                   cs_set_user_money( id, cs_get_user_money(id) - CamoCost )           client_print( id, print_chat, "You have bought a camouflage!" )           HasCamo[id] = true                   if (team == CS_TEAM_CT) {               cs_set_user_model(id, TModels)               return PLUGIN_CONTINUE;             }                   else if (team == CS_TEAM_T) {               cs_set_user_model(id, CTModels)             return PLUGIN_CONTINUE           }       }       return PLUGIN_HANDLED   }   public DeathEvent() {           if ( ! get_cvar_num("amxx_camouflage") )           return PLUGIN_HANDLED           new id = read_data(2)           if ( HasCamo[id] == true ) {         set_task( 1.0, "reset_model", id )     }     return PLUGIN_HANDLED   } public ResetHud(id) {           if ( ! get_cvar_num("amxx_camouflage") )           return PLUGIN_HANDLED           new CsTeams:team = cs_get_user_team(id)           if ( HasCamo[id] == true ) {                   if (team == CS_TEAM_CT) {               cs_set_user_model(id, TModels)           }                   else if (team == CS_TEAM_T) {               cs_set_user_model(id, CTModels)         }       }       return PLUGIN_HANDLED   } public reset_model(id) {     cs_reset_user_model(id)     HasCamo[id] = false }
Attached Files
File Type: sma Get Plugin or Get Source (ammoforhp.sma - 623 views - 3.3 KB)
File Type: sma Get Plugin or Get Source (amxx_camouflage.sma - 616 views - 2.6 KB)
wouter is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-03-2006 , 11:49  
Reply With Quote #2

seems to be no prob...
but bcas u have defined
Code:
new life = get_user_health(id)
you can change this :
Code:
set_user_health(id, get_user_health(id) - AmmoCost)
to this :
Code:
set_user_health(id, life - AmmoCost)
[ --<-@ ] Black Rose is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-03-2006 , 16:24  
Reply With Quote #3

ok i will. thx
but exapt that it looks nicer has it some reason to do that?
wouter is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 03-03-2006 , 16:26  
Reply With Quote #4

Quote:
Originally Posted by wouter
ok i will. thx
but exapt that it looks nicer has it some reason to do that?
It's faster, since you already saved the result. Less overhead too.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-03-2006 , 16:26  
Reply With Quote #5

nawh
it looks more professional
[ --<-@ ] Black Rose is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 03-03-2006 , 16:27  
Reply With Quote #6

Quote:
Originally Posted by [ --<-@
Black Rose]nawh
it looks more professional
No, you're wrong. It's faster and has less overhead.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-03-2006 , 16:33  
Reply With Quote #7

i didnt know that... i must have posted like 0.001 ms after you... never saw you post but now i know
i thought if you wrote new life = get_user_health(id)
and every time you use life it would call the get_user_health... i don't get the differance?
[ --<-@ ] Black Rose is offline
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-03-2006 , 16:36  
Reply With Quote #8

i guess it will make life equal to the command then and life is shorter then the command?
wouter is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 03-03-2006 , 16:36  
Reply With Quote #9

That is one of the most illogical things I have seen someone here say. If that was true, this would not work:

Code:
new iWhatever = 2 iWhatever = 3 if(iWhatever == 3) // Here it would end, because you have no idea what you're talking about
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
wouter
Senior Member
Join Date: Feb 2005
Location: Belgium
Old 03-03-2006 , 16:39  
Reply With Quote #10

Quote:
Originally Posted by Hawk552
That is one of the most illogical things I have seen someone here say. If that was true, this would not work:

Code:
new iWhatever = 2 iWhatever = 3 if(iWhatever == 3) // Here it would end, because you have no idea what you're talking about
sorry for beeing noob
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:20.


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