SA-MP Forums Archive
Dini and array - 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: Dini and array (/showthread.php?tid=435253)



Dini and array - dominik523 - 06.05.2013

Hey! I have a job drug smuggler and I want to create that after you are done with your work, you wil have to wait 2 minutes to do it again, and time will be saved in your account. This is part of my command:
Код:
enum
        pinfo
{
   pSmugglerWait
}

if( (gettime()- pSmugglerWait[playerid]) > 120 )    // error here
	{
                .
                . 
                .
                pSmugglerWait[playerid] = gettime();
        }
And after I try to compile, I get this error:
invalid subscript (not an array or too many subscripts): "pSmugglerWait"
So I guess my variable pSmugglerWait has to be array, I know how to create it buy I dont know how to set so array will be saved to user account using dini. Please help me.


Re: Dini and array - RajatPawar - 06.05.2013

pawn Код:
enum
        pinfo
{
   pSmugglerWait
}
new playerINFO[MAX_PLAYERS][pinfo];
if( (gettime()- playerINFO[playerid][pSmugglerWait]) > 120 )    // error here
    {
                .
                .
                .
                playerINFO[playerid][pSmugglerWait] = gettime();
        }
I am comfortable using named enums, so try this?
Now you can just write dini_writeINT to write into the files, since it's just an integer.


Re: Dini and array - dominik523 - 06.05.2013

nice, thank you Rajat