Raised This Month: $ Target: $400
 0% 

[HL] How to write a plugin that will...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nakash
Member
Join Date: Jan 2009
Old 02-08-2010 , 12:58   [HL] How to write a plugin that will...
Reply With Quote #1

I need a plugin that when I type !rr it will restart the server [sv_restart 1]
and when I type !slay PARTOFNAME/NAME it will kill the player. I think I can do the rest.
[I know that I need to use Handle_Say]

Last edited by nakash; 02-08-2010 at 14:54.
nakash is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 02-09-2010 , 07:00   Re: [HL] How to write a plugin that will...
Reply With Quote #2

restart thing
Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say !rr", "restart")
}

public restart()
{
    server_cmd("sv_restart 1")
}
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-09-2010 , 07:04   Re: [HL] How to write a plugin that will...
Reply With Quote #3

You say it's for HL, but sv_restart doesn't exist for HL. Oo
__________________
Arkshine is offline
nakash
Member
Join Date: Jan 2009
Old 02-09-2010 , 07:36   Re: [HL] How to write a plugin that will...
Reply With Quote #4

Quote:
Originally Posted by Arkshine View Post
You say it's for HL, but sv_restart doesn't exist for HL. Oo
eh hehe,I didn't know.
I needed this for counter strike 1.6 [It's based on HL]
thank you for giving me the code !!

How to make the !slay? I don't know how to get a players name.

Last edited by nakash; 02-09-2010 at 07:38.
nakash is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 02-09-2010 , 08:49   Re: [HL] How to write a plugin that will...
Reply With Quote #5

PHP Code:
new szName[33];
get_user_name(idszName32);
new 
iPlayer find_player("b"szName);
slay(iPlayer); 
should work
__________________
minimiller is offline
Send a message via MSN to minimiller
nakash
Member
Join Date: Jan 2009
Old 02-09-2010 , 10:05   Re: [HL] How to write a plugin that will...
Reply With Quote #6

Quote:
Originally Posted by minimiller View Post
PHP Code:
new szName[33];
get_user_name(idszName32);
new 
iPlayer find_player("b"szName);
slay(iPlayer); 
should work
It gives me an error: undefinded symbol "slay".

another problem that I have is when someone types !rr it prints the name of the server and not the player who wrote !rr,is there a way to fix that?
PHP Code:
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Restart
    
register_clcmd("say !rr""cmdrr")
}

public  
cmdrr(pid,level,id,cid)
{
    if(!
cmd_access (pid,level,cid,1)) return PLUGIN_HANDLED
    
new szName33 ];
    
get_user_namecid szName charsmaxszName ) );
    
client_print(0,print_chat,"%s has restarted the round.",szName)
    
server_cmd("sv_restart 1")
    return 
0;

nakash is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 02-09-2010 , 11:00   Re: [HL] How to write a plugin that will...
Reply With Quote #7

there isnt a slay function, that should of been commented just to show where to slay the player

and with your 2nd problem, change "get_user_name(cid, name, 32)" to "get_user_name(pid, name, 32)"
__________________
minimiller is offline
Send a message via MSN to minimiller
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 02-09-2010 , 14:45   Re: [HL] How to write a plugin that will...
Reply With Quote #8

Quote:
Originally Posted by minimiller View Post
PHP Code:
new szName[33];
get_user_name(idszName32);
new 
iPlayer find_player("b"szName);
slay(iPlayer); 
should work
PHP Code:
slay(iPlayer
To
PHP Code:
user_kill(iPlayer
Mxnn is offline
AfteR.
Veteran Member
Join Date: Dec 2008
Location: λ
Old 02-09-2010 , 20:04   Re: [HL] How to write a plugin that will...
Reply With Quote #9

Quote:
Originally Posted by nakash View Post
It gives me an error: undefinded symbol "slay".

another problem that I have is when someone types !rr it prints the name of the server and not the player who wrote !rr,is there a way to fix that?
PHP Code:
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Restart
    
register_clcmd("say !rr""cmdrr")
}

public  
cmdrr(pid,level,id,cid)
{
    if(!
cmd_access (pid,level,cid,1)) return PLUGIN_HANDLED
    
new szName33 ];
    
get_user_namecid szName charsmaxszName ) );
    
client_print(0,print_chat,"%s has restarted the round.",szName)
    
server_cmd("sv_restart 1")
    return 
0;


PHP Code:
#include <amxmodx>

#define PLUGIN "Restart in chat"
#define VERSION "1.0"
#define AUTHOR "AfteR ;)"

const FLAG ADMIN_CHAT

public plugin_init( ) 
{
    
register_pluginPLUGIN VERSION AUTHOR )
    
register_clcmd"say !rr" "rr" )
}

public 
rrid )
{
    if (
get_user_flagsid ) & FLAG)
    {
        new 
name[32]
        
get_user_nameid name charsmax(name) )
        
server_cmd"sv_restart 1" )
        
client_printprint_chat "%s has restarted the round"name )
    }


Last edited by AfteR.; 02-09-2010 at 20:37.
AfteR. is offline
nakash
Member
Join Date: Jan 2009
Old 02-10-2010 , 07:20   Re: [HL] How to write a plugin that will...
Reply With Quote #10

Thank you! works perfectly.
I still need the slay thing,can somebody help me?
nakash 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 07:16.


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