Jump to content
  • 0

pomoc Errory


Vankus

Dotaz

Popis problému:

Mám problém v tom že mi to hodí 4 errory nechápem prečo...

 

Chyby/varování kompilátoru a při běhu:

C:\Users\ichna\Desktop\SAMP server\pawno\RaIZone.pwn(1051) : error 029: invalid expression, assumed zero

C:\Users\ichna\Desktop\SAMP server\pawno\RaIZone.pwn(1051) : error 029: invalid expression, assumed zero

C:\Users\ichna\Desktop\SAMP server\pawno\RaIZone.pwn(1051) : error 029: invalid expression, assumed zero

C:\Users\ichna\Desktop\SAMP server\pawno\RaIZone.pwn(1051) : fatal error 107: too many error messages on one line

 

Kód:

 

stock BanPlayer(playerid,admin[],months,days,hours,reason[])
{
        //riadok 1051(a ano mam stok mktime) new dat = gettime()+mktime(hours,0,0,days,months,0);
         new str[128];
         new cesta[16+15];
        format(str,sizeof(str),"Administrátor {FFFF00}%s{FFFFFF} zabanoval hráče {FFFF00}%s{FFFFFF} do %s ( Duvod:{FF0000} %s )",admin,PlayerName(playerid),date(dat,2),reason);
        format(cesta,sizeof(cesta),"Banneds/%s.ini",PlayerIP(playerid));
        SendClientMessageToAll(-1,str);
        print(str);
        dini_Create(cesta);
        DOF2_SetString(cesta,"MenoHraca",Meno(playerid));
        DOF2_SetInt(cesta,"Kedy",gettime());
        DOF2_SetInt(cesta,"Dokedy",dat);
        DOF2_SetString(cesta,"Admin",admin);
        DOF2_SetString(cesta,"Dovod",reason);
        TimerKick(playerid);
	    return 1;
}

 

 

 

Dodatečné poznámky:

--

Link to comment
Share on other sites

12 odpovědí na tuto otázku

Recommended Posts

  • 0

Dal som tie stocky nad ten stock BanPlayer a teraz mi vyhadzujú tie isté errory ale na inom riadku...

//stock mktime

stock mktime(hour,minute,second,day,month,year) {
       //na tomto riadku// 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};
                } else {
                        days_of_month = {31,28,31,30,31,30,31,31,30,31,30,31};
                }
        new days_this_year = 0;
        days_this_year = day;
        if(month > 1) {
                for(new i=0; i<month-1;i++) {
                        days_this_year += days_of_month;
                }
        }
        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;
        }
 
        return timestamp2;
}

//stock date

 stock date( timestamp, _form=0 )
    {
        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;
    }

Link to comment
Share on other sites

  • 0
  • Globální moderátor

Můžeš ještě jednou upřesnit na kterém řádku ti hlásí ty chyby (a poskytnout ten řádek)?

 

@ewwe, asi si pleteš s getdate/gettime a taky by to hlásilo jiné chyby

Link to comment
Share on other sites

  • 0

new timestamp2; na tomto riadku

tieto errory:

C:\Users\ichna\Desktop\SAMP server\pawno\RaIZone.pwn(1052) : error 029: invalid expression, assumed zero
C:\Users\ichna\Desktop\SAMP server\pawno\RaIZone.pwn(1052) : error 029: invalid expression, assumed zero
C:\Users\ichna\Desktop\SAMP server\pawno\RaIZone.pwn(1052) : error 029: invalid expression, assumed zero
C:\Users\ichna\Desktop\SAMP server\pawno\RaIZone.pwn(1052) : fatal error 107: too many error messages on one line


Okej nejakým zázračným spôsobom mi to ide ale mám ešte 2 problémy..Nechcem zakladať daľšiu tému tak to napíšem se.

1.V OnPlayerConnect to nenapíše správu

 

 

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);//toto mi nenapíše
		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);
	}

 

 

2.Keď dám niekomu timeban na hodinu tak tam je zlý čas..Napríklad je 10:00 a dám ban na 1 hodinu tak tam napíše,že ban skončí o 9:00...

 

 

//prikaz
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 a 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;
    }

 

 

Ďakujem za odpovede.


Prosim pomoc

Edited by Vankus
Link to comment
Share on other sites

  • 0

//ten stock

stock IsBanned(playerid)
{
	new
		cesta[16+15];
	format(cesta,sizeof(cesta),"Banneds/%s.ini",PlayerIP(playerid));
	if(DOF2_FileExists(cesta))
	{
		if(DOF2_GetInt(cesta,"Dokedy")-gettime() > 0)
		{
			return 3;
		}
		else
		{
			return 2;
		}
	}
	return 1;
}

A ako mám to časové pásmo zmeniť ? :d

Link to comment
Share on other sites

  • 0

Casove pasmo je proste pripocitanie x hodin. Bratislava je casove pasmo UTC+1 takze pripocitas jednu hodinu. Ked je letny cas, tak sme UTC+2, takze pripocitas 2 hodiny. A ano, zimny a letny cas su katastrofa...

A spravu ti asi nepise preto, ze je prilis dlha. SendClientMessahe nemoze odoslat viac ako 144 znakov. Tam kde mas nove riadky \n miesto toho sprav novu spravu SCM.

Edited by xhunterx
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...