Need help!!
#1

Hello guys,

Yesterday I created an AdminSystem for my server but when I enable the script and a player connects to my server.
The server is restarting.
But it is not yet completed.

Код:
#include <a_samp>
#include <dini>
#include <dutils>
//#include <zcmd>

#define FILTERSCRIPT

//Colors
#define maincolor 0xFF0000FF

#define Users "AdminSystem/Users/%s.ini"
#define Config "AdminSystem/config.ini"

enum UInfo {
    IP,
    Registered,
    LoggedIn,
    Password,
    Level,
    Banned,
}

new UserInfo[MAX_PLAYERS][UInfo];

public OnFilterScriptInit()
{
 return 1;
}

public OnPlayerConnect(playerid)
{
 new file[128], playername[MAX_PLAYER_NAME], playerIP[16];
 GetPlayerName(playerid, playername, sizeof(playername));
 GetPlayerIp(playerid, playerIP, sizeof(playerIP));
 format(file,sizeof(file),Users,playername);
 if(!dini_Exists(file))
 {
  dini_Create(file);
  dini_Set(file, "IP", playerIP);
  dini_IntSet(file, "Registered", 0);
  dini_IntSet(file, "LoggedIn", 0);
  dini_IntSet(file, "Level", 0);
  dini_IntSet(file, "Password", 0);
  dini_IntSet(file, "Banned", 0);
  ShowPlayerDialog(playerid, 100, DIALOG_STYLE_INPUT, "Welcome To AKS and SMGS", "You are not registered. Please enter a password below to register:", "Register", "Quit");
 }
 UserInfo[playerid][IP] = dini_Int(file, "IP");
 UserInfo[playerid][Registered] = dini_Int(file, "Registered");
 UserInfo[playerid][LoggedIn] = dini_Int(file, "LoggedIn");
 UserInfo[playerid][Level] = dini_Int(file, "Level");
 UserInfo[playerid][Password] = dini_Int(file, "Password");
 UserInfo[playerid][Banned] = dini_Int(file, "Banned");
 if(UserInfo[playerid][Registered] == 1) ShowPlayerDialog(playerid, 101, DIALOG_STYLE_INPUT, "Welcome To AKS and SMGS", "Please login with your password:", "Login", "Leave");
 return 1;
}

public OnPlayerDisconnect(playerid)
{
 UserInfo[playerid][LoggedIn] = 0;
 return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
 if(dialogid == 100)
 {
  if(!response) return Kick(playerid);
  {
   if(strlen(inputtext) < 2)
   SendClientMessage(playerid, maincolor, "Error: Minimum Characters are 2") &&
   ShowPlayerDialog(playerid, 100, DIALOG_STYLE_INPUT, "Welcome To AKS and SMGS", "You are not registered. Please enter a password below to register:", "Register", "Quit");
   new pass = num_hash(inputtext);
   UserInfo[playerid][Registered] = 1;
   UserInfo[playerid][LoggedIn] = 1;
   UserInfo[playerid][Password] = pass;
   SendClientMessage(playerid, maincolor, "Succesfully Registered. You have been automatically Logged In");
  }
 }
 return 1;
}
Reply
#2

Do you have all the necessary includes/plugins? Check that.
Reply
#3

I have Whirlpool, streamer, sscanf, mysql.
And I have all the includes.
Reply
#4

anyone?
Reply
#5

Anyone else
Reply
#6

I found the error.
The line:

Код:
if(!dini_Exists(file))
is the problem
but when I edit this to:

Код:
if(dini_Exists(file))
it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)