Raised This Month: $ Target: $400
 0% 

Code look-over


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phantom Warrior
BANNED
Join Date: Feb 2007
Location: hello, gaben
Old 02-05-2007 , 19:00   Code look-over
Reply With Quote #1

Please, look over my code, and look for anything that doesn't fit. I'll be adding WAY more stuff for it, later on.
PHP Code:
#include <amxmodx>
 #include <fun>

 #define PLUGIN "Champ is here"
#define VERSION "1.0"
#define AUTHOR "Phantom Warrior"

public plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
register_concmd("amx_champ""cmdchamp"ADMIN_LEVEL_A"Makes  the  user  have  lots  of  powers.")
 
 
register_concmd("champ_randomglow""cmdchampglow"ADMIN_LEVEL_A"<#userid>,<#nick>.")
 
 
register_concmd("champ_setspeed""cmdsetspeed"ADMIN_LEVEL_B"<#userid>,<#nick>.")

 
}
public  
cmdchamp(id)
{
    
set_user_rendering(id,kRenderFxGlowShell,255,0,0,kRenderNormal,25)
    
set_user_maxspeed(id,get_user_maxspeed(id) + 9000.0)
client_print(0,print_chat,"[CHAMP] %i is now the champion, Be careful!.")
new 
nameArg[32]
read_argv(nameArg 31);

new 
target cmd_target(id nameArg FLAGS);

set_user_rendering(target,255,0,0)

}
public 
cmdchampglow(id)
{
    
set_user_rendering(idkRanderFxGlowShell450,0,450,0,kRenderNormal25)
    
client_print(0,print_chat,"[CHAMP] %s has called Random Glow on %i.")
    new 
nameArg[32]
read_argv(nameArg 31);

new 
target cmd_target(id nameArg FLAGS); 

set_user_rendering(target,450,0,450,0)
    
}
public  
cmdsetspeed(id)
{
    
set_user_maxspeed(id,get_user_maxspeed(id) +//What would I put here for any numbers?
    
client_print(0,print_chat,"[CHAMP] %s has gave %i a speed change.")

    
PLUGIN_HANDLED
    
}

//CREDITS:  Xanimos, SixTwin. 
Phantom Warrior is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 02-05-2007 , 20:04   Re: Code look-over
Reply With Quote #2

1. Your indenting needs to be improved.
2. Use small tags ([small])

I added a admin check on each command (assuming that's what you wanted)
But of course this code can't compile yet, you have invalid strings.
Code:
client_print(0,print_chat,"[CHAMP] %s has gave %i a speed change.")
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "Champ is here" #define VERSION "1.0" #define AUTHOR "Phantom Warrior" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_concmd("amx_champ", "cmdchamp", ADMIN_LEVEL_A, "Makes  the  user  have  lots  of  powers.")     register_concmd("champ_randomglow", "cmdchampglow", ADMIN_LEVEL_A, "<#userid>,<#nick>.")     register_concmd("champ_setspeed", "cmdsetspeed", ADMIN_LEVEL_B, "<#userid>,<#nick>.")         server_cmd("sv_maxspeed 99999")   } public  cmdchamp(id,level,cid) {     if(!cmd_access(id,level,cid,2)) {         return PLUGIN_HANDLED     }     set_user_rendering(id,kRenderFxGlowShell,255,0,0,kRenderNormal,25)     set_user_maxspeed(id,get_user_maxspeed(id) + 9000.0)     client_print(0,print_chat,"[CHAMP] %i is now the champion, Be careful!.")     new nameArg[32]     read_argv(1 , nameArg , 31);         new target = cmd_target(id , nameArg , FLAGS);     set_user_rendering(target,255,0,0)     } public cmdchampglow(id) {     if(!cmd_access(id,level,cid,2)) {         return PLUGIN_HANDLED     }         set_user_rendering(id, kRanderFxGlowShell, 450,0,450,0,kRenderNormal, 25)     client_print(0,print_chat,"[CHAMP] %s has called Random Glow on %i.")         new nameArg[32]     read_argv(1 , nameArg , 31)         new target = cmd_target(id , nameArg , FLAGS);     set_user_rendering(target,450,0,450,0)     } public  cmdsetspeed(id) {     if(!cmd_access(id,level,cid,2)) {         return PLUGIN_HANDLED     }         set_user_rendering(id, kRenderFxGlowShell, 450,0,450,0,kRenderNormal, 25)     set_user_maxspeed(id,get_user_maxspeed(id) +//What would I put here for any numbers?     client_print(0,print_chat,"[CHAMP] %s has gave %i a speed change.")         return PLUGIN_HANDLED }
Drak is offline
Send a message via MSN to Drak
Phantom Warrior
BANNED
Join Date: Feb 2007
Location: hello, gaben
Old 02-05-2007 , 20:21   Re: Code look-over
Reply With Quote #3

I shall get better,

PS: Thanks.
Phantom Warrior 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 00:39.


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