Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Problems in Pawno

$
0
0
Greedings,i have got a few problems what i need to solve...So
At first .. One message didnt show..
Code:
PHP Code:

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);
    } 

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..
PHP Code:

//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 == 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=0i<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 == 0) && (year 100 != 0)) || (year 400 == 0) )  timestamp2 += 86400// Schaltjahr + 1 Tag
    
}

    return 
timestamp2;
}

stock datetimestamp_form=)
    {
        
/*
            ~ 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=1970day=0month=0hour=0mins=0sec=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 == 0) && (year 100 != 0)) || (year 400 == 0) ) timestamp -= 86400;
            
year++;
        }

        if ( ((
year == 0) && (year 100 != 0)) || (year 400 == 0) )
            
days_of_month[1] = 29;
        else
            
days_of_month[1] = 28;


        while(
timestamp>86400){
            
timestamp -= 86400day++;
            if(
day==days_of_month[month]) day=0month++;
        }

        while(
timestamp>60){
            
timestamp -= 60mins++;
            if( 
mins == 60mins=0hour++;
        }

        
sec=timestamp;

        switch( 
_form ){
            case 
1format(returnstring31"%02d/%02d/%d %02d:%02d:%02d"day+1month+1yearhourminssec);
            case 
2format(returnstring31"%s %02d, %d, %02d:%02d:%02d"names_of_month[month],day+1,yearhourminssec);
            case 
3format(returnstring31"%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(returnstring31"%02d.%02d.%d %02d:%02d:%02d"day+1month+1yearhourminssec);
        }

        return 
returnstring;
    } 

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.

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>