08.08.2011, 10:12
Hey guys i am making this:
And when i go ingame there is nothing.
If i type /register i just receive register dialog, i cant register there.
I got Files in my scriptfiles Server/Users/ i got.
Please help me.
thanks
pawn Код:
/*
-------------------------------------*
Script. *
-------------------------------------*
*/
#include <a_samp>
//#include <YSI/y_ini>
#include <dini>
#include <ldudb>
#include <zcmd>
#include <sscanf2>
new IsLoggedIn[MAX_PLAYERS];
new file[256];
enum pInfo
{
pLevel,
pCash,
pKills,
pDeaths,
pColor,
pScore,
pSkin
}
new PlayerInfo[MAX_PLAYERS][pInfo];
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Script.");
print("--------------------------------------\n");
return 1;
}
#endif
public OnPlayerConnect(playerid)
{
IsLoggedIn[playerid] = 0;
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "Server/Users/%s.ini", name);
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "Register Account.", "Welcome,\n\nYour Account is currently not registered in our Database, So if you feel glad to register you may register please.\n\nEnter your Desired Password Below:", "Register", "Later");
}
if(fexist(file))
{
ShowPlayerDialog(playerid, 7407, DIALOG_STYLE_INPUT, "Login Account", "Welcome,\n\nYour Account is currently registered in our Database, So if you feel glad to login you may login please.\n\nEnter your Desired Password Below:", "Login", "Later");
}
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 2196)
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "Server/Users/%s.ini", name);
if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You skiped to Register an account on our Database, Please Makesure your Kills/Deaths/Cash/Level/Color and Skin won't be saved.");
if(!strlen(inputtext)) return
ShowPlayerDialog(playerid, 2196523, DIALOG_STYLE_INPUT, "Register Account.", "Welcome,\n\nYour Account is currently not registered in our Database, So if you feel glad to register you may register please.\n\nEnter your Desired Password Below:", "Register", "Later");
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "Level",PlayerInfo[playerid][pLevel] = 0);
dini_IntSet(file, "Cash",PlayerInfo[playerid][pCash] = 500);
dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
dini_IntSet(file, "Color",PlayerInfo[playerid][pColor] = 0);
dini_IntSet(file, "Skin",PlayerInfo[playerid][pSkin] = 0);
format(string, 2134, "Server: You succesfully registered the nickname %s with password %s.. You have been AutoLogged In.", name, inputtext);
SendClientMessage(playerid, 0x00FF00FF, string);
IsLoggedIn[playerid] = 1;
}
if (dialogid == 7407)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "Server/Users/%s.ini", name);
if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You skiped to Login your account, Please Makesure your Kills/Deaths/Cash/Level/Color and Skin won't be saved.");
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "Hi your registered", "You are registred, please login.", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid, 0xFF0000FF, "The Password you entered it feels like wrong, Try again..");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login Account", "Welcome,\n\nYour Account is currently registered in our Database, So if you feel glad to login you may login please.\n\nEnter your Desired Password Below:", "Login", "Later");
}
else
{
IsLoggedIn[playerid] = 1;
SetPlayerMoney(playerid, dini_Int(file, "pCash"));
SetPlayerScore(playerid, dini_Int(file, "pScore"));
SetPlayerColor(playerid, dini_Int(file, "pColor"));
PlayerInfo[playerid][pLevel] = dini_Int(file, "pLevel");
SetPlayerSkin(playerid, dini_Int(file, "pSkin"));
SendClientMessage(playerid,0x00FF00FF, "Server: You have logged in your account!");
}
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new name[24];
GetPlayerName(playerid,name,24);
format(file,sizeof(file),"Server/Users/%s.ini",name);
if(dini_Exists(file))
{
dini_IntSet(file,"pCash",GetPlayerMoney(playerid));
dini_IntSet(file,"pScore",GetPlayerScore(playerid));
dini_IntSet(file,"pColor",GetPlayerColor(playerid));
dini_IntSet(file,"pLevel",PlayerInfo[playerid][pLevel]);
dini_IntSet(file,"pSkin",GetPlayerSkin(playerid));
IsLoggedIn[playerid] = 0;
return 1;
}
return 1;
}
COMMAND:register(playerid, params[])
{
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, 2196, DIALOG_STYLE_INPUT, "Register Account.", "Welcome,\n\nYour Account is currently not registered in our Database, So if you feel glad to register you may register please.\n\nEnter your Desired Password Below:", "Register", "Later");
}
if(fexist(file))
{
ShowPlayerDialog(playerid, 7407, DIALOG_STYLE_INPUT, "Login Account", "Welcome,\n\nYour Account is currently registered in our Database, So if you feel glad to login you may login please.\n\nEnter your Desired Password Below:", "Login", "Later");
}
return 1;
}
If i type /register i just receive register dialog, i cant register there.
I got Files in my scriptfiles Server/Users/ i got.
Please help me.
thanks