Vip system
#1

I made this vip system but it wont save the day and the vip level, this is my coding that i made. Its not saving when it should do.

PHP код:
CMD:setvip(playeridparams[])
{
    new
        
string[200],
        
id,
        
level,
        
days
    
;
    if(
IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= 7)
     {
        if(
sscanf(params"uii"idleveldays)) return SendClientMessage(playerid,error"Usage: /setvip [playerid] [level(0/3)] [days]");
        if(
id == INVALID_PLAYER_ID) return SendClientMessage(playeriderror"Error: Player is not connected.");
        if(
level || level 3) return SendClientMessage(playeriderror"Max 3 - Min 1.");
        if(
level == pInfo[id][VIP]) return SendClientMessage(playeriderror"Player is already that VIP level.");
        if(
Logged[playerid] == 0) return SendClientMessage(playeriderror"Player not logged in.");
        if(
level != 0)
        {
            if(
days || days 364) return SendClientMessage(playerid,error"Min Exp 1 - Max Exp 364 .");
        }
        if(
level >= 1)
        {
            
pInfo[id][ExpVIP] = gettime() + 60*60*24*days;
               
pInfo[id][VIP] = level;
        
SaveChar(id);
            
format(string128"[AdmCmd]: {FF6347} An Administrator has set your vip level to %d for %d days.",leveldays);
            
SendClientMessage(idredstring);
            
format(string128"You have set %s vip level to %d for %d days."GetName(id),leveldays);
            
SendClientMessage(playeridjbluestring);
            return 
1;
        }
        else if(
level == 0)
        {
            
days 0;
            
pInfo[id][ExpVIP] = 0;
    
pInfo[id][VIP] = 0;
        
SaveChar(id);
    
        
format(string128"[AdmCmd]: {FF6347} An Administrator has removed your Vip Package.");
            
SendClientMessage(idredstring);
            
format(string128"You have removed %s VIP package."GetName(id));
            
SendClientMessage(playeridjbluestring);
            return 
1;
        }
    }
    else
    {
        
SendClientMessage(playeriderror"You are not authorized to use this command.");
    }
    return 
1;
}
//under savechar forward
    
INI_WriteInt(ACCOUNT"VIP",pInfo[playerid][VIP]);
    
INI_WriteInt(ACCOUNT"ExpVIP",pInfo[playerid][ExpVIP]);
//under loadchar forward
    
INI_Int("VIP"pInfo[playerid][VIP]);
       
INI_Int("ExpVIP",pInfo[playerid][ExpVIP]); 
Reply
#2

bump
Reply
#3

Код:
CMD:setvip(playerid, params[]) 
{ 
    new string[200], id, level, days, fxVip; 
    if(IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= 7) 
	{ 
        if(sscanf(params, "uii", id, level, days)) return SendClientMessage(playerid,error, "Usage: /setvip [playerid] [level(0/3)] [days]"); 
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, error, "Error: Player is not connected."); 
        if(level < 0 || level > 3) return SendClientMessage(playerid, error, "Max 3 - Min 1."); 
        if(level == pInfo[id][VIP]) return SendClientMessage(playerid, error, "Player is already that VIP level."); 
        if(Logged[playerid] == 0) return SendClientMessage(playerid, error, "Player not logged in."); 
        if(days < 1 || days > 364) return SendClientMessage(playerid,error, "Min Exp 1 - Max Exp 364 ."); 
		if(level == 0) 
        { 
            pInfo[id][ExpVIP] = 0; 
			pInfo[id][VIP] = 0; 
			SaveChar(id); 
			format(string, 128, "[AdmCmd]: {FF6347} An Administrator has removed your Vip Package."); 
            SendClientMessage(id, red, string); 
            format(string, 128, "You have removed %s VIP package.", GetName(id)); 
            SendClientMessage(playerid, jblue, string); 
            return 1; 
        }
		fxVip = gettime() + days * 86400;
        pInfo[id][ExpVIP] = fxVip; 
        pInfo[id][VIP] = level; 
        SaveChar(id); 
		format(string, 128, "[AdmCmd]: {FF6347} An Administrator has set your vip level to %d for %d days.",level, days); 
		SendClientMessage(id, red, string); 
		format(string, 128, "You have set %s vip level to %d for %d days.", GetName(id),level, days); 
		SendClientMessage(playerid, jblue, string); 
    }
    else 
    { 
        SendClientMessage(playerid, error, "You are not authorized to use this command."); 
    }
    return 1; 
} 
//under savechar forward 
    INI_WriteInt(ACCOUNT, "VIP",pInfo[playerid][VIP]); 
    INI_WriteInt(ACCOUNT, "ExpVIP",pInfo[playerid][ExpVIP]); 
//under loadchar forward 
    INI_Int("VIP", pInfo[playerid][VIP]); 
       INI_Int("ExpVIP",pInfo[playerid][ExpVIP]);
Reply
#4

Quote:
Originally Posted by sampkinq
Посмотреть сообщение
Код:
CMD:setvip(playerid, params[]) 
{ 
    new string[200], id, level, days, fxVip; 
    if(IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= 7) 
	{ 
        if(sscanf(params, "uii", id, level, days)) return SendClientMessage(playerid,error, "Usage: /setvip [playerid] [level(0/3)] [days]"); 
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, error, "Error: Player is not connected."); 
        if(level < 0 || level > 3) return SendClientMessage(playerid, error, "Max 3 - Min 1."); 
        if(level == pInfo[id][VIP]) return SendClientMessage(playerid, error, "Player is already that VIP level."); 
        if(Logged[playerid] == 0) return SendClientMessage(playerid, error, "Player not logged in."); 
        if(days < 1 || days > 364) return SendClientMessage(playerid,error, "Min Exp 1 - Max Exp 364 ."); 
		if(level == 0) 
        { 
            pInfo[id][ExpVIP] = 0; 
			pInfo[id][VIP] = 0; 
			SaveChar(id); 
			format(string, 128, "[AdmCmd]: {FF6347} An Administrator has removed your Vip Package."); 
            SendClientMessage(id, red, string); 
            format(string, 128, "You have removed %s VIP package.", GetName(id)); 
            SendClientMessage(playerid, jblue, string); 
            return 1; 
        }
		fxVip = gettime() + days * 86400;
        pInfo[id][ExpVIP] = fxVip; 
        pInfo[id][VIP] = level; 
        SaveChar(id); 
		format(string, 128, "[AdmCmd]: {FF6347} An Administrator has set your vip level to %d for %d days.",level, days); 
		SendClientMessage(id, red, string); 
		format(string, 128, "You have set %s vip level to %d for %d days.", GetName(id),level, days); 
		SendClientMessage(playerid, jblue, string); 
    }
    else 
    { 
        SendClientMessage(playerid, error, "You are not authorized to use this command."); 
    }
    return 1; 
} 
//under savechar forward 
    INI_WriteInt(ACCOUNT, "VIP",pInfo[playerid][VIP]); 
    INI_WriteInt(ACCOUNT, "ExpVIP",pInfo[playerid][ExpVIP]); 
//under loadchar forward 
    INI_Int("VIP", pInfo[playerid][VIP]); 
       INI_Int("ExpVIP",pInfo[playerid][ExpVIP]);
Crashes the server whenever i used it and it doesn't show message saying that an admin has set etc etc
Reply
#5

Show your SaveChar and LoadChar forwards..
Reply
#6

PHP код:
//under savechar forward 
    
INI_WriteInt(ACCOUNT"VIP",pInfo[playerid][VIP]); 
    
INI_WriteInt(ACCOUNT"ExpVIP",pInfo[playerid][ExpVIP]); 
//under loadchar forward 
    
INI_Int("VIP"pInfo[playerid][VIP]); 
       
INI_Int("ExpVIP",pInfo[playerid][ExpVIP]); 
Reply
#7

Bump
Reply
#8

How is ACCOUNT defined?
Reply
#9

I suggest you could maybe save the days in the ini of the player as i cant see that u saved it somewhere..
Reply
#10

@ jason This is the coding i use to calculate the days and then set them to ExpVIP
PHP код:
pInfo[id][ExpVIP] = gettime() + 60*60*24*days
@Hunter
I dont think the issue is with that since all other codings i have are save and loaded successfully... When ever i use the command it bugs the
PHP код:
savechar(playerid); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)