pawn Код:
stock
SendFormattedMessage(playerid,color,msg[],{Float,_}:...)
{
if(!(IsPlayerConnected(playerid))) return 0;
if(!(msg[0]) || (msg[0] == 1) && (msg[1] == 0)) return 0;
else
{
new
pos,
delim = ' ',
num = numargs(),
start = 3,
strr[128]
;
strmid(strr,msg,0,128);
while((pos = strfind(strr,"%",true)) != -1)
{
if(start > num) break;
new
chars,
count = pos+1,
changed_str[128]
;
while((chars = strr[count]) && chars != delim)
{
switch(chars)
{
case 'd','D': // integer
{
new
value = getarg(start,0)
;
strdel(strr,pos,pos+2);
format(changed_str,sizeof(changed_str),"%d",value);
strins(strr,changed_str,pos,128);
start++;
break;
}
case 's','S':
{
new
index,
test
;
for( ; ; )
{
test = getarg(start,index);
if(test == 0) break;
changed_str[index] = test;
index++;
}
strdel(strr,pos,pos+2);
strins(strr,changed_str,pos,128);
start++;
break;
}
case 'f','F':
{
new
value = getarg(start,0)
;
strdel(strr,pos,pos+2);
format(changed_str,sizeof(changed_str),"%0.3f",value);
strins(strr,changed_str,pos,128);
start++;
break;
}
default: // nalezen neznбmэ charakter
{
strdel(strr,pos,pos+2);
break;
}
}
}
}
SendClientMessage(playerid,color,strr);
}
return 1;
}
stock
SendFormattedMessageToAll(color,msg[],{Float,_}:...)
{
if(!(msg[0]) || (msg[0] == 1) && (msg[1] == 0)) return 0;
else
{
new
pos,
delim = ' ',
num = numargs(),
start = 2,
strr[128]
;
strmid(strr,msg,0,128);
while((pos = strfind(strr,"%",true)) != -1)
{
if(start > num) break;
new
chars,
count = pos+1,
changed_str[128]
;
while((chars = strr[count]) && chars != delim)
{
switch(chars)
{
case 'd','D': // integer
{
new
value = getarg(start,0)
;
strdel(strr,pos,pos+2);
format(changed_str,sizeof(changed_str),"%d",value);
strins(strr,changed_str,pos,128);
start++;
break;
}
case 's','S':
{
new
index,
test
;
for( ; ; )
{
test = getarg(start,index);
if(test == 0) break;
changed_str[index] = test;
index++;
}
strdel(strr,pos,pos+2);
strins(strr,changed_str,pos,128);
start++;
break;
}
case 'f','F':
{
new
value = getarg(start,0)
;
strdel(strr,pos,pos+2);
format(changed_str,sizeof(changed_str),"%0.3f",value);
strins(strr,changed_str,pos,128);
start++;
break;
}
default: // nalezen neznбmэ charakter
{
strdel(strr,pos,pos+2);
break;
}
}
}
}
SendClientMessageToAll(color,strr);
}
return 1;
}