Problems in Pawno
#1

Greedings,i have got a few problems what i need to solve...So
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);
    } 
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 код:
//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.
Reply
#2

Use [php] for the code, can't be bothered to read it like this.
Reply
#3

Better?
Reply
#4

Way better.

On:
1. Why not just
PHP код:
new cesta[31]; 
2. I assume the message isn't being shown because the line is too long, try splitting it.
Example:
PHP код:
        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(playeridCOLOR_REDstrr); 
Reply
#5

Its showing me this error:
C:\Users\ichna\Desktop\SAMP server\pawno\RaIZone.pwn(139) : error 029: invalid expression, assumed zero
at this line
PHP код:
DOF2_GetString(cesta,"MenoHraca"),date(DOF2_GetInt(cesta,"Kedy"),1),date(DOF2_GetInt(cesta,"Dokedy"),1),DOF2_GetString(cesta,"Admin"),DOF2_GetString(cesta,"Dovod"));* 
Reply
#6

Oh i have got a star at the end of this line sorry
And the second problem?
Reply
#7

Just use gettime and getdate, no special stocks needed.
Reply
#8

Quote:
Originally Posted by saffierr
Посмотреть сообщение
stocks
https://sampforum.blast.hk/showthread.php?tid=570635
I couldn't resist. :P
Reply
#9

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
Lol, even before I clicked the link I knew it was the topic of Vince.
I know I know, I get your point, but I just said it for the sake of it. Lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)