05.03.2013, 18:10
I made a /me /do
and etc.. commands which checks if the string length is more than 90, if it does so there will be two lines of text.
Is there any way to use a stock for this so I won't have to use all these IF and strmid function again.
and etc.. commands which checks if the string length is more than 90, if it does so there will be two lines of text.
Is there any way to use a stock for this so I won't have to use all these IF and strmid function again.
pawn Код:
CMD:me(playerid, params[])
{
new string[128],action[128], act[128], act2[128];
if(sscanf(params, "s[128]", action)) return SyntaxMSG(playerid, "/me [action]");
if(strlen(action) > 90)
{
strmid(act, action, 0, 90);
strmid(act2, action, 90, 128);
format(string, sizeof(string), "* %s %s...", GetNameWithMask(playerid), act);
ProxDetector(30, playerid, string, COLOR_PURPLE);
format(string, sizeof(string), "...%s", act2);
ProxDetector(30, playerid, string, COLOR_PURPLE);
}
else
{
format(string, sizeof(string), "* %s %s", GetNameWithMask(playerid), action);
ProxDetector(30, playerid, string, COLOR_PURPLE);
}
return 1;
}
CMD:do(playerid, params[])
{
new string[128],action[128], act[128], act2[128];
if(sscanf(params,"s[128]",action)) return SyntaxMSG(playerid, "/do [action]");
if(strlen(action) > 90)
{
strmid(act, action, 0, 90);
strmid(act2, action, 90, 128);
format(string, sizeof(string), "* %s...", act);
ProxDetector(30, playerid, string, COLOR_PURPLE);
format(string, sizeof(string), "...%s ((%s))", act2, GetNameWithMask(playerid));
ProxDetector(30, playerid, string, COLOR_PURPLE);
}
else
{
format(string,sizeof(string),"* %s ((%s))",action, GetNameWithMask(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE);
}
return 1;
}