SA-MP Forums Archive
OnDialogResponse - 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: OnDialogResponse (/showthread.php?tid=381236)



OnDialogResponse - SumX - 28.09.2012

Hello!
How can I check if a player is connected in a dialog_style_input?
if(IsPlayerConnected(inputtext)) ?


Re: OnDialogResponse - Face9000 - 28.09.2012

You want check if player is connected so he can use the dialog?Then it's useless because offline players can't use dialogs.


Re: OnDialogResponse - KingHual - 28.09.2012

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;
}



Re: OnDialogResponse - stabker - 28.09.2012

In inputtext name or ID?


Re: OnDialogResponse - Face9000 - 28.09.2012

Quote:
Originally Posted by stabker
Посмотреть сообщение
In inputtext name or ID?
I suggest to use the ID,it's more effective than NAME.


Re: OnDialogResponse - stabker - 28.09.2012

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
I suggest to use the ID,it's more effective than NAME.
pawn Код:
if(IsPlayerConnected(strval(inputtext)))
{
//your code here
}



Re: OnDialogResponse - SumX - 29.09.2012

I insert in a dialog_style_input a NAME
So...inputtext=name


Re: OnDialogResponse - KingHual - 29.09.2012

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.