how to snprintf (new line)

astralprojection

New member
Messages
334
Points
0
snprintf(atcmd_output, CHAT_SIZE_MAX, "Price: %u | Amount: %d | Map: %s (%d,%d) | Shop: %s <how to show the next data in newline?> +%d %d[%d][%d][%d][%d]"
,pl_sd->vending[j].value
,pl_sd->vending[j].amount
,map->list[pl_sd->bl.m].name
,pl_sd->bl.x,pl_sd->bl.y
,pl_sd->message
,pl_sd->status.cart[pl_sd->vending[j].index].refine
,pl_sd->status.cart[pl_sd->vending[j].index].nameid
,pl_sd->status.cart[pl_sd->vending[j].index].card[0]
,pl_sd->status.cart[pl_sd->vending[j].index].card[1]
,pl_sd->status.cart[pl_sd->vending[j].index].card[2]
,pl_sd->status.cart[pl_sd->vending[j].index].card[3]);


I tried to put \n but it keeps displaying in same line.  

 
I hope you are not asking dump question

Code:
safesnprintf(atcmd_output, CHAT_SIZE_MAX, "Price: %u | Amount: %d | Map: %s (%d,%d)",
	    pl_sd->vending[j].value,
	    pl_sd->vending[j].amount,
	    map->list[pl_sd->bl.m].name,
	    pl_sd->bl.x, pl_sd->bl.y);
clif->message(fd, atcmd_output);
safesnprintf(atcmd_output, CHAT_SIZE_MAX, "Shop: %s +%d %d[%d][%d][%d][%d]",
	    pl_sd->message,
	    pl_sd->status.cart[pl_sd->vending[j].index].refine,
	    pl_sd->status.cart[pl_sd->vending[j].index].nameid,
	    pl_sd->status.cart[pl_sd->vending[j].index].card[0],
	    pl_sd->status.cart[pl_sd->vending[j].index].card[1],
	    pl_sd->status.cart[pl_sd->vending[j].index].card[2],
	    pl_sd->status.cart[pl_sd->vending[j].index].card[3]);
clif->message(fd, atcmd_output);

 
Last edited by a moderator:
I hope you are not asking dump question

Code:
safesnprintf(atcmd_output, CHAT_SIZE_MAX, "Price: %u | Amount: %d | Map: %s (%d,%d)",
	    pl_sd->vending[j].value,
	    pl_sd->vending[j].amount,
	    map->list[pl_sd->bl.m].name,
	    pl_sd->bl.x, pl_sd->bl.y);
clif->message(fd, atcmd_output);
safesnprintf(atcmd_output, CHAT_SIZE_MAX, "Shop: %s +%d %d[%d][%d][%d][%d]",
	    pl_sd->message,
	    pl_sd->status.cart[pl_sd->vending[j].index].refine,
	    pl_sd->status.cart[pl_sd->vending[j].index].nameid,
	    pl_sd->status.cart[pl_sd->vending[j].index].card[0],
	    pl_sd->status.cart[pl_sd->vending[j].index].card[1],
	    pl_sd->status.cart[pl_sd->vending[j].index].card[2],
	    pl_sd->status.cart[pl_sd->vending[j].index].card[3]);
clif->message(fd, atcmd_output);
It did good as expected.  Thank you @AnnieRuru

 
Back
Top