[Ajuda] SendFormatMsg
#2

eз sefalмt nгo paramitos funзгo szecura neymar:

pawn Код:
stock SendFormatMsg(playerid,color,const msg[],{Float,_}:...)
{
new len = strlen(msg),d=0,posArg = 3;
new dest[512];
for(new i=0;i<len;i++)
{
if(msg[i] == '%')
{
switch (msg[i+1])
{
case 's':
{
new pos,arg,tmppos;
new str[128];
while(getarg(posArg,pos)!='')
{
arg=getarg(posArg,pos++);
str[tmppos]=arg;
tmppos++;
}
strins(dest,str,d,strlen(str));
d+=strlen(str);
posArg++;
i++;
}
case 'i', 'd':
{
new str[128];
format(str,sizeof(str),"%d",getarg(posArg));
strins(dest,str,d,strlen(str));
d+=strlen(str);
posArg++;
i++;
}
case 'f':
{
new str[128];
format(str,sizeof(str),"%f",getarg(posArg));
strins(dest,str,d,strlen(str));
d+=strlen(str);
posArg++;
i++;
}
case '.':
{
new len2 = msg[i+2];
if(len2 == 0)
{
dest[d] = msg[i];
d++;
}
else
{
new str[32],formatting[5];
formatting[0] = '%';
formatting[1] = '.';
formatting[2] = len2;
formatting[3] = 'f';
format(str,sizeof(str),formatting,getarg(posArg));
strins(dest,str,d,len2);
d+=len;
posArg++;
i+= 2;
}
}
default:
{
dest[d] = msg[i];
d++;
}
}
}
else
{
dest[d] = msg[i];
d++;
}
}
return SendClientMessage(playerid,color,dest);
}
Reply


Messages In This Thread
SendFormatMsg - by MatheusAlcapone - 22.04.2013, 23:20
Respuesta: SendFormatMsg - by spell - 22.04.2013, 23:28
Re: SendFormatMsg - by MatheusAlcapone - 22.04.2013, 23:35
Re: SendFormatMsg - by Lуs - 22.04.2013, 23:39
Re: SendFormatMsg - by MatheusAlcapone - 22.04.2013, 23:41

Forum Jump:


Users browsing this thread: 2 Guest(s)