Level won't saved
#1

Hello,

i am creating VIP System.

In VIP System Level won't saved. other wise name and IP save , only level won't save.



Код:
dcmd_setvip(playerid, params[])
{
    new file[100];
 	format(file,sizeof(file),PlayerFile,PlayerInfo[playerid][pName]);
    new string[128],string2[128];
	new giveplayerid, level[MAX_PLAYERS];
	new playername[MAX_PLAYER_NAME],idname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
	GetPlayerName(playerid,idname,MAX_PLAYER_NAME);
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Have To Be Rcon Admin To Use This Command!");
	if(sscanf(params, "ud", giveplayerid, level[playerid]))return SendClientMessage(playerid, COLOR_RED, "Usage: /setvip [Playerid/Partname] [Level]");
	else if (giveplayerid == INVALID_PLAYER_ID)return SendClientMessage(playerid, COLOR_RED, "Player Is Not Connected");
 	else if (level[playerid] > 3)return SendClientMessage(playerid, COLOR_RED, "Maximum Vip Level Is : 3");
    else
	{
  		PlayerInfo[giveplayerid][VIP] = level[playerid];
		format(string,sizeof(string),"Administrator %s Set Your Vip Level To %d",playername,level[playerid]);
		SendClientMessage(giveplayerid,COLOR_YELLOW,string);
		format(string2,sizeof(string2),"%s Vip Level Is Now %d",idname,level[playerid]);
		SendClientMessageToAll(COLOR_YELLOW,string2);
		dini_IntSet(file,"Vip_Level",PlayerInfo[playerid][VIP]);
	}
	return 1;
}

public OnPlayerConnect(playerid)
{
 		new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);
		if(!dini_Exists(file)) {
		dini_Create(file);
		dini_Set(file,"Name",Name);
		dini_Set(file,"Ip",Ip);
		dini_IntSet(file,"Vip_Level",0);
	}
	PlayerInfo[playerid][VIP] = dini_Int(file,"Vip_Level");
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new file[100];
 	format(file,sizeof(file),PlayerFile,PlayerInfo[playerid][pName]);
	dini_Set(file,"Name",PlayerInfo[playerid][pName]);
	dini_Set(file,"Ip",PlayerInfo[playerid][ip]);
	dini_IntSet(file,"Vip_Level",PlayerInfo[playerid][VIP]);
	PlayerInfo[playerid][VIP]  = 0;
	return 1;
}
please answer , i am missing something in script ?
Reply
#2

Quote:

public OnPlayerDisconnect(playerid, reason)
{
...
dini_IntSet(file,"Vip_Level",PlayerInfo[playerid][VIP]);
PlayerInfo[playerid][VIP] = 0;
...
}

For what?
Reply
#3

Try to delete these values

Quote:

public OnPlayerDisconnect(playerid, reason)
{
...
dini_IntSet(file,"Vip_Level",PlayerInfo[playerid][VIP]);
PlayerInfo[playerid][VIP] = 0;

...
}

Reply
#4

pawn Код:
{
        PlayerInfo[giveplayerid][VIP] = level[playerid];
        format(string,sizeof(string),"Administrator %s Set Your Vip Level To %d",playername,level[playerid]);
        SendClientMessage(giveplayerid,COLOR_YELLOW,string);
        format(string2,sizeof(string2),"%s Vip Level Is Now %d",idname,level[playerid]);
        SendClientMessageToAll(COLOR_YELLOW,string2);
        dini_IntSet(file,"Vip_Level",PlayerInfo[playerid][VIP]);
    }
Код:
		dini_IntSet(file,"Vip_Level",PlayerInfo[playerid][VIP]);
change to
Код:
		dini_IntSet(file,"Vip_Level",level[playerid]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)