Posts: 343
Threads: 85
Joined: Dec 2011
Reputation:
0
Hello!
How can I check if a player is connected in a dialog_style_input?
if(IsPlayerConnected(inputtext)) ?
Posts: 3,351
Threads: 780
Joined: Jan 2010
You want check if player is connected so he can use the dialog?Then it's useless because offline players can't use dialogs.
Posts: 2,286
Threads: 18
Joined: Jun 2010
Use
Код:
IsPlayerConnected(GetPlayerID(inputtext,0))
The stock GetPlayerID:
Код:
stock GetPlayerID(const name[])
{
new pName[MAX_PLAYER_NAME];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
GetPlayerName(i, pName, MAX_PLAYER_NAME);
if(!strcmp(pName, name))
return i;
}
return INVALID_PLAYER_ID;
}
Posts: 3,351
Threads: 780
Joined: Jan 2010
Quote:
Originally Posted by stabker
In inputtext name or ID?
|
I suggest to use the ID,it's more effective than NAME.
Posts: 343
Threads: 85
Joined: Dec 2011
Reputation:
0
I insert in a dialog_style_input a NAME
So...inputtext=name
Posts: 2,286
Threads: 18
Joined: Jun 2010
Quote:
Originally Posted by SumX
I insert in a dialog_style_input a NAME
So...inputtext=name
|
Already showed you the solution in my previous post.