Raised This Month: $ Target: $400
 0% 

changing health plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sonic7145
Member
Join Date: Jul 2005
Location: USA
Old 12-28-2005 , 23:50   changing health plugin
Reply With Quote #1

pruned

Last edited by Sonic7145; 08-09-2021 at 04:13.
Sonic7145 is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 12-29-2005 , 00:06  
Reply With Quote #2

You need to give Arg2 a specified length. Some other minor fixes. Also, you should use cmd_access instead of:
Code:
  if (!(get_user_flags(id)&ADMIN_KICK)) {     console_print(id,"No access to amx_health - Sorry.")     return PLUGIN_HANDLED   }   if (read_argc() == 0) {     console_print(id,"No user given.")     return PLUGIN_HANDLED   }

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "AMX Health" #define VERSION "1.0" #define AUTHOR "Sonic" public plugin_init() {          register_plugin(PLUGIN, VERSION, AUTHOR)      register_concmd("amx_health", "change_health", ADMIN_KICK, "admin changes a users health ")       } public change_health(id){   if (!(get_user_flags(id)&ADMIN_KICK)) {     console_print(id,"No access to amx_health - Sorry.")     return PLUGIN_HANDLED   }   if (read_argc() == 0) {     console_print(id,"No user given.")     return PLUGIN_HANDLED   }   new user[32], uid, Arg2[4];       read_argv(1,user,32)   read_argv(2,Arg2,3)   new hp = str_to_num(Arg2)   uid = find_player("bh",user)   if (uid == 0) {     console_print(id,"Couldn't find user.")     return PLUGIN_HANDLED   }       set_user_health(uid, hp)   console_print(id,"User's health has been set to %i!")   return PLUGIN_HANDLED }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Kensai
Veteran Member
Join Date: Aug 2005
Location: San Diego, California
Old 12-29-2005 , 00:07  
Reply With Quote #3

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {      register_plugin("AMX Health","1.0","Sonic") //this is easier then your defines      register_concmd("amx_health", "change_health", ADMIN_KICK, "<target> <health> - admin changes a users health ") //Needed args } public change_health(id,level,cid) {     if (!cmd_access(id,level,cid, 3))//Thisautomatically prints a "no access" message     return PLUGIN_HANDLED           new arg[32], arg2[32]     read_argv(1,arg,31)//read_argv reads the arguments or the "target and health"     read_argv(2,arg2,31)         new target=cmd_target(id,arg,4)//4 means they must be alive         if(!target)     {         client_print(id,print_console,"[AMXX] Invalid target!")//if there is no one that matches the target, it prints the message         return PLUGIN_HANDLED     }         set_user_health(target,arg2)//target is the person your setting heatlh, arg2 is the second argument "<health>"     return PLUGIN_HANDLED }
Kensai is offline
Send a message via AIM to Kensai Send a message via MSN to Kensai
Charr
Senior Member
Join Date: Jul 2005
Location: Long Island, New York, U
Old 12-29-2005 , 12:34  
Reply With Quote #4

Kensai you need to use
Code:
set_user_health(target,str_to_num(arg2))
Charr is offline
Send a message via AIM to Charr Send a message via MSN to Charr
Old 12-29-2005, 19:55
Sonic7145
This message has been deleted by Sonic7145.
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 16:12.


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