AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   More help learning (https://forums.alliedmods.net/showthread.php?t=361)

Peli 03-20-2004 03:02

More help learning
 
Hello , I am very close to becoming good at making plugins. I just need you guys to maybe tell me a few things that I should know because I'm still a little confused. Maybe you can ask me to make some plugins , make sure they are easy :) And give me tips if possible. I can understand other peoples plugins now , before I was so confused but now it is fun. :)

IceMouse[WrG] 03-20-2004 09:39

Tips? It's hard to give little tips because a lot of people have thier own style... But I suppose the normal ones are:
1. Write structured using tabs(Or 4 spaces for all the hoes out there)
2. Write lots of comments
3. Don't only code to get women... I know it helps a lot, but you need love for the code

Anyhow if you want an easy plugin then try to remake one thats already out, then you'll have source to refer to

Ezekiel 03-20-2004 09:42

Quote:

Originally Posted by IceMouse[WrG
3] Don't only code to get women... I know it helps a lot, but you need love for the code

lol

tnsk8er27 03-20-2004 13:18

nice one : ) .......... plugins are FUn!

[RED-Designs] 03-20-2004 14:11

Quote:

Originally Posted by IceMouse[WrG
]3. Don't only code to get women... I know it helps a lot, but you need love for the code

What women? :? -looks around-

If programing would get me babes wouldnt I be off getting laid right now instead of posting this message? :wink:

Peli 03-20-2004 14:40

Wow lol. This has become a fun fest.

tnsk8er27 03-20-2004 14:41

i know stick to the topic


peli....

make a plugin that lets you say somthing to a certain player ....

ex. amx_say <message> <player> (there already is a psay but try to "remake" it)

[RED-Designs] 03-20-2004 15:06

Quote:

Originally Posted by tnsk8er27
i know stick to the topic


peli....

make a plugin that lets you say somthing to a certain player ....

ex. amx_say <message> <player> (there already is a psay but try to "remake" it)

I remember just a cuple days ago you didnt know much at all and look at you now, you're even giving magic a run for his money.

tnsk8er27 03-20-2004 15:28

yeah lol ive made two plugins and published them already

someone can learn alot in just a few days!

[RED-Designs] 03-20-2004 15:37

Quote:

Originally Posted by tnsk8er27
yeah lol ive made two plugins and published them already

someone can learn alot in just a few days!

Dont be so speedy though, might get a bad rep.

IceMouse[WrG] 03-20-2004 15:38

Quality over quantity

[RED-Designs] 03-20-2004 15:42

Quote:

Originally Posted by IceMouse[WrG
]Quality over quantity

Exactly, you dont want to become a person with say 500 posts and they only have a cuple words. Need to be respectible and actually have something to say and having it actually hold up and be worth reading.

tnsk8er27 03-20-2004 15:54

i guess your right, but i havent really "rushed" at all ive just been working on it alot latley just cuz i think its fun. Im not just doing it to make alot, its more of a pleasure to me to know im making plugins. (like a week ago i knew not one thing about programing)

[RED-Designs] 03-20-2004 15:57

Quote:

Originally Posted by tnsk8er27
i guess your right, but i havent really "rushed" at all ive just been working on it alot latley just cuz i think its fun. Im not just doing it to make alot, its more of a pleasure to me to know im making plugins. (like a week ago i knew not one thing about programing)

I know how it feels, just dont run to fast around the pool. Also, this refers to more then just your plugins. You're spam posts aswell. We all spam sometimes, just try not to do it to often.

tnsk8er27 03-20-2004 16:29

yeah i know what you mean but really spamming doesnt really hurt anyone does it?

[RED-Designs] 03-20-2004 16:53

Quote:

Originally Posted by tnsk8er27
yeah i know what you mean but really spamming doesnt really hurt anyone does it?

It hurts me, -opens his shirt and watches the blood pour everywhere-

No I wasnt wearing red today, I am just dieing

:P

IceMouse[WrG] 03-20-2004 18:19

Spamming does hurt everyone... You can't tell yet because it's only on a small scale... But anyone moving from AMX knows that if it gets out of hand then bad things happen

tnsk8er27 03-20-2004 18:26

well what red calls spamming i dont think is spamming...

he tells me to quit spamming every time i post a small msg

Freecode 03-20-2004 18:28

dont bother him. he just learned what double posting is.

IceMouse[WrG] 03-20-2004 18:29

Small messages aren't spam if they really have a message... It is spam if you make a post of "Oh," or "Cool"
If you want to make the same point as saying "Oh," or "Cool," then drag it out:
"Oh wow that helped me a lot. I understand now, thanks. I'll tell you if I need anymore help"
"Thats pretty cool, I'll have to show that to me friends. Where do you find this stuff?!"

EDIT: On topic, please, BTW

Peli 03-20-2004 20:24

Okay , I will try to do what you said , your name is too complicated so I'm just going to call you "Toxic". I will need help on what I need to do though , I am very confused :(

IceMouse[WrG] 03-20-2004 21:13

Give us a place to start helping you

Peli 03-20-2004 21:26

Any sugguestions on an easy plugin to make? I have never made them so I wouldn't know , your advice please then you guys can help me and explain what everything does.

tnsk8er27 03-20-2004 21:29

ohhh i thought you made some before...

make one that says hi everyone when you type a command in the console

QwertyAccess 03-20-2004 22:04

Quote:

Originally Posted by Peli
Any sugguestions on an easy plugin to make? I have never made them so I wouldn't know , your advice please then you guys can help me and explain what everything does.

an easy plugin to make would be is on the event of Resethud set their health to a certain number there you go you have a spawn health changer lol.

Peli 03-20-2004 23:58

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...

[RED-Designs] 03-21-2004 00:47

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 :D

MagicShot 03-21-2004 00:53

yeah
 
Yeah basically but, looks like your no-clip plugin :P

hehe

[RED-Designs] 03-21-2004 00:55

Re: yeah
 
Quote:

Originally Posted by MagicShot
Yeah basically but, looks like your no-clip plugin :P

hehe

Just cause I happen to make a plugin alot like another it looks like the other? (Trying to confuse the hell out of you with nonsense)

I like how the no-clip plugin was coded and I make alot of plugins like it. It gets the job done :D

Freecode 03-21-2004 00:57

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 :D

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 }

IceMouse[WrG] 03-21-2004 00:57

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

Freecode 03-21-2004 00:58

word. way to comples. my example or ice's is much better. no need to show off :wink:

[RED-Designs] 03-21-2004 00:59

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 :P

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.

IceMouse[WrG] 03-21-2004 01:00

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"

MagicShot 03-21-2004 01:33

lol
 
Looks Good the second one by ice is easier and what i wprolly would have done lol

Peli 03-21-2004 01:56

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.

QwertyAccess 03-21-2004 02:09

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 }

-__-

MagicShot 03-21-2004 02:13

Nice Freecode
 
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 }

Peli 03-21-2004 02:17

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.

QwertyAccess 03-21-2004 02:20

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.


All times are GMT -4. The time now is 10:44.

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