Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Loading a string with y_ini

$
0
0
Ok i made this temp vip system which will give vip permission by months, example: Once the command is used by the admin it will count months so i can set you to vip for any amount of months anyways, i know ini cant save big intergers and i was on the samp forums and saw someone who had the same issue and a guy suggested that he save the time as and string instead of an integer and load it as a string.

I have some experiences in loading and saving strings because of my ban system i used and it all works but when i 'm trying to load the vip time as an string it doesn't work, instead i get some errors and warnings.

PHP Code:

//Loading the string
    
INI_String("VIPTIME"pInfo[playerid][VIPTIME],20);//line 2977

//Vip command
CMD:vip(playerid,params[])
{
      if(
IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= 7)
    {
          new 
id,months;
        if(
sscanf(params,"ud",id,months)) return SendClientMessage(playerid,COLOR_RED,"Usage: /setvip [playerid] [months]");
        if(
months>12) return SendClientMessage(playerid,COLOR_RED,"Months can not be greater than 12");
        if(
months<1) return SendClientMessage(playerid,COLOR_RED,"Months can not be 0 or less than 0");
        if(
id==INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"That player is not online");
        if(
pInfo[id][VIP]==1) return SendClientMessage(playerid,COLOR_RED,"This player is already VIP!");
        new 
str[128];
        
format(str,sizeof(str),"You have recieved VIP for %d months.",months);
        
SendClientMessage(id,COLOR_RED,str);
        
format(str,sizeof(str),"Enjoy ~g~%d Month VIP!",months);
        
GameTextForPlayer(id,str,3000,5);
        
SendClientMessage(id,COLOR_RED,"Type /vcmds for the list of VIP commands.");
        
format(str,sizeof(str),"You have given %s a VIP package for %d months subscription.",GetName(id),months);
        
SendClientMessage(playerid,COLOR_RED,str);

//this is the part in question
        
new vtime gettime()+60*60*24*30*months;
         new 
INI:File INI_Open(UserPath(id));
        
INI_SetTag(File,"data");
         
INI_WriteString(File,"VIPTIME",vtime);
            
INI_WriteInt(File,"VIP"1);
        
INI_Close(File);
    }
    else return 
ShowMessage(playeriderror1);
    return 
1;


errors
Code:

./comps/callbacks.pwn(2977) : error 001: expected token: ")", but found "["
./comps/callbacks.pwn(2977) : warning 215: expression has no effect
./comps/callbacks.pwn(2977) : error 001: expected token: ";", but found "]"
./comps/callbacks.pwn(2977) : error 029: invalid expression, assumed zero
./comps/callbacks.pwn(2977) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664                          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>