Player Textdraw Doesn't show...
#8

Quote:
Originally Posted by SsHady
Посмотреть сообщение
Thanks a lot, it fixed it.

Does anyone know whether there is a way in which like if a player types /blahslkdjasdkasd or any other big wrong command, it only shows some characters of it and change it to like /blahsikl.... and with dots at the end?

[pawn]
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
{
new str[75];
format(str,sizeof(str),"The Command ~y~%s ~w~does not exist, To see all commands use ~y~/cmds",cmdtext);
PlayerTextDrawSetString(playerid,wrongcmd[playerid],str);
PlayerTextDrawShow(playerid,wrongcmd[playerid]);
SetTimerEx("HideWrongTD", 6000, false, "i", playerid);
}
return 1;
}/pawn]
Use strmid if the text is longer than X characters. strmid copies a string, from a given start position to a given end position.

Код:
new str[90];

if(strlen(cmdtext) > 20)
{
strmid(str,  cmdtext, 0, 20);
strcat(str, "...");
}
else strcat(str, cmdtext);

format(str,sizeof(str),"The Command ~y~%s ~w~does not exist, To see all commands use ~y~/cmds", str);
Alternatively you can set the last 4 characters of cmdtext to "...\0" to cap it at 20 characters max.
Reply


Messages In This Thread
Player Textdraw Doesn't show... - by SsHady - 18.12.2016, 06:17
Re: Player Textdraw Doesn't show... - by iLearner - 18.12.2016, 06:32
Re: Player Textdraw Doesn't show... - by SsHady - 18.12.2016, 06:37
Re: Player Textdraw Doesn't show... - by iLearner - 18.12.2016, 06:43
Re: Player Textdraw Doesn't show... - by SsHady - 18.12.2016, 06:54
Re: Player Textdraw Doesn't show... - by NaS - 18.12.2016, 06:58
Re: Player Textdraw Doesn't show... - by SsHady - 18.12.2016, 07:04
Re: Player Textdraw Doesn't show... - by NaS - 18.12.2016, 07:05
Re: Player Textdraw Doesn't show... - by SsHady - 18.12.2016, 08:20

Forum Jump:


Users browsing this thread: 1 Guest(s)