Add color and \n on SSCANF
#1

Hello guys, i've made this code:

Код:
CMD:dp(playerid, params[])
{
new testo[128];
if(sscanf(params, "s[128]", testo)) return SendClientMessage(playerid, BIANCO, "/dp [testo]");
for(new i = 0; i < sizeof(DP_Info); i++)
{
//DP_Info[MAX_DP][dpInfo]
if(DP_Info[i][dpCreated] == 0)
{
new Float:ggX, Float:ggY, Float:ggZ;
GetPlayerPos(playerid, ggX, ggY, ggZ);
DP_Info[i][dpCreated] = 1;
DP_Info[i][dpX] = ggX;
DP_Info[i][dpY] = ggY;
DP_Info[i][dpZ] = ggZ;
DP_Info[i][dpText] = CreateDynamic3DTextLabel(testo,0xFF0000FF,DP_Info[i][dpX],DP_Info[i][dpY],DP_Info[i][dpZ],20.0);
return 1;
}
}
return 1;
}
But i wanna try can write on "TESTO" the \n for go on another line and {COLOR} for apply a Color, who can help me?

Thanks all.
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
Why are you using sscanf for a single string in the first place? "params" already IS a string.
I've always use sscanf for single string, but i need place a \n in TESTO and a color with {CODECOLOR}. I can't make that?
Reply
#3

I've watch a strcat, with that who can make?
I need make a {COLOR} example {#FFFFFF} or {WHITE} and for go back on the line | or \n, who i can make that with this formats you send me?
Reply
#4

Solved!

Код:
CMD:dp(playerid, params[])
{
if(Giocatore[playerid][Polizia] == 1 || Giocatore[playerid][Governo] == 1 || Giocatore[playerid][FBI] == 1)
{
new testo[128];
if(sscanf(params, "s[128]", testo)) return SendClientMessage(playerid, BIANCO, "/dp [testo]");
format(testo, sizeof(testo), "%s", str_replace("#rosso", "{FF2626}", testo));
format(testo, sizeof(testo), "%s", str_replace("#ROSSO", "{FF2626}", testo));
format(testo, sizeof(testo), "%s", str_replace("#Rosso", "{FF2626}", testo));
format(testo, sizeof(testo), "%s", str_replace("|", "\n", testo));
for(new i = 0; i < sizeof(DP_Info); i++)
{
//DP_Info[MAX_DP][dpInfo]
if(DP_Info[i][dpCreated] == 0)
{
new Float:ggX, Float:ggY, Float:ggZ;
GetPlayerPos(playerid, ggX, ggY, ggZ);
DP_Info[i][dpCreated] = 1;
DP_Info[i][dpX] = ggX;
DP_Info[i][dpY] = ggY;
DP_Info[i][dpZ] = ggZ;
DP_Info[i][dpText] = CreateDynamic3DTextLabel(testo,0xFFFFFFFF,DP_Info[i][dpX],DP_Info[i][dpY],DP_Info[i][dpZ],20.0);
return 1;
}
}
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)