08.03.2011, 09:38
If you want to show the dialog before they get to class selection, then show the dialog in OnPlayerConnect , and return '0' in OnPlayerRequestClass untill they have selected a language.
EG,
EG,
pawn Code:
#include <a_samp>
#define L_ENGLISH (0)
#define L_SERBIAN (1)
#define LANG_DIALOG (500)
new bool:SelectedLang[MAX_PLAYERS];
new P_Language[MAX_PLAYERS];
public OnPlayerRequestClass(playerid, classid)
{
if(!SelectedLang[ playerid ])
return 0;
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
SelectedLang[ playerid ] = false;
P_Language[ playerid ] = L_ENGLISH;
ShowPlayerDialog(playerid, LANG_DIALOG, DIALOG_STYLE_LIST, "Languages", "English \nSerbian", "Accept", "Close");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case LANG_DIALOG:
{
if(response)
{
switch(listitem)
{
case 0://english
{
SelectedLang[ playerid ] = true;
}
case 1://serbian
{
SelectedLang[ playerid ] = true;
P_Language[ playerid ] = L_SERBIAN;
}
}
}
else
{
SelectedLang[ playerid ] = true;
}
}
}
return 1;
}