View Single Post
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-21-2004 , 00:57  
Reply With Quote #30

Quote:
Originally Posted by [RED-Designs
]
Quote:
Originally Posted by Peli
Can you help me a bit more. I think I know how to do it. Would it be like this ?
Code:
public plugin_init() { register_plugin("sethealth","0.1","Peli") register_concmd("amx_sethealth,ADMIN_LEVEL_A") return PLUGIN_CONTINUE } public reset_hud { set_user_health(500) return PLUGIN_HANDLED }

Okay , things I didn't understand or know :
1. How would I write the "reset_hud" event? I just guessed sorry...
2. Do I just "set_user_health(500)" ? Or do I have to do more?

Okay , if you can please help me...
Here is how it should be, or close to it.

Code:
/*  * Plugin by Peli and [RED-Designs]  */ #include <amxmod> #include <amxmisc> public plugin_init() { register_plugin("sethealth","0.1","Peli") register_concmd("amx_set500hp","admin_setHP",ADMIN_LEVEL_A,"<name>") return PLUGIN_CONTINUE } public admin_setHP(id,level,cid) {     if (!cmd_access(id,level,cid,3))         return PLUGIN_HANDLED     new arg[32], arg2[8], name2[32]     read_argv(1,arg,31)     read_argv(2,arg2,7)     get_user_name(id,name2,31)     if (arg[0]=='@'){         new players[32], inum         get_players(players,inum,"ae",arg[1])         if (inum==0){             console_print(id,"No clients in such team")             return PLUGIN_HANDLED         }         for(new a=0;a<inum;++a) {                         if(str_to_num(arg2)==1){                         set_user_health(players[a],500)                         }         }                switch(get_cvar_num("amx_show_activity"))   {             case 2:   client_print(0,print_chat,"ADMIN %s: set 500 hp on all %s",name2,arg[1])             case 1:   client_print(0,print_chat,"ADMIN: set 500 hp on all %s",arg[1])            }         console_print(id,"All clients have set noclip")     }     else {         new player = cmd_target(id,arg,7)         if (!player) return PLUGIN_HANDLED                 if(str_to_num(arg2)==1){                 set_user_health(player,500)         }         new name[32]         get_user_name(player,name,31)         switch(get_cvar_num("amx_show_activity"))   {             case 2:   client_print(0,print_chat,"ADMIN %s: set 500 hp on %s",name2,name)             case 1:   client_print(0,print_chat,"ADMIN: set 500 hp on %s",name)            }         console_print(id,"Client ^"%s^" has set noclip",name)     }     return PLUGIN_HANDLED  }

I havent tested it but I think it should work
nope wrong
if u read what he asked you would noe what he wanted.
1. you need to register ResetHUD event
2. Yes you need to pass an id parameter. set_user_health(id,500)
Code:
public plugin_init() { register_plugin("sethealth","0.1","Peli") register_clcmd("amx_sethealth","setH",ADMIN_LEVEL_A,"set everyones health to 500") register_event("ResetHUD","reset_hud","be") } public reset_hud(id) { set_user_health(id,500) return PLUGIN_HANDLED } public setH(id) { for(new i = 0; i <= get_maxplayers;i++) { set_user_health(i,500) } return PLUGIN_HANDLED }
Freecode is offline