SA-MP Forums Archive
VIP Problem - 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 Problem (/showthread.php?tid=645910)



VIP Problem - EmpireSk - 06.12.2017

Hello .. I have a vip system in dini and I translated it into ini.
When I enter the command /setvip, I turn off the server and I'm still crashing the game

Original code:
PHP код:
dcmd_setvip(playeridparams[])
{
    new 
string[128];
    if(!
IsPlayerAdmin(playerid)) return SCM(playerid,WHITE ,"Pouze Hlavnн Administrбtor poihlбљenэ poez Rcon muћe nastavit VIP ъeet !");
    new 
ID,DEN,level;
    if(!
IsPlayerAdmin(playerid)) return SCM(playerid0xFFFFFFFF"Neisi admin !");
    if(
sscanf(params"iii"ID,level,DEN)) return SCM(playerid0xFFFFFFFF"/setvip [playerid] [level] [den]");
    if(!
IsPlayerConnected(ID)) return SCM(playerid0xFFFFFFFF"ID nieje online!");
    if(
level || level 3) return SCM(playeridWHITE"Zlэ level !");
    new 
DATE gettime()+mktime(0,0,0,DEN,0,0);
    new 
file[128];
    
format(file,sizeof(file),"VIP/%s.ini",Jmeno(ID));
    print(
file);
    if(
level 0)
    {
        if(
fexist(file)) return SCM(playeridWHITE"Tento hrбe uћ VIP level mб !");
        
format(stringsizeof(string), "Hlavnэ Administrбtor %s nastavil hrбeovy %s VIP ъeet do %s !"Jmeno(playerid),Jmeno(ID),date(DATE,1));
        if(
level == 1format(string128"Admin %s nastavil hrбeovy %s VIP {CD7F32}BRONZE{FF0000} ъeet do %s !",Jmeno(playerid),Jmeno(ID),date(DATE,1));
        else if(
level == 2format(string128"Admin %s nastavil hrбeovy %s VIP {C0C0C0}SILVER{FF0000} ъeet do %s !",Jmeno(playerid),Jmeno(ID),date(DATE,1));
        else if(
level == 3format(string128"Admin %s nastavil hrбeovy %s VIP {FFD700}GOLD{FF0000} ъeet do %s !",Jmeno(playerid),Jmeno(ID),date(DATE,1));
        
RemoveTime[playerid] = DATE;
        print(
"If the server now falls, problem is box (VIP)");
        
dini_Create(file);
        
dini_IntSet(file,"Time",DATE);
        
dini_IntSet(file,"VIP",level);
        
SCMTA(0xFF0000AAstring);
    }
    else if(
level == 0)
    {
        if(!
fexist(file)) return SCM(playeridWHITE"Tento hrбe nemб VIP level!");
        
format(stringsizeof(string), "Hlavnэ Administrбtor %s zobral hrбeovy %s VIP ъeet !"Jmeno(playerid),Jmeno(ID));
        
dini_Remove(file);
        
SCMTA(0xFF0000AAstring);
    }
    
vip[ID] = level;
    return 
true;

My code in ini:

PHP код:
CMD:setvip(playeridparams[])
{
    new 
string[128],ID,DEN;
    new 
vlvl;
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,WHITE ,"Pouze Hlavnн Administrбtor poihlбљenэ poez Rcon muћe nastavit VIP ъeet !");
    if(
sscanf(params"iii"ID,vlvl,DEN)) return SendClientMessage(playerid0xFFFFFFFF"/setvip [playerid] [level] [den]");
    if(!
IsPlayerConnected(ID)) return SendClientMessage(playerid0xFFFFFFFF"ID nieje online!");
    if(
vlvl || vlvl 3) return SendClientMessage(playeridWHITE"Zlэ level !");
    new 
DATE gettime()+mktime(0,0,0,DEN,0,0);
    new 
s[128];
    
format(s,sizeof(s),"VIP/%s.ini",Jmeno(ID));
    if(
vlvl 0)
    {
        if(
fexist(s)) return SendClientMessage(playeridWHITE"Tento hrбe uћ VIP level mб !");
        if(
vlvl == 1format(string128"Admin %s nastavil hrбeovy %s VIP {CD7F32}BRONZE{FF0000} ъeet do %s !",Jmeno(playerid),Jmeno(ID),date(DATE,1));
        else if(
vlvl == 2format(string128"Admin %s nastavil hrбeovy %s VIP {C0C0C0}SILVER{FF0000} ъeet do %s !",Jmeno(playerid),Jmeno(ID),date(DATE,1));
        else if(
vlvl == 3format(string128"Admin %s nastavil hrбeovy %s VIP {FFD700}GOLD{FF0000} ъeet do %s !",Jmeno(playerid),Jmeno(ID),date(DATE,1));
        
PlayerInfo[playerid][RemoveTime] = DATE;
        print(
"If the server now falls, problem is box (VIP)");
        new 
INI:File INI_Open(s);
        
INI_WriteInt(File,"Time",PlayerInfo[ID][VIP] = DATE);
        
INI_WriteInt(File,"VIP",PlayerInfo[ID][VIP] = vlvl);
        
INI_Close(File);
        
SendClientMessageToAll(0xFF0000AAstring);
    }
    else if(
vlvl == 0)
    {
        if(!
fexist(s)) return SendClientMessage(playeridWHITE"Tento hrбe nemб VIP level!");
        
format(stringsizeof(string), "Hlavnэ Administrбtor %s zobral hrбeovy %s VIP ъeet !"Jmeno(playerid),Jmeno(ID));
        
SendClientMessageToAll(0xFF0000AAstring);
        new 
INI:File INI_Open(s);
        
INI_WriteInt(File,"VIP",PlayerInfo[ID][VIP] = 0);
        
INI_Close(File);
    }
    
PlayerInfo[ID][VIP] = vlvl;
    return 
true;

My code text is language Slovak
Please help me..


Re: VIP Problem - Marllun - 06.12.2017

Did you create the vip folder?


Re: VIP Problem - EmpireSk - 06.12.2017

Quote:
Originally Posted by Marllun
Посмотреть сообщение
Did you create the vip folder?
Yes, I have a folder created
But the problem is that when I take a VIP to the player So he writes that the player still has a vip

According to DINI should be %s.ini deleted and but also in ini is not