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

Perform command on player join


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lucius
Senior Member
Join Date: Aug 2007
Location: Netherlands
Old 12-24-2008 , 11:51   Perform command on player join
Reply With Quote #1

EDIT: Changed my request


Thanks for the response!

I want to make it that I can ban a player who is not in the server, without knowing his SteamID.
I would like to use a text file, because then I can make a PHP-script for my website that bans players, and PHP-scripts can't execute an in-server command of course .

For example: It is reported on the website that PowerToDavid cheated three days ago. The site then puts the following line in the text file:

Code:
PowerToDavid amx_ban PowerToDavid 60 "You cheated three days ago!"
Now the plugins job: when PowerToDavid joins, the command gets executed and he is banned. The line then gets removed from the textfile, so that after the ban PowerToDavid can join again without getting banned another time.

Do you see?
__________________
"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all be running around in dark rooms, munching pills and listening to repetitive electronic music." Marcus Brigstock

Last edited by lucius; 01-05-2009 at 15:21.
lucius is offline
Send a message via MSN to lucius
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 12-24-2008 , 14:25   Re: Perform command on player join
Reply With Quote #2

I hope you'll get an idea what I've writen.
Code:
#include <amxmodx>   public plugin_init()         register_plugin("Welcome Message", "1.0", "hleV");   public client_putinserver(id) {         new szName[32];         get_user_name(id, szName, sizeof(szName) - 1);           switch (szName)         {                 case 'Steve': client_print(id, print_chat, "Hi steve");                 case 'Marge': server_cmd("amx_kick Steve");                 case 'David': client_print(id, print_chat, "Don't forget to take out the laundry");         } }
__________________
hleV is offline
lucius
Senior Member
Join Date: Aug 2007
Location: Netherlands
Old 12-24-2008 , 14:29   Re: Perform command on player join
Reply With Quote #3

Yeah I understand, thank you.
What if someones name is ~!##steve**!~, I don't suppose I could just let the case be 'Steve'?
__________________
"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all be running around in dark rooms, munching pills and listening to repetitive electronic music." Marcus Brigstock
lucius is offline
Send a message via MSN to lucius
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-24-2008 , 14:50   Re: Perform command on player join
Reply With Quote #4

@hleV
You cannot use a switch statement like that.

Code:
public client_putinserver(client) {     static name[32];     get_user_name(client, name, sizeof(name) - 1);         if( containi(name, "steve") != -1 )     {         client_print(client, print_chat, "Hi steve");     }     else if( containi(name, "marge") != -1 )     {         server_cmd("amx_kick steve");     }     else if( containi(name, "david") != -1 )     {         client_print(client, print_chat, "Don't forget to take out the laundry!");     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 12-24-2008 , 18:07   Re: Perform command on player join
Reply With Quote #5

Or, if you don't mind taking risks:
Code:
switch( szName[ 0 ] ) {       case 'S': client_print( id, print_chat, "Hi Steve" );       case 'M': server_cmd( "amx_kick Steve" );       case 'D': client_print( id, print_chat, "Your name is David (or at least starts with a ^"D^"" ); }
;-)
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
lucius
Senior Member
Join Date: Aug 2007
Location: Netherlands
Old 01-04-2009 , 14:12   Re: Perform command on player join
Reply With Quote #6

Thanks a lot. There is just one more thing I need:
Can anyone make it that when it player joins it reads the command to be performed out of a textfile?

So example textfile:
David amx_ban David 5
Margret amx_ban Margret 10
Pete amx_ban Pete 1090

And then when David joins, the server command "amx_ban David 5" gets executed?
(and that specific line in the file gets deleted, so the command doesn't get executed a second time)
__________________
"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all be running around in dark rooms, munching pills and listening to repetitive electronic music." Marcus Brigstock

Last edited by lucius; 01-04-2009 at 14:26.
lucius is offline
Send a message via MSN to lucius
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-04-2009 , 15:16   Re: Perform command on player join
Reply With Quote #7

If you want to ban players, just search the forums for ban plugins.
If you just gave an example, I'll make it.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
lucius
Senior Member
Join Date: Aug 2007
Location: Netherlands
Old 01-04-2009 , 15:26   Re: Perform command on player join
Reply With Quote #8

Thanks for the response!

I want to make it that I can ban a player who is not in the server, without knowing his SteamID.
I would like to use a text file, because then I can make a PHP-script for my website that bans players, and PHP-scripts can't execute an in-server command of course .

For example: It is reported on the website that PowerToDavid cheated three days ago. The site then puts the following line in the text file:

Code:
PowerToDavid amx_ban PowerToDavid 60 "You cheated three days ago!"
Now the plugins job: when PowerToDavid joins, the command gets executed and he is banned. The line then gets removed from the textfile, so that after the ban PowerToDavid can join again without getting banned another time.

Do you see?
__________________
"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all be running around in dark rooms, munching pills and listening to repetitive electronic music." Marcus Brigstock

Last edited by lucius; 01-04-2009 at 15:34.
lucius is offline
Send a message via MSN to lucius
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-04-2009 , 16:17   Re: Perform command on player join
Reply With Quote #9

Can't the PHP-Scripts save his steam id to make sure it's the same person who cheated?
The name can be changed easily, and you might find yourself banning people that never been in your server.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
lucius
Senior Member
Join Date: Aug 2007
Location: Netherlands
Old 01-04-2009 , 17:24   Re: Perform command on player join
Reply With Quote #10

Yes, the script could, but the website has no knowledge of SteamID's. Only the name reported to the website is known.
__________________
"Computer games don't affect kids, I mean if Pac Man affected us as kids, we'd all be running around in dark rooms, munching pills and listening to repetitive electronic music." Marcus Brigstock
lucius is offline
Send a message via MSN to lucius
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:15.


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