SA-MP Forums Archive
Whats wrong ? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats wrong ? (/showthread.php?tid=270268)



Whats wrong ? - Saurik - 19.07.2011

Hey so i am getting this error

Код:
: error 022: must be lvalue (non-constant)
The line
Код:
Date = GetDate();
GetDate();
Код:
stock GetDate()
{
   new String[64];

   new t1, t2, t3, d1, d2, d3;

   format(String, sizeof(String), "%02d/%02d/%02d %02d:%02d:%02d", t3, t2, t1, d1, d2, d3);

   return String;
}



Re: Whats wrong ? - Jay. - 19.07.2011

Quote:
Originally Posted by Saurik
Посмотреть сообщение
Hey so i am getting this error

Код:
: error 022: must be lvalue (non-constant)
The line
Код:
Date = GetDate();
GetDate();
Код:
stock GetDate()
{
   new String[64];

   new t1, t2, t3, d1, d2, d3;

   format(String, sizeof(String), "%02d/%02d/%02d %02d:%02d:%02d", t3, t2, t1, d1, d2, d3);

   return String;
}
I'm really not sure but isn't "GetDate"

Getdate

No capital for second word?


Respuesta: Whats wrong ? - Code8976Man - 19.07.2011

pawn Код:
new Date[64];

Date = GetDate();
Works fine for me.

Quote:
Originally Posted by Jay.
Посмотреть сообщение
I'm really not sure but isn't "GetDate"

Getdate

No capital for second word?
Isn't getdate(...), he created another func.


Re: Whats wrong ? - XGh0stz - 19.07.2011

Date is a Int, but GetDate() is returning a string...
Therefore you need to use: new Date[64];
Then format the Date String using the GetDate Function

(Guess someone beat me to it, but still needs to formatted, Date = GetDate simply won't work)


Re: Whats wrong ? - Saurik - 19.07.2011

I already used new date [64];

i have that


@ jay no


Re: Whats wrong ? - Toni - 19.07.2011

It seemed to work for me when I added a string array to the end of date.

pawn Код:
new date[64];
date = GetDate();

stock GetDate()
{
   new String[64];

   new t1, t2, t3, d1, d2, d3;

   format(String, sizeof(String), "%02d/%02d/%02d %02d:%02d:%02d", t3, t2, t1, d1, d2, d3);

   return String;
}



Re: Whats wrong ? - Amit_B - 19.07.2011

pawn Код:
new date[64];
format(date,sizeof(date),GetDate());



Re: Whats wrong ? - XGh0stz - 19.07.2011

Quote:
Originally Posted by Toni
Посмотреть сообщение
It seemed to work for me when I added a string array to the end of date.

pawn Код:
new date[64];
date = GetDate();

stock GetDate()
{
   new String[64];

   new t1, t2, t3, d1, d2, d3;

   format(String, sizeof(String), "%02d/%02d/%02d %02d:%02d:%02d", t3, t2, t1, d1, d2, d3);

   return String;
}
My apologizes, that might work
Код:
Date = GetDate();



Re: Whats wrong ? - Saurik - 19.07.2011

Quote:
Originally Posted by Amit_B
Посмотреть сообщение
pawn Код:
new date[64];
format(date,sizeof(date),GetDate());
error 035: argument type mismatch (argument 1)


Re: Whats wrong ? - Amit_B - 19.07.2011

Quote:
Originally Posted by Saurik
Посмотреть сообщение
error 035: argument type mismatch (argument 1)
><
try to replace the variable name from "date" to "datestring"
if it isn't works, try to replace its size to 65