AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   New A HeadStart In Coding (https://forums.alliedmods.net/showthread.php?t=55614)

[CFF] gr3ed 05-26-2007 02:36

New A HeadStart In Coding
 
Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "amx_example" //Takes 1,000 from all users with z flag and gives to admin who exectues this till he turns it off
#define VERSION "1.0"
#define AUTHOR "gr3ed"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
   
}

Can someone show me what I'd put and add comments to explain why I'd do that? I need some examples so I can figure this out. Gonna add a few more....help with any you can.


Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "amx_shank" /exec at someone and counts as a knife kill for the admin
#define VERSION "1.0"
#define AUTHOR "gr3ed"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
}

Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "amx_fall_bury" //if user falls over 50 feet, he gets partially buried in ground for a specified time
#define VERSION "1.0"
#define AUTHOR "gr3ed"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
}

Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "amx_dance" //plays .wav file and user spins while sliding sideways, back and forth till .wav file stops
#define VERSION "1.0"
#define AUTHOR "gr3ed"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)

}


Cheap_Suit 05-26-2007 02:55

Re: New A HeadStart In Coding
 
Well, here is one.

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
 
#define PLUGIN "amx_example"
#define VERSION "1.0"
#define AUTHOR  "gr3ed"
 
public plugin_init() 
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
register_concmd("amx_example""example_function"ADMIN_BAN)
}
public 
example_function(idlevelcid)
{
 if(!
cmd_access(idlevelcid1))
  return 
PLUGIN_HANDLED
 
 
for(new user 0user <= get_maxplayers(); ++user)
 {
  if(!
is_user_connected(user))
   continue
 
  if(
get_user_flags(user) & ADMIN_USER)
  {
   new 
steal_money 1000
   
new money cs_get_user_money(user)
   new 
admin_money cs_get_user_money(id)
 
   if(
money 1000)
   {
    
steal_money money
   
}
 
   new 
set_money money steal_money
   cs_set_user_money
(userset_money)
 
 
   new 
set_admin_money admin_money steal_money
   cs_set_user_money
(idset_admin_money)
 
   new 
name[32]
   
get_user_name(username31)
   
client_print(idprint_console"You stole $%d from %s"steal_moneyname)
  }
 }
 return 
PLUGIN_HANDLED



[CFF] gr3ed 05-26-2007 02:58

Re: New A HeadStart In Coding
 
Thanks, will check it out now^_^ Just trying to find my own way of learning to code and this seemed most logical to me. If you could just add a few comments, it'd help. Sorry...I'm sort of lost atm with coding. Tried studying this for awhile but it never seemed to make sense.

Cheap_Suit 05-26-2007 03:05

Re: New A HeadStart In Coding
 
Yea sure, give me a sec. This is how I learned too, thats why I still suck at coding till now.

[CFF] gr3ed 05-26-2007 03:09

Re: New A HeadStart In Coding
 
Well, I think someone of your nature would be perfect for writing a tutorial on this then since it sounds like you literally have jumped thru the hurdles to learn to program. But probably too time consuming so that's alright;)
Quote:

Originally Posted by Cheap_Suit (Post 481973)
Yea sure, give me a sec. This is how I learned too, thats why I still suck at coding till now.


Cheap_Suit 05-26-2007 03:19

Re: New A HeadStart In Coding
 
http://www.ampaste.net/15368

P.S. Here is a great program for starters.
http://forums.alliedmods.net/showthread.php?t=49149


[CFF] gr3ed 05-26-2007 03:24

Re: New A HeadStart In Coding
 
Ahhh....I see what I did wrong.
Quote:

P.S. Here is a great program for starters.
http://forums.alliedmods.net/showthread.php?t=49149
The thing does not seem to automatically add some things it should.


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

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