Search a person from a dialog
#1

Good morning.

I have a dialog, and I want to score recognize the name of a person connected to the server, it displays a message.
I just want the game to search for a player from the dialog ..
Reply
#2

pawn Код:
if(dialogid == 0)
    {
        if(!response)
        {
            return 1;
        }
        new tmp[64], idx, giveplayerid, string[100];
        tmp = strtok(inputtext, idx);
        giveplayerid = ReturnUser(tmp);
        format(string, sizeof(string), "Name: %s", GetName(giveplayerid));
        PlayerTextDrawSetString(playerid, Textdraw1[playerid], string);
        PlayerTextDrawShow(playerid, Textdraw1[playerid]);
    }
Why it's not work?
Reply
#3

UP..
Reply
#4

I really never understood the whole PlayerTextDrawShow feature because for me it never showed.

You need to define if a player has just connected or not

Just define a regular textdraw but for a player

Example:


TOP OF SCRIPT

Код:
new Text:Textdraw1[MAX_PLAYERS]
ONGAMEMODEEXIT

Код:
for (new i = 0; i < MAX_PLAYERS; i++)
{
         TextDrawDestroy(Text:Textdraw1[i]);

}
ONGAMEMODEINIT

Код:
CreatePlayerTextDraws(playerid);
BOTTOM OF YOUR SCRIPT

Код:
forward CreatePlayerTextDraws(playerid);
public CreatePlayerTextDraws(playerid)
{
        for(new i=0; i<MAX_PLAYERS; i++)
	{
        	Textdraw1[i] = TextDrawCreate(530.000000, 126.000000, "Textdraw1");
		TextDrawBackgroundColor(Textdraw1, 255);
		TextDrawFont(Textdraw1, 1);
		TextDrawLetterSize(Textdraw1, 0.240000, 1.000000);
		TextDrawColor(Textdraw1, -1);
		TextDrawTextSize(Textdraw1, 606.000000, 1.000000);
          }
}
Simple Fix Also how ever you will have to fix the little bugs im half asleep
Код:
public OnPlayerConnected
{
         new tmp[64], idx, giveplayerid, string[100];
        tmp = strtok(inputtext, idx);
        giveplayerid = ReturnUser(tmp);
        format(string, sizeof(string), "Name: %s", GetName(giveplayerid));
        TextDrawSetString(playerid, Textdraw1[playerid], string);
        TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
}
Reply
#5

When I do that, then I want to display the age of the person (Player_infos[playerid][p_Age] normally)

Once I do that, and it does not work, why?:

pawn Код:
new stringage[50];
        format(stringage, sizeof(stringage), "Age: %d", Player_infos[giveplayerid][p_Age]);
        PlayerTextDrawSetString(playerid, Textdraw7[playerid], stringage);
        PlayerTextDrawShow(playerid, Textdraw7[playerid]);
It always puts the age at zero ...
Reply
#6

UPPPP
Reply
#7

How we define the inputtext = giveplayerid?
Reply
#8

Quote:

How we define the inputtext = giveplayerid?

ehh i dont understand what u want to say?
Reply
#9

For use (exemple):
Player_infos[giveplayerid][p_Age]
Reply
#10

Quote:
Originally Posted by TheSy
Посмотреть сообщение
pawn Код:
if(dialogid == 0)
    {
        if(!response)
        {
            return 1;
        }
        new tmp[64], idx, giveplayerid, string[100];
        tmp = strtok(inputtext, idx);
        giveplayerid = ReturnUser(tmp);
        format(string, sizeof(string), "Name: %s", GetName(giveplayerid));
        PlayerTextDrawSetString(playerid, Textdraw1[playerid], string);
        PlayerTextDrawShow(playerid, Textdraw1[playerid]);
    }
Why it's not work?
What does the ReturnUser function do?

You can convert a string into an integer with strval; if the dialog only accepts IDs then it would be:

pawn Код:
giveplayerid = strval(inputtext);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)