I got a porblem with a functioon i made (GetMonth) - 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: I got a porblem with a functioon i made (GetMonth) (
/showthread.php?tid=225016)
I got a porblem with a functioon i made (GetMonth) - Unknown123 - 12.02.2011
GetMonth() is assumed as nothing
pawn Код:
stock GetMonth()
{
new monthname[20], Month;
switch(Month)
{
case 1: monthname = "January";
case 2: monthname = "February";
case 3: monthname = "March";
case 4: monthname = "April";
case 5: monthname = "May";
case 6: monthname = "June";
case 7: monthname = "July";
case 8: monthname = "August";
case 9: monthname = "September";
case 10: monthname = "October";
case 11: monthname = "November";
case 12: monthname = "December";
}
return Month;
}
pawn Код:
//...............
format(string, sizeof(string), "%s", GetMonth());
Re: I got a porblem with a functioon i made (GetMonth) -
iggy1 - 12.02.2011
Thats because you haven't assigned a value to "month" so the case is '0' which doesn't exist.
Re: I got a porblem with a functioon i made (GetMonth) -
Antonio [G-RP] - 12.02.2011
^^
Instead of return Month;
return monthname;
Re: I got a porblem with a functioon i made (GetMonth) -
iggy1 - 12.02.2011
Try this
pawn Код:
stock GetMonth()
{
new
monthname[10],
Year, Month, Day;
getdate(Year, Month, Day);
switch(Month)
{
case 1: monthname = "January";
case 2: monthname = "February";
case 3: monthname = "March";
case 4: monthname = "April";
case 5: monthname = "May";
case 6: monthname = "June";
case 7: monthname = "July";
case 8: monthname = "August";
case 9: monthname = "September";
case 10: monthname = "October";
case 11: monthname = "November";
case 12: monthname = "December";
}
return monthname;
}
Re: I got a porblem with a functioon i made (GetMonth) -
jameskmonger - 12.02.2011
No try this;
pawn Код:
stock GetMonth(month)
{
* * new monthname[20];
* * switch(Month)
* * {
* * * * case 1: *monthname = "January";
* * * * case 2: *monthname = "February";
* * * * case 3: *monthname = "March";
* * * * case 4: *monthname = "April";
* * * * case 5: *monthname = "May";
* * * * case 6: *monthname = "June";
* * * * case 7: *monthname = "July";
* * * * case 8: *monthname = "August";
* * * * case 9: *monthname = "September";
* * * * case 10: monthname = "October";
* * * * case 11: monthname = "November";
* * * * case 12: monthname = "December";
default: monthname = 'invalid month'; *
}
* * return monthname;
}
Re: I got a porblem with a functioon i made (GetMonth) -
iggy1 - 12.02.2011
Quote:
Originally Posted by jameskmonger
No try this;
pawn Код:
stock GetMonth(month) { * * new monthname[20]; * * switch(Month) * * { * * * * case 1: *monthname = "January"; * * * * case 2: *monthname = "February"; * * * * case 3: *monthname = "March"; * * * * case 4: *monthname = "April"; * * * * case 5: *monthname = "May"; * * * * case 6: *monthname = "June"; * * * * case 7: *monthname = "July"; * * * * case 8: *monthname = "August"; * * * * case 9: *monthname = "September"; * * * * case 10: monthname = "October"; * * * * case 11: monthname = "November"; * * * * case 12: monthname = "December"; default: monthname = 'invalid month'; * } * * return monthname; }
|
No, by the looks of it he is not passing month as a param. So you would need to get the date.
Re: I got a porblem with a functioon i made (GetMonth) - Unknown123 - 12.02.2011
The Thanks go to "iggi1"
and @ jameskmonger, Sup with the stars? (*)
Re: I got a porblem with a functioon i made (GetMonth) -
jameskmonger - 12.02.2011
I don't know about the *s, blame my BlackBerry!