public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
{
new str[256];
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", 4000, false, "i", playerid);
}
return 1;
}
forward HideWrongTD(playerid);
public HideWrongTD(playerid)
{
PlayerTextDrawHide(playerid, wrongcmd[playerid]);
}
public HideWrongTD(playerid) { PlayerTextDrawHide(playerid, wrongcmd[playerid]); }
public HideWrongTD(playerid) { PlayerTextDrawDestroy(playerid, wrongcmd[playerid]); }
public HideWrongTD(playerid) { PlayerTextDrawHide(playerid, wrongcmd[playerid]); }
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; }
Never put spaces at the end of a Textdraw Text! That prevents any TextDraw/GameText from showing.
The size of the string should be at least 90 btw. That will show a command of the length 20 maximum, when longer the text will get cut. |
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;
}
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] |
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);