Raised This Month: $ Target: $400
 0% 

how to insert a carriage return ? (believe me i tried)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
djh
Member
Join Date: Nov 2004
Old 05-26-2005 , 17:24   how to insert a carriage return ? (believe me i tried)
Reply With Quote #1

i took W@lker's plugin amx_showip.sma and modified it a bit
here is the source in it's present state :
Code:
/* AMX Mod script.
*
* (c) Copyright 2002, W@lker /Yakutsk,Russia/
* This file is provided as is (no warranties).
*
*/

#include <amxmod>

// file to read descriptions from 
new ipdesc[32] = "addons/amxmodx/data/ipdesc.ini" 


public amx_showip(id){
new userip[16]
new name[64]
new players[32],inum
new buffor[3000]
new header[50]
new temp[150]

new arg[1]
new team

read_args(arg,1)
team=strtonum(arg)

switch(team){
case 1: {
header="IP List - Terrorists Forces"
get_players(players,inum,"e","TERRORIST")
}
case 2: {
header="IP List - CT Forces"
get_players(players,inum,"e","CT")
}
default:{
header="IP List ^n"
get_players(players,inum)
}
	}
//
client_print(id,print_console,"%s",header)

format(buffor,100,"%-25.24s %-16.15s %s","Name","IP","^nDescription _____________ ^n")


for(new i = 0; i < inum; ++i) {
    temp=""	
    get_user_ip(players[i],userip,16,1) 
    get_user_name(players[i],name,64) 
    if (strlen(name)>20) {
		copy(name,17,name)  	
    		add(name,64,"...")
			}	
    new IPD[32]
    findip(userip,IPD)   
    format(temp,250,"%-25.24s %-16.15s %s",name,userip,IPD)
    add(buffor,3000,temp)	
    client_print(id,print_console,"%-32.31s %-16.15s %s",name,userip,IPD,)
}
show_motd(id,buffor,header)
return PLUGIN_CONTINUE
}

public getdesc(sip[16],sdesc[32]){
if (file_exists(ipdesc)) 
	{
new data[128]
new stextsize = 0
new line = 0
new ip[16]
new desc[32]
while((line=read_file(ipdesc,line,data,192,stextsize))!=0) 
		{ /*while*/
if (contain(data,"//") == -1)   {/*skip comments*/
parse(data,ip,16,desc,32)
if (equal(sip,ip)) {
sdesc=desc
return 1
		    }
				} /*skip comments*/
		} /*while*/
	} else log_message("IP Descriptions file not found!")  
sdesc=""
return 0
}

public findip(sip[16],sdesc[32]){
new ipsubnet[16]
new RValue=0
new uip[16]
new ippart1[12]
new ippart2[12]
new ippart3[12]
new ippart4[12]

/*Calculating subnet*/
copy(uip, 16, sip) 
while(replace(uip, 16, ".", " ")){}
parse(uip, ippart1,12,ippart2,12,ippart3,12,ippart4,12) 
ipsubnet=""
add(ipsubnet,16,ippart1)
add(ipsubnet,16,".")
add(ipsubnet,16,ippart2)
add(ipsubnet,16,".")
add(ipsubnet,16,ippart3)
/*Calculating subnet*/

RValue = getdesc(sip , sdesc);
if (RValue==0) RValue = getdesc(ipsubnet , sdesc)
return RValue
}

public client_connect(id){
new userip[16]
new name[32]
new IPD[32]
get_user_ip(id,userip,16,1) 
get_user_name(id,name,32)
findip(userip, IPD)
//********** modified by me here
server_cmd("say [AMXX] %s [%s] makes a wish",name,userip,IPD)
//client_print(0,print_chat,"[AMXX] %s (%s,%s) is persistant ",name,userip,IPD);
return PLUGIN_CONTINUE
}  


public plugin_init() {
	register_plugin("Show IP","0.8","W@lker's Showip")
	register_clcmd("amx_showip","amx_showip")
	return PLUGIN_CONTINUE
}
what's the problem ? well it displays the info right... but all on one line and that's hard to follow... in the console after typing amx_showip u get the user's name and his ip, and then another user, and his ip... and so and so on .. i would like it to do it each on one line. i tried ^n, \n but it does not work..
and as a second objective once you quit the console it gives a menu similar to /top15's but the background is white and the font is lame... ahrm like some unformatted html test page; also it's all in one line and hard to follow.
i would like it black background with a nice formatted font and text, just like /top15 has..
and another issue (oh boy) when someone "Master of ducks and goats and chickens and pigeons and whatever exagerated long name" joins,
the output to the players is somthin like
Code:
[AMXX] Master of ducks and goats and chickens and pigeons and whatever exagerated long name (255.255.255.255) is
what i want to say is that the "is trying to connect" or in my case "is persistant" text doesn't fit in the string length.. i'm not so common with the syntax here so if u could help out a bit thanks.
thanks in advance, and thanks for reading
djh is offline
WaZZeR++
Veteran Member
Join Date: Mar 2005
Location: Sweden
Old 05-26-2005 , 17:49  
Reply With Quote #2

you have 2 %s and 3 inputs, need one more %s
Code:
server_cmd("say [AMXX] %s [%s] makes a wish",name,userip,IPD)

PS. Next time, plz use small tag...
WaZZeR++ is offline
Send a message via MSN to WaZZeR++
djh
Member
Join Date: Nov 2004
Old 05-27-2005 , 12:52  
Reply With Quote #3

how is this helping me ?
djh 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 16:39.


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