stock SuccessMessage(Player, Message[])
{
new
string[128];
format(string, sizeof(string), "{60BD09}SUCCESS: {FFFFFF}%s", Message);
return SendClientMessage(Player, -1, string);
}
SuccessMessage(playerid, "Sky has %d bananas.", Bananas[playerid]);
format(string, sizeof(string), "Sky has %d bananas.", Bananas[playerid]);
SuccesMessage(playerid, string);
stock SendClientMessageEx(playerid,Message[],...)
{
new str[10],string[128],pos,num=2;
strcat(string,Message);
while((pos = strfind(string,"%d")) != -1)
{
strdel(string,pos,(pos + 2));
valstr(str,getarg(num));
strins(string,str,pos);
num++;
}
SendClientMessage(playerid,-1,string);
return 1;
}
SendClientMessageEx(playerid,"{60BD09}SUCCESS: {FFFFFF}Sky has %d %d %d %d %d %d %d %d bananas.",1,2,3,4,5,6,7,8);
That is the basis of the required code, but only a very basic basis. There are three ways of doing this:
The first is to re-implement the code of format in your function. An example of this can be seen in the old YSI in YSI_format.own. The second is to pass all the variable parameters from your function through to another variable parameters function. This requires playing about with PAWN assembly directly as the compiler doesn't support it. An example of this can be found in the new YSI in y_debug.inc. The last is to wrap your function call up in macro and call format in there. This is by far the easiest method and examples of this can be found in many "SendClientMessageEx" functions in the Useful Functions topic. Any way it is very possible to do and there are plenty of examples for you to look at. Note that this isn't a plug for YSI, it just happens to be a system which I know has the required information off the top of my head. |