VIP system won't save data
#1

So, I've found this VIP system filterscript, and I tested it out using it on my IP address. But if I use it on a hosting company through WinSCP the data wouldn't save when I set someones VIP level. What's the problem ?
Reply
#2

Actually I think it doesn't load data neither, but I don't understand why this happens only when I am using a host.
Reply
#3

Check the script line per line. Does the script even have a line where it actually saves the data in a file?
Reply
#4

Did you forgot to create the file where the script can save the data? This may be why.
Reply
#5

Do you have it saved on when player disconnects?Check your enums and let us know more.
Reply
#6

This is how the public OnPlayerConnect and OnPlayerDisconnect looks like

Код:
public OnPlayerConnect(playerid)
{
	PlayerInfo[playerid][pVIP] = 0; //Setting the VIP level 0 on player connect-
	Enablevheal[playerid] = 1; //Enabling the /vheal command on player connect--
	Enablevbonus[playerid] = 1; //Enabling the /vbonus command on player connect
	HasSpawnedCar[playerid] = 0;//-Setting the value to 0
	//-------------Checking and creating the player account in database---------
	if(fexist(getACC(playerid)))
	{
	   new string[256];
	   INI_Open(getACC(playerid));
	   PlayerInfo[playerid][pVIP] = INI_ReadInt("Level");
       format(string, sizeof(string),"Welcome %s Your VIP level has been successfully loaded [VIP Level: %d][VIP Rank: %s]",PlayerName(playerid),PlayerInfo[playerid][pVIP],Rank(playerid));
       print("\n----------------------------------------------------------");
       printf("_____[%s] Very Important Player Connected_____", PlayerName(playerid));
	   print("------------------------------------------------------------\n");
	   SendClientMessage(playerid, GREEN,string);
	}
    else
    {
	   MakeACC(playerid); //Creating the account if the account doesn't exists
	}
	return 1;
}
//Saving PLayer Stats on his disconnect=========================================
public OnPlayerDisconnect(playerid, reason)
{
	SaveLevel(playerid);
	return 1;
}
Here are some stocks:

Код:
//=============================STOCKS===========================================
stock PlayerName(playerid) 
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
//===================Account====================================================
stock getACC(playerid)
{
    new file[200];
    format(file, sizeof(file),"VIP/%s.ini",PlayerName(playerid));
    return file;
}
//============Vip Ranks Can be editted==========================================
stock Rank(playerid)
{
    new str[156];
    if(PlayerInfo[playerid][pVIP] == 0) str = ("Player");
    else if(PlayerInfo[playerid][pVIP] == 1) str = ("Donator Level 1");
    else if(PlayerInfo[playerid][pVIP] == 2) str = ("Donator Level 2");
    else if(PlayerInfo[playerid][pVIP] == 3) str = ("Donator Level 3");
    return str;
}
//=====================Creating the account=====================================
stock MakeACC(playerid)
{
   if(!fexist(getACC(playerid)))
   {
      new string[125];
	  format(string, sizeof(string),"%s",Rank(playerid));
      INI_Open(getACC(playerid));
      INI_WriteInt("Level",0);
      INI_WriteString("Rank",string);
      INI_Save();
      INI_Close();
      PlayerInfo[playerid][pVIP] = 0;
  }
  return 1;
}
//===========Saving the VIP level===============================================
stock SaveLevel(playerid)
{
   INI_Open(getACC(playerid));
   INI_WriteInt("Level",PlayerInfo[playerid][pVIP]);
   INI_WriteString("Rank",Rank(playerid));
   INI_Save();
   INI_Close();
   SendClientMessage(playerid, LIGHTGREEN,"VIP Level saved in accounts!");
   return 1;
}
Reply


Forum Jump:


Users browsing this thread: