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

Amx Short Commands Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Crushe-R
Junior Member
Join Date: Jun 2006
Location: Romania
Old 09-13-2006 , 09:14   Amx Short Commands Plugin
Reply With Quote #1

hello ppl! I'm a biginner and i wanna learn scripting.
First, i have an ideea, that's all i have for the moment ;(
I Want To Make A Plugin Named amx_sc ( amx short commands )
Description: when an admin want's to slay smbdy, he dosen't have to activate the console, he type with say /slay Player name and the player get slayed.
The problem is that dosen't work.
I tryed something like this:
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <vault>

public plugin_init ()
{
      register_plugin("Short Commands", "1.0", "Crusher")

      register_cvar("sv_sc", "1")

      register_clcmd("say /k %d %", "amx_kick %d %")

      register_clcmd("say /m %", "amx_map %")

      register_clcmd("say /s %d", "amx_slay %d")

      register_clcmd("say /sp %d %", "amx_slap %d %")

      register_clcmd("say /sc %", "amx_rcon sv_sc %")
}
I complied the plugin, i don't get any errors then i put it on server i joined the server and dosen't work, it's says nothing and do nothing.
Please help me. I'm not lame i learn quick.
Thank' you and sorry for my bad english.
__________________
--== Crusher ==--
Crushe-R is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 09-13-2006 , 10:16   Re: Amx Short Commands Plugin
Reply With Quote #2

Okay...
I see there are actually some Tons of Material to learn for you.
You should start downloading a simple Plugins Code and learn from it.
Then compare how you used the register_clcmd Command with
how it is supposed to be used.
I would sit here for some hours if I would tell you everything what you should do.
But I can give you this:
Code:
#include <amxmodx> #include <amxmisc> #include <engine>   public plugin_init() {        register_plugin("Short Commands","1.0","Crusher")        register_concmd("say /slay","fastslay",ADMIN_BAN,"Playername - Slay a Player") } public fastslay(id,level,cid) {        if(!cmd_access(id,ADMIN_BAN,cid,2)) /* If the User does not have Permission to ban Players ... */        {               return PLUGIN_HANDLED /* ... then Stop this Function */        }        new victim[32] /* [32] is the maximum length minus 1 */        read_argv(1,victim,31) /* 1 is Argument-Number, victim the Variable to which the Argument shall be saved, 31 the lenght */        new victim_id=cmd_target(id,victim,3) /* Converts the Players Name to his ID */        user_silentkill(victim_id) /* Kills the Player */        new name[32] /* Will become Victims Name */        get_user_name(victim_id,name,31) /* Name of Player with id victim_id will be written to name with max length of 31 */        client_print(0,print_chat,"[SC] %s has been slayed",name) /* Print a Message - 0 means: Send to everyone - print_chat means: Print Message in chat */        return PLUGIN_HANDLED /* Function Ends here - Remove Variables */ }

Need Karma
__________________
EAT YOUR VEGGIES
Silencer123 is offline
Crushe-R
Junior Member
Join Date: Jun 2006
Location: Romania
Old 09-13-2006 , 10:29   Re: Amx Short Commands Plugin
Reply With Quote #3

Okay. Thank' You Very Much! +karma u
__________________
--== Crusher ==--
Crushe-R is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 09-13-2006 , 13:37   Re: Amx Short Commands Plugin
Reply With Quote #4

No Problem!
__________________
EAT YOUR VEGGIES
Silencer123 is offline
Crushe-R
Junior Member
Join Date: Jun 2006
Location: Romania
Old 09-14-2006 , 07:32   Re: Amx Short Commands Plugin
Reply With Quote #5

man, dosen't work.
I type /slay playername and dosen't do nothing.
but when i type /slay it says: "[SC] "servername" has been slayed"
.. and why can i replace fastslay with amx_slay /
thank' you.
__________________
--== Crusher ==--
Crushe-R is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 09-14-2006 , 16:57   Re: Amx Short Commands Plugin
Reply With Quote #6

maybe /slay is first arg and u need arg id 2 in read_argv.
also add
if(!victim_id)
{
return PLUGIN_HANDLED
}
to stop the server has been slayed bug from appearing
__________________
EAT YOUR VEGGIES
Silencer123 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:31.


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