forward GiveVIPTime(playerid); forward CheckVIPTime(playerid); public GiveVIPTime(playerid) //use when he gets vip { new hour, minute, second, day,month,year; new PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); new string[128]; format(string, sizeof(string), "%s", PlayerName); mktime(hour,minute,second,day,month,year); dini_Set("viptime.ini", string, month); return 1; } public CheckVIPTime(playerid) { new hour, minute, second, day,month,year; new PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); new string[128]; format(string, sizeof(string), "%s", PlayerName); new result[64]; result = dini_Get("viptime.ini", string); mktime(hour,minute,second,day,month,year); if(strcmp(result, month, true) != 0) { dini_Unset("viptime.ini", string); //vip time ran out } return 1; } public OnPlayerConnect(playerid) { CheckVIPTime(playerid); return 1; } stock mktime(hour,minute,second,day,month,year) { new timestamp2; timestamp2 = second + (minute * 60) + (hour * 3600); new days_of_month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) { days_of_month[1] = 29; // Schaltjahr } else { days_of_month[1] = 28; // keins } new days_this_year = 0; days_this_year = --day; if(month > 1) { // No January Calculation, because its always the 0 past months for(new i=0; i<month-1;i++) { days_this_year += days_of_month[i]; } } timestamp2 += days_this_year * 86400; for(new j=1970;j<year;j++) { timestamp2 += 31536000; if ( ((j % 4 == 0) && (j % 100 != 0)) || (j % 400 == 0) ) timestamp2 += 86400; // Schaltjahr + 1 Tag } return timestamp2; }
Originally Posted by ("GгNSTг")
Why can't u just remove it urself saves time :P
|
Originally Posted by lolumadd [cod5server.tk
]
Create a file named viptime.ini inside the scriptfiles folder then copy this code: BTW: This may not be an efficient way; just the first thing that came to my head :P Код:
forward GiveVIPTime(playerid); forward CheckVIPTime(playerid); public GiveVIPTime(playerid) //use when he gets vip { new hour, minute, second, day,month,year; new PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); new string[128]; format(string, sizeof(string), "%s", PlayerName); mktime(hour,minute,second,day,month,year); dini_Set("viptime.ini", string, month); return 1; } public CheckVIPTime(playerid) { new hour, minute, second, day,month,year; new PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); new string[128]; format(string, sizeof(string), "%s", PlayerName); new result[64]; result = dini_Get("viptime.ini", string); mktime(hour,minute,second,day,month,year); if(strcmp(result, month, true) != 0) { dini_Unset("viptime.ini", string); //vip time ran out } return 1; } public OnPlayerConnect(playerid) { CheckVIPTime(playerid); return 1; } stock mktime(hour,minute,second,day,month,year) { new timestamp2; timestamp2 = second + (minute * 60) + (hour * 3600); new days_of_month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) { days_of_month[1] = 29; // Schaltjahr } else { days_of_month[1] = 28; // keins } new days_this_year = 0; days_this_year = --day; if(month > 1) { // No January Calculation, because its always the 0 past months for(new i=0; i<month-1;i++) { days_this_year += days_of_month[i]; } } timestamp2 += days_this_year * 86400; for(new j=1970;j<year;j++) { timestamp2 += 31536000; if ( ((j % 4 == 0) && (j % 100 != 0)) || (j % 400 == 0) ) timestamp2 += 86400; // Schaltjahr + 1 Tag } return timestamp2; } Quote:
|
C:\Dokumente und Einstellungen\Dani\Desktop\GU\Server\sa-mp\GUDM\gamemodes\GUDM.pwn(6636) : error 035: argument type mismatch (argument 3) C:\Dokumente und Einstellungen\Dani\Desktop\GU\Server\sa-mp\GUDM\gamemodes\GUDM.pwn(6648) : error 047: array sizes do not match, or destination array is too small C:\Dokumente und Einstellungen\Dani\Desktop\GU\Server\sa-mp\GUDM\gamemodes\GUDM.pwn(6650) : error 035: argument type mismatch (argument 2) C:\Dokumente und Einstellungen\Dani\Desktop\GU\Server\sa-mp\GUDM\gamemodes\GUDM.pwn(6659) : error 021: symbol already defined: "mktime"
Line 6636 dini_Set("viptime.ini", string, month);
Line 6648 result = dini_Get("viptime.ini", string);
Line 6650 mktime(hour,minute,second,day,month,year);
Line 6659 stock mktime(hour,minute,second,day,month,year) {
dini_Set to dini_IntSet
dini_Get to dini_Int
new result[64]; to new result;
Originally Posted by lolumadd [cod5server.tk
]
Change: Код:
dini_Set to dini_IntSet Код:
dini_Get to dini_Int Код:
new result[64]; to new result; |
if(strcmp(result, month, true) != 0)
if(result != month)
Name: 0
new year, month, day; getdate(year, month, day);
forward GiveVIPTime(playerid); forward CheckVIPTime(playerid); public GiveVIPTime(playerid) //use when he gets vip { new year, month, day; new PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); new string[128]; format(string, sizeof(string), "%s", PlayerName); getdate(year, month, day); dini_IntSet("viptime.ini", string, month); return 1; } public CheckVIPTime(playerid) { new year, month, day; new PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); new string[128]; format(string, sizeof(string), "%s", PlayerName); new result; result = dini_Int("viptime.ini", string); getdate(year, month, day); if(result != month) { dini_Unset("viptime.ini", string); //vip time ran out } return 1; } public OnPlayerConnect(playerid) { CheckVIPTime(playerid); return 1; }