Dialog System - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dialog System (
/showthread.php?tid=143180)
Dialog System -
WarTaco - 21.04.2010
Hey Guys! alright I'm trying to make a Login Dialog system Hers what i got:
This Under OnPlayerConnect.
Код:
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login", "Welcome Back!", "Login", "Quit");
This at the top.
Код:
enum pInfo // Stats
{
pAdminLevel,
pBites,
pKills
};
new cmd[256], idx, file[128], tmp[256], tmp2[256];
Register:
Код:
{
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/register", true) == 0)
{
new name[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);
GetPlayerName(playerid, name, sizeof(name));
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /register [password]");
format(file,sizeof(file),"%s.ini",name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file,"pPassword", udb_hash(tmp));
dini_IntSet(file,"pBites", 0);
dini_IntSet(file,"pKills", 0);
SendClientMessage(playerid, DARKRED, "[System]: Account Created!");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
GetPlayerName(playerid, name, sizeof(name));
printf("%s has registered a account!", name);
}
else
{
SendClientMessage(playerid, DARKRED, " Account Already Found In Database");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
return 1;
}
return 0;
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 1)
{
if (response == 1) //making sure "Login" was pressed
{
tmp2 = dini_Get(file, "pPassword");
if(udb_hash(tmp) != strval(tmp2))
{
IsLogged[playerid] = 1;
PlayerInfo[playerid][pBites] = dini_Int(file, "pBites");
}
else //incorrect password
{
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "Invalid Password", "Invalid Password, try again", "Login", "Cancel");.
}
}
else //pressed "Cancel"
{
SendClientMessage(playerid, 0xFFFFFFFF, "You have to log In! ");
SendClientMessage(playerid, 0xFFFFFFFF, "Relog!");
SetTimerEx("kicker", 200, 0, "i", playerid);
}
return 1;
}
return 0;
}
Alright this doesn't work at all.. nothing pops up when you enter the server :S
Do you know what the problem is? Thanks!
Re: Dialog System -
WarTaco - 22.04.2010
Can anyone help ??
Re: Dialog System -
IamNotKoolllll - 02.05.2010
Try putting it under Onplayerregquestclass