Date not working - 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: Date not working (
/showthread.php?tid=428340)
Date not working -
MichaelWharton101 - 05.04.2013
So I have two problems, both have to do with dates but not working correctly.
First part, This is what should show the day/month of the day/month.
Код:
// Calculating
new Month, Day;
getdate(Month, Day);
{
new ActualDay;
PlayerInfo[playerb][pIDay] = ActualDay;
PlayerInfo[playerb][pIMonth] = Month;
PlayerInfo[playerb][pIDay] = Day;
PlayerInfo[playerb][pIMonth] = Month;
}
code of line i use.
Код:
format(string, sizeof(string), "%s's statistics on American Roleplay - [%d/%d/2013]", RPN(playerb), PlayerInfo[playerid][pIMonth], PlayerInfo[playerid][pIDay]);
SendClientMessage(playerid, COLOR_ORANGE, string);
What i see
Now the second part.
This should get the date then add how many days of VIP they have.
Код:
// Calculating
new Year, Month, Day;
new Hour, Minute, Second;
gettime(Hour, Minute, Second);
getdate(Year, Month, Day);
if(Day+viptime >= 30)
{
new ActualDay;
Month ++;
ActualDay = viptime - (30-Day);
PlayerInfo[playerb][pVIPDay] = ActualDay;
PlayerInfo[playerb][pVIPMonth] = Month;
PlayerInfo[playerb][pVIPHour] = Hour;
}
else
{
PlayerInfo[playerb][pVIPDay] = Day+viptime;
PlayerInfo[playerb][pVIPMonth] = Month;
PlayerInfo[playerb][pVIPHour] = Hour;
}
Where this is being used.
[code] if(PlayerInfo[playerid][pVIP]) format(string, sizeof(string), "VIP Expiration: %d/%d/2013", PlayerInfo[playerid][pVIPMonth], PlayerInfo[playerid][pVIPDay]);
SendClientMessage(playerid, COLOR_VIP, string);[/calc]
What I see.
Please help me ASAP
Re: Date not working -
MichaelWharton101 - 05.04.2013
Anyone
Re: Date not working -
L.Hudson - 05.04.2013
I think you put the getdate wrong since it's
pawn Код:
gettdate(year, month, day)
Re: Date not working -
MichaelWharton101 - 05.04.2013
Did not help me
Re: Date not working -
L.Hudson - 05.04.2013
Like this
pawn Код:
new Year, Month, Day;
getdate(Year, Month, Day);
{
new ActualDay;
PlayerInfo[playerb][pIDay] = ActualDay;
PlayerInfo[playerb][pIMonth] = Month;
PlayerInfo[playerb][pIDay] = Day;
PlayerInfo[playerb][pIMonth] = Month;
PlayerInfo[playerb][pYear] = Year; // Add this enum
}
pawn Код:
format(string, sizeof(string), "%s's statistics on American Roleplay - [%d/%d/%d]", RPN(playerb), PlayerInfo[playerid][pIMonth], PlayerInfo[playerid][pIDay], PlayerInfo[playerid][pYear]);
SendClientMessage(playerid, COLOR_ORANGE, string);