Raised This Month: $32 Target: $400
 8% 

Make script better. "Just Joined"


Post New Thread Reply   
 
Thread Tools Display Modes
xOscar
BANNED
Join Date: Nov 2012
Old 11-23-2012 , 12:59   Re: Make script better. "Just Joined"
Reply With Quote #21

Quote:
Originally Posted by Magnificent View Post
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.
Will that optimize?
xOscar is offline
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 11-23-2012 , 13:00   Re: Make script better. "Just Joined"
Reply With Quote #22

And please explain why making like this isn't the simpliest way to do it:

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

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

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

public client_putinserver(id) 
{ 
    server_print("] Name: %s [%s]^n] SteamID: %s^n] IP: %s", get_user_name(id), is_user_admin(id) ? "ADMIN" : "USER", get_user_authid(id), get_user_ip(id)); 
}
EDUTz is offline
Magnificent
BANNED
Join Date: Oct 2012
Old 11-23-2012 , 13:04   Re: Make script better. "Just Joined"
Reply With Quote #23

If you dont know anything about scripting,
please dont spam this thread..

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

Please.. If you want to change something in future, it's better with more rows to edit..
xOscar is offline
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 11-23-2012 , 13:11   Re: Make script better. "Just Joined"
Reply With Quote #25

I just gave an example, never tryed to compile it, although i've seen my mistakes ...
humble appologises.

I tought it's a lot cleaner if you compress it.
EDUTz is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 11-23-2012 , 13:11   Re: Make script better. "Just Joined"
Reply With Quote #26

new szInfo[4][32] -> new szInfo[3][32]

But doing this is the same than to have 3 arrays, it's just less understandable.

Btw, charsmax( ) is better than write directly the array size.

No more to say.
__________________
micapat is offline
xOscar
BANNED
Join Date: Nov 2012
Old 11-23-2012 , 13:20   Re: Make script better. "Just Joined"
Reply With Quote #27

Okay, I chould only use 1 array for Name, SteamID etc?
xOscar is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-23-2012 , 13:47   Re: Make script better. "Just Joined"
Reply With Quote #28

You could, but there is no advantage to it. There are 2 disadvantages that I can think of though, readability and unneeded memory allocation (ie, creating an array that is larger than the maximum you will use)
__________________
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 , 13:50   Re: Make script better. "Just Joined"
Reply With Quote #29

Quote:
Originally Posted by YamiKaitou View Post
You could, but there is no advantage to it. There are 2 disadvantages that I can think of though, readability and unneeded memory allocation (ie, creating an array that is larger than the maximum you will use)
Ok, didn't think about that every cell will be 32 long.
xOscar is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 11-23-2012 , 17:22   Re: Make script better. "Just Joined"
Reply With Quote #30

Quote:
Originally Posted by Magnificent View Post
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.
This is the right answer to your question
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS 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 17:23.


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