SA-MP Forums Archive
vip don't save - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: vip don't save (/showthread.php?tid=582442)



vip don't save - RedRo - 20.07.2015

http://pastebin.com/bfUMhDex
i have this plugin.
i give vip to player and after i restart server, vip don t save..


Re: vip don't save - Moudix - 20.07.2015

Create a folder in scriptfiles called "Users".


Re: vip don't save - Mariciuc223 - 20.07.2015

Код HTML:
public OnPlayerConnect(playerid)
{
    new string[200];
        format(string, sizeof(string), " Welcome Back %s  Your Vip Level is: %d", PlayerName(playerid), Vip[playerid] );
        SendClientMessage(playerid ,COLOR_RED, string);
    tune[playerid] = 0;
    asked1[playerid] = 0;
        asked[playerid] = 0;
        ship[playerid] = 0;
        SendClientMessage(playerid,-1,"RPG.KRONDZ.COM");
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"VIP",0);
    INI_Close(File);
    return 1;
}
Replace in

Код HTML:
public OnPlayerConnect(playerid)
{
    new string[128];
    
    format(string, sizeof(string), " Welcome Back %s  Your Vip Level is: %d", PlayerName(playerid), Vip[playerid]);
    SendClientMessage(playerid ,COLOR_RED, string);

    tune[playerid] = 0;
    asked1[playerid] = 0;
    asked[playerid] = 0;
    ship[playerid] = 0;

    SendClientMessage(playerid,-1,"RPG.KRONDZ.COM");

    if(!fexist(UserPath(playerid))
    {
        new INI:File = INI_Open(UserPath(playerid));
        INI_SetTag(File,"data");

        INI_WriteInt(File, "VIP", 0);
        INI_Close(File);
    }
    else INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
 	
    return 1;
}



Re: vip don't save - JaydenJason - 20.07.2015

You can't directly check a player his VIP level once he connects, if I'm correct it keeps showing that the player has vip level 0 when he connects, right?

Try this;

Код:
// along with all other variables;
new vipchecker[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
	vipchecker[playerid] = -1;
	vipchecker[playerid] = SetTimerEx("VipCheckMessage", 2000, false, "i", playerid);
	if(!fexist(UserPath(playerid))
	{
		new INI:File = INI_Open(UserPath(playerid));
		INI_SetTag(File,"data");
		
		INI_WriteInt(File, "VIP", 0);
		INI_Close(File);
	}
	else INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
		
	return 1;
}

forward VipCheckMessge(playerid); public VipCheckMessage(playerid)
{
	if(IsPlayerConnected(playerid) && Vip[playerid] > 0)
	{
		new string[90];
		format(string, sizeof(string), " Welcome back, %s. Your V.I.P. level is: %d", PlayerName(playerid), Vip[playerid]);
		SendClientMessage(playerid ,COLOR_RED, string);
	}
	else return 1;
	return 1;
}