Search a person from a dialog -
TheSy - 29.01.2014
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 ..
Re: Search a person from a dialog -
TheSy - 29.01.2014
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?
Re: Search a person from a dialog -
TheSy - 30.01.2014
UP..
Re: Search a person from a dialog -
GODEX - 30.01.2014
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]);
}
Re: Search a person from a dialog -
TheSy - 30.01.2014
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 ...
Re: Search a person from a dialog -
TheSy - 31.01.2014
UPPPP
Re: Search a person from a dialog -
TheSy - 01.02.2014
How we define the inputtext = giveplayerid?
Re: Search a person from a dialog -
BroZeus - 01.02.2014
Quote:
How we define the inputtext = giveplayerid?
|
ehh i dont understand what u want to say?
Re: Search a person from a dialog -
TheSy - 01.02.2014
For use (exemple):
Player_infos[giveplayerid][p_Age]
Re: Search a person from a dialog -
CuervO - 01.02.2014
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);