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

Make script better. "Just Joined"


Post New Thread Reply   
 
Thread Tools Display Modes
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 11-23-2012 , 10:49   Re: Make script better. "Just Joined"
Reply With Quote #11

Quote:
Originally Posted by pokemonmaster View Post
Totally wrong.
The first one was the best
I must agree if you say so, but why isn't better ?
EDUTz is offline
xClient
BANNED
Join Date: Nov 2012
Old 11-23-2012 , 10:52   Re: Make script better. "Just Joined"
Reply With Quote #12

Is this script better? (See charsmax & szSteamID)

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[16];
    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 - SteamID: %s - IP: %s ^n] [%s]"szNameszSteamIDszIpszStatus);


Last edited by xClient; 11-23-2012 at 10:53.
xClient is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-23-2012 , 10:56   Re: Make script better. "Just Joined"
Reply With Quote #13

Quote:
Originally Posted by xClient View Post
szSteamID[32]; -> szSteamID[8]; then?
No, 32 is fine. You could use 20, but if the IDs ever get longer than 8 digits, your script will break.
__________________
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 , 11:01   Re: Make script better. "Just Joined"
Reply With Quote #14

Quote:
Originally Posted by YamiKaitou View Post
No, 32 is fine. You could use 20, but if the IDs ever get longer than 8 digits, your script will break.
Okay, so like "32" isn't related to MaxPlayers? Good.

How is the charsmax?

Last edited by xClient; 11-23-2012 at 11:01.
xClient is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-23-2012 , 11:08   Re: Make script better. "Just Joined"
Reply With Quote #15

Quote:
Originally Posted by xClient View Post
Okay, so like "32" isn't related to MaxPlayers? Good.
In a 1D array for a String, no it is the string length.

Quote:
How is the charsmax?
Huh?



Also, 16 is too short, your script won't like anyone with more than a 4 digit SteamID
__________________
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 , 11:14   Re: Make script better. "Just Joined"
Reply With Quote #16

PHP Code:
    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"); 
I did write charsmax instead of like "31"
xClient is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-23-2012 , 11:18   Re: Make script better. "Just Joined"
Reply With Quote #17

There is not a performance gain by doing that, it just makes it easier if you ever decide to change the length of the array.
__________________
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
xOscar
BANNED
Join Date: Nov 2012
Old 11-23-2012 , 12:07   Re: Make script better. "Just Joined"
Reply With Quote #18

Quote:
Originally Posted by YamiKaitou View Post
There is not a performance gain by doing that, it just makes it easier if you ever decide to change the length of the array.
Yeah.
xOscar is offline
xOscar
BANNED
Join Date: Nov 2012
Old 11-23-2012 , 12:47   Re: Make script better. "Just Joined"
Reply With Quote #19

Quote:
Originally Posted by xOscar View Post
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.
xOscar is offline
Magnificent
BANNED
Join Date: Oct 2012
Old 11-23-2012 , 12:50   Re: Make script better. "Just Joined"
Reply With Quote #20

Why u guys making a formatex? -_-

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 
szInfo[4][32]
    
get_user_name(idszInfo[0], 31)
    
get_user_authid(idszInfo[1], 31)
    
get_user_ip(idszInfo[2], 311)
    
    
server_print("] Name: %s [%s]^n] SteamID: %s^n] IP: %s"szInfo[0], is_user_admin(id) ? "ADMIN" "USER"szInfo[1], szInfo[2]);

Beat that newbies.
Magnificent 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 00:49.


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