16.08.2011, 22:08
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new File[50];
if(dialogid == 4)
{
if(response == 0) // Se Ele Apertar Em Cancelar, Ou Seja, Aparecerб o Dialog Denovo, Obrigando ele a Escolher.
{
ShowPlayerDialog(playerid, GANG, DIALOG_STYLE_LIST, "Escolha o Seu Time","Zumbis\nHumanos","Selecionar","Cancelar");
}
if(response == 1)
{
if(listitem == 0)
{
gTeam[playerid] = Nazistas; // ou gTeam[playerid] == 1; ( Seta Ele Para Gang Aztecas )
SetPlayerSkin(playerid, 116); // Setarб Ele Para Skin 116, Dos Aztecas.
SendClientMessage(playerid, CorNazi,"Vocк Escolheu Ser Nazi.");
SpawnPlayer(playerid); // Spawn o Player
return true;
}
if(listitem == 1)
{
gTeam[playerid] = Mexicanos; // ou gTeam[playerid] == 2; ( Seta Ele Para Gang Grove )
SetPlayerSkin(playerid, 107); // Setarб Ele Para Skin 107, Dos Grove.
SendClientMessage(playerid, CorMexicano,"Vocк Escolheu Ser Mexicanos.");
SpawnPlayer(playerid); // Spawn o Player
return true;
}
if(listitem == 2)
{
gTeam[playerid] = Gangsters; // ou gTeam[playerid] == 3; ( Seta Ele Para Gang Ballas)
SetPlayerSkin(playerid, 102); // Setarб Ele Para Skin 107, Dos Ballas.
SendClientMessage(playerid, CorGangster,"Vocк Escolheu Ser Gangster.");
SpawnPlayer(playerid); // Spawn o Player
return true;
}
return true;
}
return true;
}
format(File, sizeof(File), PFiles, pName(playerid));
switch(dialogid)
{
case LOGIN:
{
if(response)
{
if(strlen(inputtext) == 0)
{
new
iStr[128];
format(iStr, sizeof(iStr), ""#CBLUE"Welcome back: "#CDGREEN"%s(%d)\n"#CBLUE"Enter your password to login:", pName(playerid), playerid);
return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""#CBLUE"Login", iStr, "Login", "Leave");
}
if(strcmp(inputtext, dj(File, "Password", 40), true) == 0)
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You are now logged in!");
SpawnPlayer(playerid);
PVar[playerid][pKills] = djInt (File, "Kills");
PVar[playerid][pDeaths] = djInt (File, "Deaths");
PVar[playerid][pLevel] = djInt (File, "Level");
PVar[playerid][pMuted] = djInt (File, "Muted");
format(PVar[playerid][pMutedReason], 52, "%s", dj(File, "MutedReason"));
PVar[playerid][pLastX] = djFloat (File, "LastX");
PVar[playerid][pLastY] = djFloat (File, "LastY");
PVar[playerid][pLastZ] = djFloat (File, "LastZ");
}
else
{
new
iStr[128];
format(iStr, sizeof(iStr), ""#CBLUE"Welcome back: "#CDGREEN"%s(%d)\n"#CBLUE"Enter your password to login:", pName(playerid), playerid);
return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""#CBLUE"Login", iStr, "Login", "Leave");
}
}
else Kick(playerid);
}
case REGISTER:
{
if(response)
{
if(strlen(inputtext) == 0)
{
new
iStr[128];
format(iStr, sizeof(iStr), ""#CBLUE"Welcome: "#CDGREEN"%s(%d)\n"#CBLUE"This account has not been registered! Please enter a password:", pName(playerid), playerid);
return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""#CBLUE"Login", iStr, "Registar", "Sair");
}
djCreateFile(File);
djSet (File, "Password", inputtext);
djSetInt (File, "Kills", 0);
djSetInt (File, "Deaths", 0);
djSetInt (File, "Level", 0);
djSetInt (File, "Muted", 0);
djSet (File, "MutedReason", "Not Muted!");
djSetFloat (File, "LastX", 0.0);
djSetFloat (File, "LastY", 0.0);
djSetFloat (File, "LastZ", 0.0);
djCommit(File);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "Regista-te com sucesso e entraste automaticamente!");
}
else Kick(playerid);
}
}
return 1;
}