Raised This Month: $ Target: $400
 0% 

Scout Sniper Only


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 11-15-2007 , 00:38   Re: Scout Sniper Only
Reply With Quote #1

Semicolons are optional - but it looks good, as it denontes the end of a statement

As for your code, you can make it as simple as this.

PHP Code:
#include <amxmodx>

public plugin_init() 
{
    
register_plugin("Scout Sniper Only""1.0""sharpe.nl")
    
register_clcmd("awp""cmd_scout")
    
register_clcmd("sg550""cmd_scout")
    
register_clcmd("g3sg1""cmd_scout")


public 
cmd_scout(id
{
    
client_cmd(id"scout")
    return 
PLUGIN_HANDLED

Because all the other rifles point to the same code, you can make it execute 1 procedure, instead of 3 identical ones
__________________

Last edited by M249-M4A1; 11-15-2007 at 00:41.
M249-M4A1 is offline
Maurice
Senior Member
Join Date: Nov 2006
Location: Netherlands
Old 11-15-2007 , 01:11   Re: Scout Sniper Only
Reply With Quote #2

Thanks for the help M249-M4A1! If i would change the given gun on a later time would the below code be correct to?

Code:
#include <amxmodx>

public plugin_init()  
{
    register_plugin("Scout Sniper Only", "1.0", "sharpe.nl")
    register_clcmd("awp", "cmd_scout")
    register_clcmd("sg550", "cmd_sg550")
    register_clcmd("g3sg1", "cmd_g3sg1")
}  

public cmd_scout(id)  
{
    client_cmd(id, "scout")
    return PLUGIN_HANDLED
}

public cmd_sg550(id)  
{
    client_cmd(id, "tmp")
    return PLUGIN_HANDLED
}  

public cmd_g3sg1(id)  
{
    client_cmd(id, "mac10")
    return PLUGIN_HANDLED
}
__________________
Luck? Luck is only one feeling of amazement concerning a seemingly incidental circumstance which one himself must create.

Last edited by Maurice; 11-15-2007 at 01:17.
Maurice is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-15-2007 , 05:57   Re: Scout Sniper Only
Reply With Quote #3

Have a look at this plugin : http://forums.alliedmods.net/showthread.php?p=18295
ConnorMcLeod is offline
Maurice
Senior Member
Join Date: Nov 2006
Location: Netherlands
Old 11-15-2007 , 08:43   Re: Scout Sniper Only
Reply With Quote #4

Thanks for the idea connorr but honestly said the script code what i writed wasn't meant to change all snipers in scout's. I used that only as test and want to change commands like cl_rebuy, rebuy and some others. I know there is also a nice command restricter plugin from SubStream but i preffer i small simply plugin and that i can give any command a new function. Can anybody confirm if the 2nd script code is correct?
__________________
Luck? Luck is only one feeling of amazement concerning a seemingly incidental circumstance which one himself must create.
Maurice 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 01:19.


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