19.07.2017, 15:34
Greedings,i have got a few problems what i need to solve...So
At first .. One message didnt show..
Code:
And the second problem is my timeban command...For example i gave timeban to a player on 1 hour at 9:00,
but it wrote ban will end at 8 o'clock..So i have got bug in time..
There is a code..
Mainly you must excuse me for my English its very bad:
I hope you can understand me,and help me..Thank you for your helps.
At first .. One message didnt show..
Code:
PHP код:
new cesta[16+15];
format(cesta,sizeof(cesta),"Banneds/%s.ini",PlayerIP(playerid));
new strr[270];
if(IsBanned(playerid) == 3)
{
format(strr,sizeof(strr),"{FFFFFF}Meno hrбča: {FF0000}%s\n{FFFFFF}Od kedy: {FF0000}%s\n{FFFFFF}Do kedy: {FF0000}%s\n{FFFFFF}Admin: {FF0000}%s\n{FFFFFF}Dфvod: {FF0000}%s\nAk si ban dostal neprбvom napнљe na fуrum",DOF2_GetString(cesta,"MenoHraca"),date(DOF2_GetInt(cesta,"Kedy"),1),date(DOF2_GetInt(cesta,"Dokedy"),1),DOF2_GetString(cesta,"Admin"),DOF2_GetString(cesta,"Dovod"));
SendClientMessage(playerid,COLOR_RED,strr);//This message didnt show
TimerKick(playerid);
}
else if(IsBanned(playerid) == 2)
{
SendClientMessage(playerid,COLOR_RED,"Tvoj ban uћ skončil,dъfam ћe si sa pouћil");
DOF2_RemoveFile(cesta);
}
but it wrote ban will end at 8 o'clock..So i have got bug in time..
There is a code..
PHP код:
//this is that command
CMD:tban(playerid,params[])
{
new id,dovod[128],mesiace,dni,hodiny;
if(AdminLevel[playerid] < 3)return SendClientMessage(playerid,COLOR_RED,"[!] {FFFFFF}Nemбљ oprбvnenie na tento prнkaz");
if(sscanf(params,"uiiis[128]",id,mesiace,dni,hodiny,dovod))return SendClientMessage(playerid,COLOR_RED,"[!] {FFFFFF}Musнљ zadať /tban [ID] [Mesiace] [Dni] [Hodiny] [Dфvod]");
if(!IsPlayerConnected(id))return SendClientMessage(playerid,COLOR_RED,"[!] {FFFFFF}Tento hrбč nieje na serveri");
new
dat = gettime()+mktime(hodiny,0,0,dni,mesiace,0),
str[128],
cesta[16+15];
format(str,sizeof(str),"%s{FF3300}%s zabanoval hrбča %s do %s [Dфvod: %s]",GetPlayerAdminTitle(playerid),Meno(playerid),Meno(id),date(dat,1),dovod);
format(cesta,sizeof(cesta),"Banneds/%s.ini",PlayerIP(playerid));
SendClientMessageToAll(COLOR_RED,str);
DOF2_CreateFile(cesta);
DOF2_SetString(cesta,"MenoHraca",Meno(id));
DOF2_SetInt(cesta,"Kedy",gettime());
DOF2_SetInt(cesta,"Dokedy",dat);
DOF2_SetString(cesta,"Admin",Meno(playerid));
DOF2_SetString(cesta,"Dovod",dovod);
DOF2_SaveFile();
TimerKick(playerid);
return 1;
}
//stock mktime and date
stock mktime(hour,minute,second,day,month,year) {
new timestamp2;
timestamp2 = second + (minute * 60) + (hour * 3600);
new days_of_month[12];
if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) {
days_of_month = {31,29,31,30,31,30,31,31,30,31,30,31}; // Schaltjahr
} else {
days_of_month = {31,28,31,30,31,30,31,31,30,31,30,31}; // 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 ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) timestamp2 += 86400; // Schaltjahr + 1 Tag
}
return timestamp2;
}
stock date( timestamp, _form=1 )
{
/*
~ convert a Timestamp to a Date.
~ 10.07.2009
date( 1247182451, 0) will print >> 09.07.2009-23:34:11
date( 1247182451) will print >> 09/07/2009, 23:34:11
date( 1247182451, 2) will print >> July 09, 2009, 23:34:11
date( 1247182451, 3) will print >> 9 Jul 2009, 23:34
*/
new year=1970, day=0, month=0, hour=0, mins=0, sec=0;
new days_of_month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
new names_of_month[12][10] = {"Januar","Februar","Marec","April","Maj","Jun","Jul","August","September","Oktober","November","December"};
new returnstring[32];
while(timestamp>31622400){
timestamp -= 31536000;
if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) timestamp -= 86400;
year++;
}
if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) )
days_of_month[1] = 29;
else
days_of_month[1] = 28;
while(timestamp>86400){
timestamp -= 86400, day++;
if(day==days_of_month[month]) day=0, month++;
}
while(timestamp>60){
timestamp -= 60, mins++;
if( mins == 60) mins=0, hour++;
}
sec=timestamp;
switch( _form ){
case 1: format(returnstring, 31, "%02d/%02d/%d %02d:%02d:%02d", day+1, month+1, year, hour, mins, sec);
case 2: format(returnstring, 31, "%s %02d, %d, %02d:%02d:%02d", names_of_month[month],day+1,year, hour, mins, sec);
case 3: format(returnstring, 31, "%d %c%c%c %d, %02d:%02d", day+1,names_of_month[month][0],names_of_month[month][1],names_of_month[month][2], year,hour,mins);
default: format(returnstring, 31, "%02d.%02d.%d %02d:%02d:%02d", day+1, month+1, year, hour, mins, sec);
}
return returnstring;
}
I hope you can understand me,and help me..Thank you for your helps.