SA-MP Forums Archive
[HELP] Can't write file (y_ini) - 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: [HELP] Can't write file (y_ini) (/showthread.php?tid=602640)



[SOLVED] Can't write file (y_ini) - martin3644 - 10.03.2016

Hello!

I have these testing commands for my server VIP system. These commands will be removed if I put my server online.
The problem with the first command is, that I can't write the timestamp to the users' file. If I type the command, then it says "Unknown command" and nothing else.
The second command is just for testing the variable. /freevip puts my variables right, but doesn't write the files.

Is there something wrong...or doesn't it work that way?
pawn Код:
if(strcmp(cmdtext, "/freevip", true) == 0)
{
        new PlayerFile[256]; PlayerFile = GetPlayerFile(playerid);
        new expire = gettime() + 30*24*60*60;
        Variables[playerid][pVIP] = 1;
        Variables[playerid][pVIPDate] = expire;
        new INI:PFile = INI_Open(PlayerFile);
        INI_WriteInt(PFile,"VIP",1);
        INI_WriteInt(PFile,"VIPDate", expire);
        INI_Close(PFile);
            SendCMDText(playerid,"VIP level 1 activated for 30 days!");
        return 1;
}
if(strcmp(cmdtext, "/vipdate", true) == 0)
{
        new GetVIPDate = Variables[playerid][pVIPDate];
        new string[256];
        format(string,256,"VIP Date: %d",GetVIPDate);
        SendCMDText(playerid,string);
        return 1;
}
Thank You!


Re: [HELP] Can't write file (y_ini) - saffierr - 10.03.2016

I really recommend you to use ZCMD + SSCANF as it is very OP and easy to use.
I bet if you use ZCMD your cmds are going to be easier to create!


Re: [HELP] Can't write file (y_ini) - martin3644 - 11.03.2016

Quote:
Originally Posted by saffierr
Посмотреть сообщение
I really recommend you to use ZCMD + SSCANF as it is very OP and easy to use.
I bet if you use ZCMD your cmds are going to be easier to create!
I am using ZCMD and SSCANF for my other commands. And that's not what I asked for, but thank you anyway.


- Sew_Sumi - 11.03.2016

The command failures are related to what he said... Heck knows why your Writeint issue is happening, but looking at the wiki could show something...

https://sampwiki.blast.hk/wiki/Gettime

Quote:

Get the current server time, which will be stored in the variables &hour, &minute and &second.

And paste up GetPlayerFile.