SA-MP Forums Archive
Wrong Command Textdraw Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Wrong Command Textdraw Help (/showthread.php?tid=622580)



Wrong Command Textdraw Help - Sulps - 24.11.2016

so i basically want to get what wrong command the typer has typed and return that in a textdraw. I have no idea on how can i achieve that.

i want something like this



any help of help would be appreciated


Re: Wrong Command Textdraw Help - Jelly23 - 24.11.2016

You must create a player textdraw, then use PlayerTextDrawSetString, and show it again.


Re: Wrong Command Textdraw Help - Runn3R - 24.11.2016

You can start off by telling us what command processor are you using.


Re: Wrong Command Textdraw Help - Sulps - 24.11.2016

can you possibly show its usage? the wiki doesnt say much. I need a command like shown above. i have no idea how to set wrong command to a string
I'm using ZCMD!


Re: Wrong Command Textdraw Help - Bolex_ - 24.11.2016

https://sampwiki.blast.hk/wiki/Textdraw


Re: Wrong Command Textdraw Help - Jelly23 - 24.11.2016

Quote:
Originally Posted by Sulps
Посмотреть сообщение
can you possibly show its usage? the wiki doesnt say much. I need a command like shown above. i have no idea how to set wrong command to a string
I'm using ZCMD!
Example:

PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(!
success)
    {
              new 
str[60];
              
format(str,sizeof(str),"%s is an invalid command",cmdtext);
              
PlayerTextDrawSetString(playerid,your_player_td_here[playerid],str);
              
PlayerTextDrawShow(playerid,your_player_td_here[playerid]);
    }
    return 
1;

You may use a timer to hide it.

If by any chance you didn't create your player textdraw yet. You might want to look into adri1's TDEditor: https://sampforum.blast.hk/showthread.php?tid=543002, but first make sure you learn what a textdraw is and how to use them: https://sampwiki.blast.hk/wiki/Textdraw


Re: Wrong Command Textdraw Help - Sulps - 24.11.2016

Quote:
Originally Posted by Jelly23
Посмотреть сообщение
Example:

PHP код:
public OnPlayerCommandPerformed(playeridcmdtext[], success)
{
    if(!
success)
    {
              new 
str[60];
              
format(str,sizeof(str),"%s is an invalid command",cmdtext);
              
PlayerTextDrawSetString(your_player_td_here[playerid],string);
              
PlayerTextDrawShow(playerid,your_player_td_here[playerid]);
    }
    return 
1;

You may use a timer to hide it.

If by any chance you didn't create your player textdraw yet. You might want to look into adri1's TDEditor: https://sampforum.blast.hk/showthread.php?tid=543002, but first make sure you learn what a textdraw is and how to use them: https://sampwiki.blast.hk/wiki/Textdraw
for example this is my player textdraw
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
	if(!success)
	{
             
              Text[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Test TextDraw");
              new str[60];
              format(str,sizeof(str),"%s is an invalid command",cmdtext);
              PlayerTextDrawSetString(Text[playerid],string);
              PlayerTextDrawShow(playerid,Text[playerid]);
    }
    return 1;
}

would this work?



Re: Wrong Command Textdraw Help - Jelly23 - 24.11.2016

Quote:
Originally Posted by Sulps
Посмотреть сообщение
for example this is my player textdraw
Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
	if(!success)
	{
             
              Text[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Test TextDraw");
              new str[60];
              format(str,sizeof(str),"%s is an invalid command",cmdtext);
              PlayerTextDrawSetString(Text[playerid],string);
              PlayerTextDrawShow(playerid,Text[playerid]);
    }
    return 1;
}

would this work?
Create your textdraw once on OnPlayerConnect, and yes it would work, but use a timer to hide it.


Re: Wrong Command Textdraw Help - Sulps - 24.11.2016

Quote:
Originally Posted by Jelly23
Посмотреть сообщение
Create your textdraw once on OnPlayerConnect, and yes it would work, but use a timer to hide it.
So this code
Код:
Text[playerid] = CreatePlayerTextDraw(playerid, 320.0, 240.0, "Test TextDraw");
should be removed from here and pasted under onplayerconnect?

I will use a timer to hide it, first i figure how it is going to work


Re: Wrong Command Textdraw Help - Sulps - 24.11.2016

I will give it a shot, Thanks alot man.
+rep