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

Make script better. "Just Joined"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xOscar
BANNED
Join Date: Nov 2012
Old 11-22-2012 , 20:26   Make script better. "Just Joined"
Reply With Quote #1

Hey, I wonder how to make this script even better!
When a player joins, it should print to server console.

PHP Code:
#include < amxmodx >
#include < amxmisc >

#define PLUGIN "justJoined"
#define VERSION "0.1"

public plugin_init() {
    
register_plugin(PLUGINVERSION"Blend");
}

public 
client_putinserver(id) {
    new 
szSteamID[32];
    new 
szName[32];
    new 
szStatus[32];
    
    if (
is_user_admin(id))
        
status "[ADMIN]";
    else
        
status "[USER]";
    
    
get_user_authid(idszSteamIDcharsmax(szSteamID));
    
get_user_name(id,szName,31);
    
server_print("---^n--- Name: %s - SteamID: %s, just joined %s^n---"szNameszSteamIDszStatus);

Updated Code (Compiling without errors)
PHP Code:
#include < amxmodx >
#include < amxmisc >

#define PLUGIN "justJoined"
#define VERSION "0.1"

public plugin_init()
    
register_plugin(PLUGINVERSION"Blend");

public 
client_putinserver(id){
    new 
szName[32];
    new 
szStatus[8];
    new 
szSteamID[22];
    new 
szIp[16];

    
get_user_authid(idszSteamIDcharsmax(szSteamID));
    
get_user_name(idszNamecharsmax(szName));
    
get_user_ip(idszIpcharsmax(szIp), 1);
    
formatex(szStatuscharsmax(szStatus), "%s"is_user_admin(id) ? "ADMIN" "USER");
    
server_print("] Name: %s [%s]^n] SteamID: %s^n] IP: %s"szNameszStatusszSteamIDszIp);

Description: Printing out Player Name, SteamID & IP to the servers console when a player is put in to server.
Also the Access-Status.. ADMIN / USER

Last edited by xOscar; 11-23-2012 at 12:49.
xOscar is offline
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 11-23-2012 , 03:51   Re: Make script better. "Just Joined"
Reply With Quote #2

Maybe like this ?

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

#define PLUGIN "justJoined"
#define VERSION "0.1"

public plugin_init() {
    register_plugin(PLUGIN, VERSION, "Blend");
}

public client_putinserver(id) {
    if (is_user_admin(id))
            server_print("---^n--- Name: %s - SteamID: %s, just joined [ADMIN]^n---", get_user_name(id), get_user_authid(id));
    else
            server_print("---^n--- Name: %s - SteamID: %s, just joined [USER]^n---", get_user_name(id), get_user_authid(id));

}
EDUTz is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 11-23-2012 , 04:32   Re: Make script better. "Just Joined"
Reply With Quote #3

Quote:
Originally Posted by EDUTz View Post
Maybe like this ?

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

#define PLUGIN "justJoined"
#define VERSION "0.1"

public plugin_init() {
    register_plugin(PLUGIN, VERSION, "Blend");
}

public client_putinserver(id) {
    if (is_user_admin(id))
            server_print("---^n--- Name: %s - SteamID: %s, just joined [ADMIN]^n---", get_user_name(id), get_user_authid(id));
    else
            server_print("---^n--- Name: %s - SteamID: %s, just joined [USER]^n---", get_user_name(id), get_user_authid(id));

}
Totally wrong.
The first one was the best
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 11-23-2012 , 05:05   Re: Make script better. "Just Joined"
Reply With Quote #4

Code:
new szStatus[32];         if (is_user_admin(id))         status = "[ADMIN]";     else         status = "[USER]";
->
Code:
new szStatus[8]; //no point in making this array bigger than you will ever use formatex(szStatus, charsmax(szStatus), "%s", is_user_admin(id) ? "[ADMIN]" : "[USER]");

Last edited by jimaway; 11-23-2012 at 05:06.
jimaway is offline
xOscar
BANNED
Join Date: Nov 2012
Old 11-23-2012 , 05:34   Re: Make script better. "Just Joined"
Reply With Quote #5

Thanks for help, I would appreciate more help!

PHP Code:
#include < amxmodx >
#include < amxmisc >

#define PLUGIN "justJoined"
#define VERSION "0.1"

public plugin_init() {
    
register_plugin(PLUGINVERSION"Blend");
}

public 
client_putinserver(id) {
    new 
szSteamID[32];
    new 
szName[32];
    new 
szStatus[8];
    new 
szIp[32];

    
get_user_authid(idszSteamIDcharsmax(szSteamID));
    
get_user_name(id,szName,31);
    
get_user_ip(idszIp311);
    
formatex(szStatuscharsmax(szStatus), "%s"is_user_admin(id) ? "[ADMIN]" "[USER]");
    
server_print("[] Name: %s - SteamID: %s - IP: %s ^n[] %s"szNameszSteamIDszIpszStatus);

xOscar is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 11-23-2012 , 06:04   Re: Make script better. "Just Joined"
Reply With Quote #6

new szIp[32];
->
new szIp[16];

why do you want to create every array with size 32? a ipv4 address cant be over 15 charecters
jimaway is offline
xOscar
BANNED
Join Date: Nov 2012
Old 11-23-2012 , 07:53   Re: Make script better. "Just Joined"
Reply With Quote #7

Quote:
Originally Posted by jimaway View Post
new szIp[32];
->
new szIp[16];

why do you want to create every array with size 32? a ipv4 address cant be over 15 charecters
A habit xD
Well, thanks for your help.

One question, why can't you make every array like 512? ( )

Last edited by xOscar; 11-23-2012 at 08:05.
xOscar is offline
xOscar
BANNED
Join Date: Nov 2012
Old 11-23-2012 , 10:00   Re: Make script better. "Just Joined"
Reply With Quote #8

Why not make szName[32] -> szName[16] ?
xOscar is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-23-2012 , 10:14   Re: Make script better. "Just Joined"
Reply With Quote #9

Because that is the max length of a name
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
xClient
BANNED
Join Date: Nov 2012
Old 11-23-2012 , 10:44   Re: Make script better. "Just Joined"
Reply With Quote #10

Quote:
Originally Posted by YamiKaitou View Post
Because that is the max length of a name
szSteamID[32]; -> szSteamID[8]; then?
xClient 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 10:22.


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