because your using Pvar.
Forgiveness? but I tried this system and does not create anything (ie does not create the file) I right? do it a test
pawn Code:
// By xkirill
// im taking his credit! hehehe >:D
#include <a_samp>
#include <dini>
#include <dudb>
#include <zcmd>
#define SCRIPT_VERSION "v3"
#define colorRed 0xFF0000FF
#define colorGreen 0x008000FF
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_ACCOUNT 3
#define DIALOG_CHANGEPASS 4
#define DIALOG_VIEWSTATS 6
#define DIALOG_CHECKSTATS 7
#pragma unused ret_memcpy
#pragma unused strtok
forward UpdateTime(playerid);
new str[128];
new file[128];
new playerIP[16];
new value;
new Update;
public OnPlayerConnect(playerid)
{
format(file, 128, "/tReg/%s.ini", GetName(playerid));
GetPlayerIp(playerid, playerIP, 16);
TogglePlayerSpectating(playerid, 1);
if(!dini_Exists(file))
{
format(str, 128, "Welcome %s \n\nPlease register your account", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Account Management", str, "Register", "Quit");
}
else
{
format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
format(file, 128, "/tReg/%s.ini", GetName(playerid));
if(GetPVarInt(playerid, "Logged") == 1)
{
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
dini_IntSet(file, "Score", GetPlayerScore(playerid));
dini_IntSet(file, "Kills", GetPVarInt(playerid, "Kills"));
dini_IntSet(file, "Deaths", GetPVarInt(playerid, "Deaths"));
dini_IntSet(file, "Minutes Ingame", GetPVarInt(playerid, "Time"));
dini_IntSet(file, "Adminlvl",GetPVarInt(playerid, "Admin")); // new
dini_IntSet(file, "VIPlvl",GetPVarInt(playerid, "VIP")); // new
KillTimer(Update);
}
return 1;
}
public OnFilterScriptInit()
{
printf("\n [FS] torran's Registration System %s \n", SCRIPT_VERSION);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
format(file, 128, "/tReg/%s.ini", GetName(playerid));
if(dialogid == DIALOG_REGISTER)
{
if(!response) return Kick(playerid);
if(response)
{
if(strlen(inputtext) == 0)
{
format(str, 128, "Welcome %s \n\nPlease register your account", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Account Management", str, "Register", "Quit");
return 0;
}
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
dini_IntSet(file, "Score", GetPlayerScore(playerid));
dini_IntSet(file, "Kills", GetPVarInt(playerid, "Kills"));
dini_IntSet(file, "Deaths", GetPVarInt(playerid, "Deaths"));
dini_IntSet(file, "Minutes Ingame", GetPVarInt(playerid, "Time"));
dini_IntSet(file, "Adminlvl",GetPVarInt(playerid, "Admin")); // new
dini_IntSet(file, "VIPlvl",GetPVarInt(playerid, "VIP")); // new
format(str, 128, "Account successfully Registered \n\n\nWelcome %s \n\nPlease login to your account", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
}
}
}
if(dialogid == DIALOG_LOGIN)
{
if(!response) return Kick(playerid);
if(response)
{
if(strlen(inputtext) == 0)
{
format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
return 0;
}
if(fexist(file))
{
new password = dini_Int(file, "Password");
if(udb_hash(inputtext) != password)
{
if(GetPVarInt(playerid, "Attempts") == 0)
{
SetPVarInt(playerid, "Attempts", 1);
SendClientMessage(playerid, colorRed, "Incorrect password, You have 1 more attempt");
format(str, 128, "Welcome %s \n\nPlease login to your account", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Account Management", str, "Login", "Quit");
}
else if(GetPVarInt(playerid, "Attempts") == 1)
{
SendClientMessage(playerid, colorRed, "Incorrect password, You do not have any attempts left");
Kick(playerid);
}
}
else
{
SetPVarInt(playerid, "Logged", 1);
SetPlayerCash(playerid, dini_Int(file, "Money"));
SetPlayerScore(playerid, dini_Int(file, "Score"));
SetPVarInt(playerid, "Kills", dini_Int(file, "Kills"));
SetPVarInt(playerid, "Deaths", dini_Int(file, "Deaths"));
SetPVarInt(playerid, "Time", dini_Int(file, "Minutes Ingame"));
SetPVarInt(playerid, "Admin", dini_Int(file, "Admin")); // new
SetPVarInt(playerid, "VIP", dini_Int(file, "VIP")); // new
GetPlayerIp(playerid, playerIP, 16);
dini_Set(file, "IP", playerIP);
Update = SetTimerEx("UpdateTime", 60*1000, 1, "i", playerid);
TogglePlayerSpectating(playerid, 0);
SendClientMessage(playerid, colorGreen, "You have successfully logged in.");
}
}
}
}
if(dialogid == DIALOG_CHANGEPASS)
{
if(response)
{
if(GetPVarInt(playerid, "PassStage") == 1)
{
new password = dini_Int(file, "Password");
if(udb_hash(inputtext) == password)
{
SetPVarInt(playerid, "PassStage", 2);
ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_INPUT, "Account Management", "Please input your new password", "Change Pass", "Cancel");
}
else
{
SendClientMessage(playerid, colorRed, "Incorrect password.");
}
}
else if(GetPVarInt(playerid, "PassStage") == 2)
{
if(GetPVarInt(playerid, "Logged") == 1)
{
dini_IntSet(file, "Password", udb_hash(inputtext));
SendClientMessage(playerid, colorGreen, "Password successfully changed.");
}
}
}
}
return 0;
}
public UpdateTime(playerid)
{
format(file, 128, "/tReg/%s.ini", GetName(playerid));
SetPVarInt(playerid, "Time", GetPVarInt(playerid, "Time")+1);
return 1;
}
CMD:changepass(playerid, params[])
{
if(GetPVarInt(playerid, "Logged") == 1)
{
SetPVarInt(playerid, "PassStage", 1);
ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_INPUT, "Account Management", "Please input your current password for verification", "Continue", "Cancel");
}
return 1;
}
CMD:viewstats(playerid, params[])
{
if(GetPVarInt(playerid, "Logged") == 1)
{
new Float:health; GetPlayerHealth(playerid, health);
new Float:armour; GetPlayerArmour(playerid, armour);
format(str, 128, "Name: %s\nHealth: %0.00f\nArmour: %0.00f\nMoney: %i\nScore: %i\nKills: %i\nDeaths: %i", GetName(playerid), health, armour, GetPlayerMoney(playerid), GetPlayerScore(playerid), GetPVarInt(playerid, "Kills"), GetPVarInt(playerid, "Deaths"));
ShowPlayerDialog(playerid, DIALOG_VIEWSTATS, DIALOG_STYLE_MSGBOX, "Account Management", str, "Ok", "Cancel");
}
return 1;
}
CMD:checkstats(playerid, params[])
{
new targetid;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, colorRed, "You need to be an RCON Admin to use this command.");
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, colorRed, "Usage: /checkstats [PlayerID/PartOfName]");
if(targetid == playerid) return SendClientMessage(playerid, colorRed, "You are trying to view the stats of you, To do this type: /viewstats");
if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, colorRed, "Player not Found");
if(GetPVarInt(playerid, "Logged") == 1)
{
new Float:health; GetPlayerHealth(targetid, health);
new Float:armour; GetPlayerArmour(targetid, armour);
format(str, 128, "Name: %s\nHealth: %0.00f\nArmour: %0.00f\nMoney: %i\nScore: %i\nKills: %i\nDeaths: %i", GetName(targetid), health, armour, GetPlayerMoney(targetid), GetPlayerScore(targetid), GetPVarInt(targetid, "Kills"), GetPVarInt(targetid, "Deaths"));
ShowPlayerDialog(playerid, DIALOG_VIEWSTATS, DIALOG_STYLE_MSGBOX, "Account Management", str, "Ok", "Cancel");
}
return 1;
}
CMD:makevip(playerid, params[])
{
new id, level, sendername[MAX_PLAYER_NAME], string[128];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, colorRed, "You need to be an RCON admin to use this command");
if(sscanf(params, "ui", id, level)) return SendClientMessage(playerid, colorRed,"USAGE: /makevip [playerid/partofname] [level 1-3]");
if(level > 3 || level < 0) return SendClientMessage(playerid, colorRed,"Only 1 to 3");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, colorRed, "Invalid player ID");
else
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string),"You have promoted %s to VIP level %d", id, level);
SendClientMessage(playerid, colorGreen, string);
format(string, sizeof(string),"You have been promoted to VIP level %d by admin %s", level, id);
SendClientMessage(id, colorGreen, string);
SetPVarInt(playerid, "VIP", level);
}
return 1;
}
///////////////////////////////////////PlatinumVIP////////////
CMD:minigun(playerid, params[])
{
if(GetPVarInt(playerid, "VIP") == 3)
{
GivePlayerWeapon(playerid, 38, 200);
SendClientMessage(playerid, colorRed, "You have spawned yourself a minigun!");
}else{
SendClientMessage(playerid, colorGreen, "You need to be Golden VIP to use this command!");
}
return 1;
}
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof name);
return name;
}
stock SetPlayerCash(playerid, amount)
{
ResetPlayerMoney(playerid);
return GivePlayerMoney(playerid, amount);
}
stock sscanf(string[], format[], {Float,_}:...)
{
#if defined isnull
if (isnull(string))
#else
if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
#endif
{
return format[0];
}
#pragma tabsize 4
new
formatPos = 0,
stringPos = 0,
paramPos = 2,
paramCount = numargs(),
delim = ' ';
while (string[stringPos] && string[stringPos] <= ' ')
{
stringPos++;
}
while (paramPos < paramCount && string[stringPos])
{
switch (format[formatPos++])
{
case '\0':
{
return 0;
}
case 'i', 'd':
{
new
neg = 1,
num = 0,
ch = string[stringPos];
if (ch == '-')
{
neg = -1;
ch = string[++stringPos];
}
do
{
stringPos++;
if ('0' <= ch <= '9')
{
num = (num * 10) + (ch - '0');
}
else
{
return -1;
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num * neg);
}
case 'h', 'x':
{
new
num = 0,
ch = string[stringPos];
do
{
stringPos++;
switch (ch)
{
case 'x', 'X':
{
num = 0;
continue;
}
case '0' .. '9':
{
num = (num << 4) | (ch - '0');
}
case 'a' .. 'f':
{
num = (num << 4) | (ch - ('a' - 10));
}
case 'A' .. 'F':
{
num = (num << 4) | (ch - ('A' - 10));
}
default:
{
return -1;
}
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num);
}
case 'c':
{
setarg(paramPos, 0, string[stringPos++]);
}
case 'f':
{
new changestr[16], changepos = 0, strpos = stringPos;
while(changepos < 16 && string[strpos] && string[strpos] != delim)
{
changestr[changepos++] = string[strpos++];
}
changestr[changepos] = '\0';
setarg(paramPos,0,_:floatstr(changestr));
}
case 'p':
{
delim = format[formatPos++];
continue;
}
case '\'':
{
new
end = formatPos - 1,
ch;
while ((ch = format[++end]) && ch != '\'') {}
if (!ch)
{
return -1;
}
format[end] = '\0';
if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
{
if (format[end + 1])
{
return -1;
}
return 0;
}
format[end] = '\'';
stringPos = ch + (end - formatPos);
formatPos = end + 1;
}
case 'u':
{
new
end = stringPos - 1,
id = 0,
bool:num = true,
ch;
while ((ch = string[++end]) && ch != delim)
{
if (num)
{
if ('0' <= ch <= '9')
{
id = (id * 10) + (ch - '0');
}
else
{
num = false;
}
}
}
if (num && IsPlayerConnected(id))
{
setarg(paramPos, 0, id);
}
else
{
#if !defined foreach
#define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
#define __SSCANF_FOREACH__
#endif
string[end] = '\0';
num = false;
new
name[MAX_PLAYER_NAME];
id = end - stringPos;
foreach (Player, playerid)
{
GetPlayerName(playerid, name, sizeof (name));
if (!strcmp(name, string[stringPos], true, id))
{
setarg(paramPos, 0, playerid);
num = true;
break;
}
}
if (!num)
{
setarg(paramPos, 0, INVALID_PLAYER_ID);
}
string[end] = ch;
#if defined __SSCANF_FOREACH__
#undef foreach
#undef __SSCANF_FOREACH__
#endif
}
stringPos = end;
}
case 's', 'z':
{
new
i = 0,
ch;
if (format[formatPos])
{
while ((ch = string[stringPos++]) && ch != delim)
{
setarg(paramPos, i++, ch);
}
if (!i)
{
return -1;
}
}
else
{
while ((ch = string[stringPos++]))
{
setarg(paramPos, i++, ch);
}
}
stringPos--;
setarg(paramPos, i, '\0');
}
default:
{
continue;
}
}
while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
{
stringPos++;
}
while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
{
stringPos++;
}
paramPos++;
}
do
{
if ((delim = format[formatPos++]) > ' ')
{
if (delim == '\'')
{
while ((delim = format[formatPos++]) && delim != '\'') {}
}
else if (delim != 'z')
{
return delim;
}
}
}
while (delim > ' ');
return 0;
}
I used to do was wrong, but not the dialogues are not going well, about your mistakes, posting zcmd of who is different from what you have
Don't even work with DINI. Use Y_INI and search for that in the Tutorial section. DINI is old, you better use Y_INI or MySQL.