this is my 3th time i was trying to make register/login system with dialogs and still can't make them!!!
Код:
/*-----------------------------------------------------------------------------
Stared on : 29 March 2010
Clock : 22:45
Maded by : Kljukec
Completed : /
GM Name : /
Credits : /
------------------------------------------------------------------------------*/
//Includes
#include <a_samp>
#include <dini>
#include <dudb>
#include <dutils>
//Colors
#define COLOR_0x00359fff // Blue - Cops
#define COLOR_0xff7000ff // Orange - Error messages
#define COLOR_0x00ff41ff // Green - Taxi job
//Other Defines
//Admin Things-------------------
enum aInfo{
aPassword,
aLogged,
aRegistered,
aWrongpass,
}
new AccountInfo[MAX_PLAYERS][aInfo];
enum pInfo{
pCash,
pALevel,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
//-------------------------------
public OnGameModeInit()
{
SetGameModeText("Roleplay");
return 1;
}
public OnPlayerConnect(playerid)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/KA/%s.ini",name);
if (AccountInfo[playerid][aLogged] == 0)
{
if (!fexist(file))
{
new stri[128];
format(stri,256,"Welcome %s to Kljukec's Roleplay Server.\n\nYour name is not registered yet so please enter \nthe password in box! ",name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Register",stri,"Register","Quit");
}
else if (fexist(file))
{
new strn[128];
format(strn,256,"Welcome back %s\n\nPlease enter the correct password.",name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login",strn,"Login","Quit");
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
new file[29];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/KA/Users/%s.sav",udb_encode(name));
if(response == 1) //Register Dialog
{
if(!fexist(file))
{
dini_Create(file);
dini_Set(file, "aPassword", inputtext);
dini_IntSet(file,"pALevel", 0);
dini_IntSet(file,"pCash", 500);
dini_IntSet(file,"aRegistered", 1);
SendClientMessage(playerid, 0x00ff41ff, "You successfuly registered your account!");
}
if(response == 0)
{
SendClientMessage(playerid, 0xff7000ff, "Bye,Bye have a nice day!");
Kick(playerid);
return 1;
}
}
}
if(dialogid == 2) // Login Dialog
{
new file[29];
new str[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/KA/Users/%s.sav",udb_encode(name));
new PW[256];
PW = dini_Get(str,"password");
if(response == 1)
{
if(strval(inputtext) == udb_hash(PW)) // Successful Login
{
PlayerInfo[playerid][pCash] = dini_Int(str,"pCash");
PlayerInfo[playerid][pALevel] = dini_Int(str,"pALevel");
}
else
{
ShowPlayerDialog(playerid, 2, 1,"Wrong Password", "That Password is incorrect. Please try again.","login", "cancel");
return 1;
}
}
return 1;
}
return 1;
}
no errors but it just don't want to create a file... it actually just won't work i was asking for help here too and ppl help but its still not fixed! can someone just help me with this /login /register dialog?and don't say i must search becouse i already did and i was copying codes,downloadin filterscripts, i was trying to transfer codes in my gamemode but nothing wont work WTF??!
i was doing this too... nvm its fixed ty anyway