Raised This Month: $51 Target: $400
 12% 

More help learning


Post New Thread Reply   
 
Thread Tools Display Modes
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 03-21-2004 , 00:57  
Reply With Quote #31

That is far too complex for him...
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() { register_plugin("sethealth","0.1","Peli"); register_concmd("amx_sethealth","cmdSetHealth",ADMIN_LEVEL_A); return PLUGIN_CONTINUE; } public cmdSetHealth(id,level,cid) { if(!cmd_access(id,level,cid,2))     return PLUGIN_HANDLED; new target[50]; read_argv(1,target,50); new player=cmd_target(target); if(player) set_user_health(player, 500); return PLUGIN_HANDLED }

EDIT: The "Far too complicated" was for RED
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 03-21-2004 , 00:58  
Reply With Quote #32

word. way to comples. my example or ice's is much better. no need to show off
Freecode is offline
[RED-Designs]
Senior Member
Join Date: Mar 2004
Location: .us
Old 03-21-2004 , 00:59  
Reply With Quote #33

Quote:
Originally Posted by IceMouse[WrG
]That is far too complex for him...
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() { register_plugin("sethealth","0.1","Peli"); register_concmd("amx_sethealth","cmdSetHealth",ADMIN_LEVEL_A); return PLUGIN_CONTINUE; } public cmdSetHealth(id,level,cid) { if(!cmd_access(id,level,cid,2))     return PLUGIN_HANDLED; new target[50]; read_argv(1,target,50); new player=cmd_target(target); if(player) set_user_health(player, 500); return PLUGIN_HANDLED }

EDIT: The "Far too complicated" was for RED
I feel so loved

I guess I have been coding so long that I am blurred on what is or isnt complicated to a new comer. Sorry but my way is something to look at in the terms of learning new structures.
__________________
.My personal Blog
."If the country were open on its borders, new
forms would certainly immigrate, and this also
would seriously disturb the relations of some
of the former inhabitants." - Charles Darwin
[RED-Designs] is offline
Send a message via AIM to [RED-Designs] Send a message via MSN to [RED-Designs] Send a message via Yahoo to [RED-Designs]
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 03-21-2004 , 01:00  
Reply With Quote #34

Try and analyze the code line-by-line of mine or Freecode's... Tell us what parts you don't understand is happening... Don't attempt to ask us to get into detail... A lot of the stuff when you begin will be "It works because it does, live with it or don't use it"
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-21-2004 , 01:33   lol
Reply With Quote #35

Looks Good the second one by ice is easier and what i wprolly would have done lol
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 03-21-2004 , 01:56  
Reply With Quote #36

Code:
public cmdSetHealth(id,level,cid) { 
if(!cmd_access(id,level,cid,2))
    return PLUGIN_HANDLED;
Okay on this part I didn't understand the "(id,level,cid)" thing. I know what the if statement means , its just checken if the access was right , I think.
Code:
new target[50];
read_argv(1,target,50);
new player=cmd_target(target);
if(player)
set_user_health(player, 500);
return PLUGIN_HANDLED
}
Okay on this part I didn't understand the "new target[50]" and the "read_argv(1,target,50)" part , but I understood the new player=cmd_target(target) , I think it is just activating the command target. Then it set the users health , Okay thank you guys for replying so much and having to deal with my noobness.
Peli is offline
Send a message via MSN to Peli
QwertyAccess
Veteran Member
Join Date: Feb 2004
Location: Enjiru Layer
Old 03-21-2004 , 02:09  
Reply With Quote #37

You guys over do it..

Code:
#include <amxmod> public start_health(id) {         set_user_health(id,get_cvar_num("amx_healthstart"))         return PLUGIN_CONTINUE } public plugin_init() {         register_event("ResetHUD", "start_health", "b")         register_cvar("amx_healthstart","100")         return PLUGIN_CONTINUE }

-__-
__________________
QwertyAccess is offline
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-21-2004 , 02:13   Nice Freecode
Reply With Quote #38

Couldn't you also do this?:

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) {     new i = 0     while(i++ <= get_maxplayers) {         set_user_health(i,500)     }     return PLUGIN_HANDLED }
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 03-21-2004 , 02:17  
Reply With Quote #39

Wow , good job guys , both of them were nice. I understood everything but one line on Qwerty's post. What does this mean and what does it do?
Code:
set_user_health(id,get_cvar_num("amx_healthstart"))
Okay thanks for responding so fast , I might go to sleep so I'll post tommorow.
Peli is offline
Send a message via MSN to Peli
QwertyAccess
Veteran Member
Join Date: Feb 2004
Location: Enjiru Layer
Old 03-21-2004 , 02:20  
Reply With Quote #40

Quote:
Originally Posted by Peli
Wow , good job guys , both of them were nice. I understood everything but one line on Qwerty's post. What does this mean and what does it do?
Code:
set_user_health(id,get_cvar_num("amx_healthstart"))
Okay thanks for responding so fast , I might go to sleep so I'll post tommorow.
get_cvar_num gets the number specified in the cvar amx_healthstart so if you have amx_healthstart set to 395 they will spawn with 395 hp.
__________________
QwertyAccess 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 06:23.


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