Mivčo 90 Odesláno: 13. Leden, 2017 Share Odesláno: 13. Leden, 2017 Zdravim upravil som si timeban od QWER #include YSI/y_ini #include YSI/y_commands #define HODINA(%0) 3600*%0 #define DIALOG_ID 874 public OnPlayerConnect(playerid) { new strong[100]; if(fexist(strong)) { new dovod[75],Admin[25],dokedy,string[128],ip[20]; GetPlayerIp(playerid,ip,20); new INI:Fi = INI_Open(BanPath(playerid)); INI_WriteString(Fi,"%s",ip); INI_WriteString(Fi,"%s",dovod); INI_WriteString(Fi,"%s",Admin); INI_WriteInt(Fi,"%s",strval(string)); dokedy = strval(string); INI_WriteInt(Fi,"%s",dokedy); INI_Close(Fi); if(gettime() > dokedy) { SendClientMessage(playerid,0x0000FFFF,"[ TimeBan ] {FF0000}Ban ti vypršal, dúfam že si sa poučil"); fremove(strong); }else{ new ban[128]; strcat(ban,"Tvoj ešte stále nevypršal !\n"); format(strong, sizeof(strong),"Nick: %s \n", Jmeno(playerid)); strcat(ban,strong); format(strong, sizeof(strong),"IP: %s \n", ip); strcat(ban,strong); format(strong, sizeof(strong), "Dôvod: %s \n", dovod); strcat(ban,strong); format(strong, sizeof(strong), "Admin: %s \n", Admin); strcat(ban,strong); format(strong, sizeof(strong), "Kedy: %s \n", date(strval(string))); strcat(ban,strong); format(strong, sizeof(strong), "Platnosť %s \n", date(dokedy)); strcat(ban,strong); ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE_MSGBOX,"{0000FF}TimeBan",ban,"OK",""); Kick(playerid); } } return 1; } CMD:timeban(playerid, params[]) { //if(admin[playerid] == false) return SendClientMessage(playerid,0x0000FFFF,"[server]: Nie si Administrátor"); if(GetPlayerState(playerid) == PLAYER_STATE_WASTED) return SendClientMessage(playerid,0x0000FFFF,"[server]: Nemôžeš byť vo výbere postáv !"); new a[3][60],id,hodiny; if(UnFormat(params,a,' ',3) != 3) return SendClientMessage(playerid,0x0000FFFF,"[server]: /timeban [id] [hodinky] [dovod]"); id = strval(a[0]); if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x0000FFFF,"[server]: Hráč není na servery !"); if(IsPlayerAdmin(id)) return SendClientMessage(playerid,0x0000FFFF,"[server]: Nemôžeš zabanovať hlavného admina !"); hodiny = strval(a[1]); new str2[75]; GetPlayerIp(id,str2,75); new INI:Fi = INI_Open(BanPath(playerid)); INI_WriteString(Fi,"%s\r\n",str2); INI_WriteString(Fi,"%s\r\n",a[2]); INI_WriteString(Fi,"%s\r\n",Jmeno(playerid)); INI_WriteInt(Fi,"%d\r\n",gettime()); INI_WriteInt(Fi,"%d\r\n",HODINA(hodiny)+gettime()); INI_Close(Fi); new strong[128]; format(strong, sizeof(strong),"[ TimeBan ] {FF0000}Admin {FFFFFF}%s{FF0000} dal hráčovy {FFFFFF}%s {FF0000}ban na %d hodín Dôvod: %s",Jmeno(playerid),Jmeno(id),hodiny,a[2]); SendClientMessageToAll(-1,strong); Kick(id); return true; } stock BanPath(playerid) { new string[128],playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,sizeof(string),"Timeban/%s.txt",playername); return string; } stock Jmeno(playerid) { new n[MAX_PLAYER_NAME]; GetPlayerName(playerid,n,MAX_PLAYER_NAME); return n; } stock UnFormat(str[],variables[][],cha,m=0) { new len = strlen(str),chcount,i,start,varcount; while(i < len+1) { if(i == len && chcount != 0) { strmid(variables[varcount],str,start+1,strlen(str),128); chcount++; } if(str == cha) { if((m == 0) || (chcount != m-1)) { strmid(variables[varcount],str,start + ((start == 0) ? 0 : 1),i,128); start = i; chcount++; varcount++; } } i++; } return chcount; } stock date( timestamp, _form=1 ) { 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; } Keď na servery chcem niekoho zabanovať tak nikoho nezabanuje a neuloží nič do zložky... Jak to a pre čo? Už sa stím trápim celé hodiny Link to comment Share on other sites More sharing options...
0 Scydo 397 Odesláno: 13. Leden, 2017 Share Odesláno: 13. Leden, 2017 Hledáš soubor s prázdným jménem, jestli-že existuje. Link to comment Share on other sites More sharing options...
0 Mivčo 90 Odesláno: 13. Leden, 2017 Author Share Odesláno: 13. Leden, 2017 Tak ako to opravým aby mi to nerobilo lebo skúšam všeličo Link to comment Share on other sites More sharing options...
0 xDave 1 Odesláno: 13. Leden, 2017 Share Odesláno: 13. Leden, 2017 Musi to byt zrovna od neho? existuje spousta jinych, a i lepsich. Ted si zabiras cas, a davno jsi to mohl mit hotove, na stazeni je toho spousta. Link to comment Share on other sites More sharing options...
0 Scydo 397 Odesláno: 13. Leden, 2017 Share Odesláno: 13. Leden, 2017 Tak ako to opravým aby mi to nerobilo lebo skúšam všeličo Co zkusit hledat soubor, co má délku jména víc než nic? Musi to byt zrovna od neho? existuje spousta jinych, a i lepsich. Ted si zabiras cas, a davno jsi to mohl mit hotove, na stazeni je toho spousta. Zpracovaní není nic katastrofického. Vy to jen neumíte použít, po případě dobře upravit. Link to comment Share on other sites More sharing options...
0 xDave 1 Odesláno: 13. Leden, 2017 Share Odesláno: 13. Leden, 2017 https://uloz.to/!8PozMqeYZEue/timeban-zip Heslo: pawno.cz Nasel jsem to nekde v mych souborech, ale vim, ze je to stare 2-3 roky. Nevim jestli jsem to pawnil ja, uz si to nepamatuju Ty slozky si tam udelej, a dej si to na YSI, pokud chces, aktualne tam je zcmd... Jak chces je to na tobe, par bugu jsem tam opravil jeste, a je k tomu i include, mas ho v samostatnem raru. Jeste jednou opakuji, Ty slozky si tam dej, aby se tam zapisovaly bany, a co chces, a melo by to v pohode bezet. Nemas zac Link to comment Share on other sites More sharing options...
0 Mivčo 90 Odesláno: 13. Leden, 2017 Author Share Odesláno: 13. Leden, 2017 (upraveno) SkiBig stále to robím inak a stále to nefunguje :/ Edited 13. Leden, 2017 by Mivco Link to comment Share on other sites More sharing options...
0 xDave 1 Odesláno: 13. Leden, 2017 Share Odesláno: 13. Leden, 2017 SkiBig stále to robím inak a stále to nefunguje :/ Zrejme se chces trapit jeste delsi dobu, achjo Link to comment Share on other sites More sharing options...
0 Mivčo 90 Odesláno: 14. Leden, 2017 Author Share Odesláno: 14. Leden, 2017 Zrejme se chces trapit jeste delsi dobu, achjo ja chcem toto pomôcť opraviť a nie inakšie timeban podporovať original my ide od QWER ale ja to potrebujem do YSI len mi to nejako nejde a mimochodom ja viem že sú na sa-mp fórum tisícky tmebanov ale stoja za kravskú P.... Link to comment Share on other sites More sharing options...
0 Scydo 397 Odesláno: 14. Leden, 2017 Share Odesláno: 14. Leden, 2017 SkiBig stále to robím inak a stále to nefunguje :/ I když pochybuji, tak dám na to, že jsi to opravil... Stejnak tam máš další tunu chyb. Třeba máš ve fcích pro vpis informaci speficikátory na fci pro formátování, a jiné pomalu i triviální chyby. Dokud se nenaučíš alespoň základy, tak pomáhat ti je zcela zbytečné... Link to comment Share on other sites More sharing options...
0 Hlavní moderátor vEnd 279 Odesláno: 14. Leden, 2017 Hlavní moderátor Share Odesláno: 14. Leden, 2017 ja chcem toto pomôcť opraviť a nie inakšie timeban podporovať original my ide od QWER ale ja to potrebujem do YSI len mi to nejako nejde a mimochodom ja viem že sú na sa-mp fórum tisícky tmebanov ale stoja za kravskú P.... Mivčo, nevím, co teď plánuješ (zda FS, či GM), ale YSI nepoužívej. Neznáš a ani nechceš znát základy, YSI je pro tebe zbytečně náročné. Používej raději to, co ti vyhovuje a s čím už ses trochu naučil dříve - DOF2, popř. dini. Ano, říkám dini. Sice jsem jeho odpůrcem, ale u tebe k žádné progresi stejně nedojde. Když budeš používat DOF2/dini, je také větší šance, že se ti někdo ozve. YSI tu používá jen pár lidí a ještě méně jich pomáhá nováčkům, takto ti budou psát akorát ti, co s tím nemají zkušenosti. 2 Link to comment Share on other sites More sharing options...
0 The hidden face 77 Odesláno: 14. Leden, 2017 Share Odesláno: 14. Leden, 2017 Mivčo, nevím, co teď plánuješ (zda FS, či GM), ale YSI nepoužívej. Neznáš a ani nechceš znát základy, YSI je pro tebe zbytečně náročné. Používej raději to, co ti vyhovuje a s čím už ses trochu naučil dříve - DOF2, popř. dini. Ano, říkám dini. Sice jsem jeho odpůrcem, ale u tebe k žádné progresi stejně nedojde. Když budeš používat DOF2/dini, je také větší šance, že se ti někdo ozve. YSI tu používá jen pár lidí a ještě méně jich pomáhá nováčkům, takto ti budou psát akorát ti, co s tím nemají zkušenosti. Myslím si, že už není potřeba být odpůrcem dini, alespoň ne toho nového dini2 (gini). Používá se úplně stejně, jako staré dini, akorát tohle dosahuje stejných výsledků jako třeba DOF2 či y_ini, kolikrát i rychlejších. Link to comment Share on other sites More sharing options...
0 xDave 1 Odesláno: 14. Leden, 2017 Share Odesláno: 14. Leden, 2017 Mivčo, nevím, co teď plánuješ (zda FS, či GM), ale YSI nepoužívej. Neznáš a ani nechceš znát základy, YSI je pro tebe zbytečně náročné. Používej raději to, co ti vyhovuje a s čím už ses trochu naučil dříve - DOF2, popř. dini. Ano, říkám dini. Sice jsem jeho odpůrcem, ale u tebe k žádné progresi stejně nedojde. Když budeš používat DOF2/dini, je také větší šance, že se ti někdo ozve. YSI tu používá jen pár lidí a ještě méně jich pomáhá nováčkům, takto ti budou psát akorát ti, co s tím nemají zkušenosti. Mas pravdu, napriklad ja jsem s ysi delal jen jednou, a stejne me to neslo, do ted pouzivam zcmd, a navzdy budu. Mivco, udelej to, co jsem ti poradil ja, zkus to Link to comment Share on other sites More sharing options...
0 Hlavní moderátor vEnd 279 Odesláno: 14. Leden, 2017 Hlavní moderátor Share Odesláno: 14. Leden, 2017 Myslím si, že už není potřeba být odpůrcem dini, alespoň ne toho nového dini2 (gini). Používá se úplně stejně, jako staré dini, akorát tohle dosahuje stejných výsledků jako třeba DOF2 či y_ini, kolikrát i rychlejších. Díval jsem se na to dini2. Určitě je to zlepšení a jako náhrada za původní diny dobré, ale není to rychlejší než ostatní systémy. Viz stránka 4. Nesmíš všechno věřit autorovi. Link to comment Share on other sites More sharing options...
0 Mivčo 90 Odesláno: 14. Leden, 2017 Author Share Odesláno: 14. Leden, 2017 Mivčo, nevím, co teď plánuješ (zda FS, či GM), ale YSI nepoužívej. Neznáš a ani nechceš znát základy, YSI je pro tebe zbytečně náročné. Používej raději to, co ti vyhovuje a s čím už ses trochu naučil dříve - DOF2, popř. dini. Ano, říkám dini. Sice jsem jeho odpůrcem, ale u tebe k žádné progresi stejně nedojde. Když budeš používat DOF2/dini, je také větší šance, že se ti někdo ozve. YSI tu používá jen pár lidí a ještě méně jich pomáhá nováčkům, takto ti budou psát akorát ti, co s tím nemají zkušenosti. . Pracujem na GM a už mám všetko hotové a pracujem cez Y_INI len toto mi nejako nejde tento timeban :/ ale original script mi funguje normálne len keď som to dal do Y_INI tak nwm prečo to nefunguje... :/ Link to comment Share on other sites More sharing options...
0 Hlavní moderátor vEnd 279 Odesláno: 14. Leden, 2017 Hlavní moderátor Share Odesláno: 14. Leden, 2017 . Pracujem na GM a už mám všetko hotové a pracujem cez Y_INI len toto mi nejako nejde tento timeban :/ ale original script mi funguje normálne len keď som to dal do Y_INI tak nwm prečo to nefunguje... :/ Jak QWER ukládá v původní verzi data do souboru? Přímo přes souborové funkce (fwrite, fread), DOF2, nebo jiný systém? Link to comment Share on other sites More sharing options...
0 Mivčo 90 Odesláno: 14. Leden, 2017 Author Share Odesláno: 14. Leden, 2017 No txt súbor mi vytvorí ale nič sa mi tam neukaže.... A keď sa server prídem tak ukáže že mi ban vypršal... Link to comment Share on other sites More sharing options...
0 Scydo 397 Odesláno: 14. Leden, 2017 Share Odesláno: 14. Leden, 2017 No txt súbor mi vytvorí ale nič sa mi tam neukaže.... A keď sa server prídem tak ukáže že mi ban vypršal... Třeba máš ve fcích pro vpis informaci speficikátory na fci pro formátování Link to comment Share on other sites More sharing options...
0 Mivčo 90 Odesláno: 14. Leden, 2017 Author Share Odesláno: 14. Leden, 2017 Třeba máš ve fcích pro vpis informaci speficikátory na fci pro formátování Neviem to vôbec spraviť trápim sa stím :/ Link to comment Share on other sites More sharing options...
0 Globální moderátor HighPrint 177 Odesláno: 15. Leden, 2017 Globální moderátor Share Odesláno: 15. Leden, 2017 (upraveno) Tak bych na to šel asi logicky... víme, že nezapisuje... takže asi logicky hledám v části, kde zapisuju. Tak se kouknu na syntax zapisování: INI_WriteStringINI:file - File to write to.name[] - Data name.data[] - Data. EDIT: Možná se zkus podívat ještě sem: new strong[100]; if(fexist(strong)) { ... } wtf? otevíráš soubor a zapisuješ do nich prázdné stringy, nemluvě o tom, že zas blbě využíváš funkci: new dovod[75],Admin[25],dokedy,string[128],ip[20]; GetPlayerIp(playerid,ip,20); new INI:Fi = INI_Open(BanPath(playerid)); INI_WriteString(Fi,"%s",ip); INI_WriteString(Fi,"%s",dovod); INI_WriteString(Fi,"%s",Admin); INI_WriteInt(Fi,"%s",strval(string)); dokedy = strval(string); INI_WriteInt(Fi,"%s",dokedy); INI_Close(Fi); wtf? EDIT2: Tohle všechno ti už napověděl skibig, akorát sám jsem to nepochopil dokud jsem se nekouknul na kód Edited 15. Leden, 2017 by HighPrint Link to comment Share on other sites More sharing options...
0 Mivčo 90 Odesláno: 15. Leden, 2017 Author Share Odesláno: 15. Leden, 2017 Tak bych na to šel asi logicky... víme, že nezapisuje... takže asi logicky hledám v části, kde zapisuju. Tak se kouknu na syntax zapisování: INI_WriteStringINI:file - File to write to. name[] - Data name. data[] - Data. EDIT: Možná se zkus podívat ještě sem: new strong[100]; if(fexist(strong)) { ... } wtf? otevíráš soubor a zapisuješ do nich prázdné stringy, nemluvě o tom, že zas blbě využíváš funkci: new dovod[75],Admin[25],dokedy,string[128],ip[20]; GetPlayerIp(playerid,ip,20); new INI:Fi = INI_Open(BanPath(playerid)); INI_WriteString(Fi,"%s",ip); INI_WriteString(Fi,"%s",dovod); INI_WriteString(Fi,"%s",Admin); INI_WriteInt(Fi,"%s",strval(string)); dokedy = strval(string); INI_WriteInt(Fi,"%s",dokedy); INI_Close(Fi);wtf? EDIT2: Tohle všechno ti už napověděl skibig, akorát sám jsem to nepochopil dokud jsem se nekouknul na kód Strong som zmenil na BanPath(playerid) a taj tak to nefunguje.... Stále to neviem opraviť... Link to comment Share on other sites More sharing options...
0 Globální moderátor HighPrint 177 Odesláno: 15. Leden, 2017 Globální moderátor Share Odesláno: 15. Leden, 2017 A jako zbytek chyb na které jsem poukázal (+ ostatní) jsi zapomněl? Hoď edit a dej sem nejaktuálnější kód... Link to comment Share on other sites More sharing options...
0 Mivčo 90 Odesláno: 16. Leden, 2017 Author Share Odesláno: 16. Leden, 2017 A jako zbytek chyb na které jsem poukázal (+ ostatní) jsi zapomněl? Hoď edit a dej sem nejaktuálnější kód... Zmenil som len to prvé nič viac ... Už neviem ako mám ďalej to robiť :/ Link to comment Share on other sites More sharing options...
0 Globální moderátor HighPrint 177 Odesláno: 16. Leden, 2017 Globální moderátor Share Odesláno: 16. Leden, 2017 jak jako nevím? Anglicky umíme? Chceš ty data ČÍST (read) a ne ZAPISOVAT (write), tak si najdi potřebné funkce z YINI na čtení. Najít dokumentaci nebude složité, já jsem s YINI nikdy nedělal a našel jsem ji během 5min Poukázal jsem na další chybu a to v cmd timeban. Poslal jsem ti syntax zapisování (WRITE), tak si ho uprav. <=> (pro debily) V cmd /timeban máš INI_WriteString(Fi,"%s\r\n",Jmeno(playerid)); BLBĚ, musíš si to upravit! Jednodušší příklad pro ultra natvrdlý dummies new name[24]; GetPlayerName(playerid,name,sizeof(name)); INI_WriteString(Fi:soubor,"Jmeno",name); Víc ti nepomůžu. Jestli si z příspěvku ani z příkladu nic nevezmeš, tak ti není napomoci, a vřele ti doporučuji aby ses na to vykašlal... 1 Link to comment Share on other sites More sharing options...
0 Scydo 397 Odesláno: 16. Leden, 2017 Share Odesláno: 16. Leden, 2017 Údaje načítáš pomocí callbacku, který si nazveš jak chceš, a voláš přes fci INI_ParseFile(). Údáje ukládáš pomocí fcí INI_Write[datový_typ]() po otevření( / +vytvoření) INI_Open. Existenci si můžeš ověřit pomocí fexist() tak, že si zjistíš jméno hráče+tu cestu(ps, taky můžeš využít vychytávku INI_Load() pokud chceš vědět, jestli ten soubor skutečně otevřel ale není potřeba). Link to comment Share on other sites More sharing options...
0 Mivčo 90 Odesláno: 16. Leden, 2017 Author Share Odesláno: 16. Leden, 2017 Niečo som zostrojil ale neviem či je to dobre :/ som to len tak na mobile vymyslel :/ #include YSI\y_ini #include YSI\y_commands #define HODINA(%0) 3600*%0 #define DIALOG_ID 874 enum bInfo { bIP, bDATE, bHODINY, bNAME, } enum pInfo { Admin } new PlayerBan[MAX_PLAYERS][bInfo]; new PlayerInfo[MAX_PLAYERS][pInfo]; forward LoadBan_data(playerid,name[],value[]); public LoadBan_data(playerid,name[],value[]) { INI_Int("Ip",PlayerBan[playerid][bIP]); INI_Int("Date",PlayerBan[playerid][bDATE]); INI_Int("Hodiny",PlayerBan[playerid][bHODINY]); INI_Int("Name",PlayerBan[playerid][bNAME]); return 1; } public OnPlayerConnect(playerid) { if(fexist(BanPath(playerid))) { INI_ParseFile(BanPath(playerid), "LoadBan_%s", .bExtra = true, .extra = playerid); new dovod[75],string[128],ip[20]; GetPlayerIp(playerid,ip,20); if(gettime() > strval(string)) { SendClientMessage(playerid,0x0000FFFF,"[ TimeBan ] {FF0000}Ban ti vypršal, dúfam že si sa poučil"); fremove(BanPath(playerid)); }else{ new strong[100]; new ban[128]; strcat(ban,"Tvoj ešte stále nevypršal !\n"); format(strong, sizeof(strong),"Nick: %s \n", Jmeno(playerid)); strcat(ban,strong); format(strong, sizeof(strong),"IP: %s \n", PlayerBan[playerid][bIP]); strcat(ban,strong); format(strong, sizeof(strong), "Dôvod: %s \n", dovod); strcat(ban,strong); format(strong, sizeof(strong), "Admin: %s \n", PlayerInfo[playerid][Admin]); strcat(ban,strong); format(strong, sizeof(strong), "Kedy: %s \n", date(strval(string))); strcat(ban,strong); format(strong, sizeof(strong), "Platnosť %s \n", date(strval(string))); strcat(ban,strong); ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE_MSGBOX,"{0000FF}TimeBan",ban,"OK",""); Kick(playerid); } } return 1; } CMD:timeban(playerid, params[]) { //if(admin[playerid] == false) return SendClientMessage(playerid,0x0000FFFF,"[server]: Nie si Administrátor"); if(GetPlayerState(playerid) == PLAYER_STATE_WASTED) return SendClientMessage(playerid,0x0000FFFF,"[server]: Nemôžeš byť vo výbere postáv !"); new a[3][60],id,hodiny; if(UnFormat(params,a,' ',3) != 3) return SendClientMessage(playerid,0x0000FFFF,"[server]: /timeban [id] [hodinky] [dovod]"); id = strval(a[0]); if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x0000FFFF,"[server]: Hráč není na servery !"); if(IsPlayerAdmin(id)) return SendClientMessage(playerid,0x0000FFFF,"[server]: Nemôžeš zabanovať hlavného admina !"); new plrIP[64],name[32]; hodiny = strval(a[1]); new INI:Fi = INI_Open(BanPath(playerid)); INI_WriteInt(Fi,"%s",PlayerBan[playerid][bIP] = GetPlayerIp(playerid, plrIP, 64)); INI_WriteString(Fi,"%s",a[2]); INI_WriteInt(Fi,"%s",PlayerBan[playerid][bNAME] = GetPlayerName(playerid,name,sizeof(name))); INI_WriteInt(Fi,"%d",PlayerBan[playerid][bDATE] = gettime()); INI_WriteInt(Fi,"%d",PlayerBan[playerid][bHODINY] = HODINA(hodiny)+gettime()); INI_Close(Fi); new strong[128]; format(strong, sizeof(strong),"[ TimeBan ] {FF0000}Admin {FFFFFF}%s{FF0000} dal hráčovy {FFFFFF}%s {FF0000}ban na %d hodín Dôvod: %s",Jmeno(playerid),Jmeno(id),hodiny,a[2]); SendClientMessageToAll(-1,strong); Kick(id); return true; } stock BanPath(playerid) { new string[128],playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,sizeof(string),"Timeban/%s.txt",playername); return string; } stock Jmeno(playerid) { new n[MAX_PLAYER_NAME]; GetPlayerName(playerid,n,MAX_PLAYER_NAME); return n; } stock UnFormat(str[],variables[][],cha,m=0) { new len = strlen(str),chcount,i,start,varcount; while(i < len+1) { if(i == len && chcount != 0) { strmid(variables[varcount],str,start+1,strlen(str),128); chcount++; } if(str == cha) { if((m == 0) || (chcount != m-1)) { strmid(variables[varcount],str,start + ((start == 0) ? 0 : 1),i,128); start = i; chcount++; varcount++; } } i++; } return chcount; } stock date( timestamp, _form=1 ) { 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 More sharing options...
Dotaz
Mivčo 90
Zdravim upravil som si timeban od QWER
#include YSI/y_ini
#include YSI/y_commands
#define HODINA(%0) 3600*%0
#define DIALOG_ID 874
public OnPlayerConnect(playerid)
{
new strong[100];
if(fexist(strong))
{
new dovod[75],Admin[25],dokedy,string[128],ip[20];
GetPlayerIp(playerid,ip,20);
new INI:Fi = INI_Open(BanPath(playerid));
INI_WriteString(Fi,"%s",ip);
INI_WriteString(Fi,"%s",dovod);
INI_WriteString(Fi,"%s",Admin);
INI_WriteInt(Fi,"%s",strval(string));
dokedy = strval(string);
INI_WriteInt(Fi,"%s",dokedy);
INI_Close(Fi);
if(gettime() > dokedy)
{
SendClientMessage(playerid,0x0000FFFF,"[ TimeBan ] {FF0000}Ban ti vypršal, dúfam že si sa poučil");
fremove(strong);
}else{
new ban[128];
strcat(ban,"Tvoj ešte stále nevypršal !\n");
format(strong, sizeof(strong),"Nick: %s \n", Jmeno(playerid));
strcat(ban,strong);
format(strong, sizeof(strong),"IP: %s \n", ip);
strcat(ban,strong);
format(strong, sizeof(strong), "Dôvod: %s \n", dovod);
strcat(ban,strong);
format(strong, sizeof(strong), "Admin: %s \n", Admin);
strcat(ban,strong);
format(strong, sizeof(strong), "Kedy: %s \n", date(strval(string)));
strcat(ban,strong);
format(strong, sizeof(strong), "Platnosť %s \n", date(dokedy));
strcat(ban,strong);
ShowPlayerDialog(playerid,DIALOG_ID,DIALOG_STYLE_MSGBOX,"{0000FF}TimeBan",ban,"OK","");
Kick(playerid);
}
}
return 1;
}
CMD:timeban(playerid, params[])
{
//if(admin[playerid] == false) return SendClientMessage(playerid,0x0000FFFF,"[server]: Nie si Administrátor");
if(GetPlayerState(playerid) == PLAYER_STATE_WASTED) return SendClientMessage(playerid,0x0000FFFF,"[server]: Nemôžeš byť vo výbere postáv !");
new a[3][60],id,hodiny;
if(UnFormat(params,a,' ',3) != 3) return SendClientMessage(playerid,0x0000FFFF,"[server]: /timeban [id] [hodinky] [dovod]");
id = strval(a[0]);
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x0000FFFF,"[server]: Hráč není na servery !");
if(IsPlayerAdmin(id)) return SendClientMessage(playerid,0x0000FFFF,"[server]: Nemôžeš zabanovať hlavného admina !");
hodiny = strval(a[1]);
new str2[75];
GetPlayerIp(id,str2,75);
new INI:Fi = INI_Open(BanPath(playerid));
INI_WriteString(Fi,"%s\r\n",str2);
INI_WriteString(Fi,"%s\r\n",a[2]);
INI_WriteString(Fi,"%s\r\n",Jmeno(playerid));
INI_WriteInt(Fi,"%d\r\n",gettime());
INI_WriteInt(Fi,"%d\r\n",HODINA(hodiny)+gettime());
INI_Close(Fi);
new strong[128];
format(strong, sizeof(strong),"[ TimeBan ] {FF0000}Admin {FFFFFF}%s{FF0000} dal hráčovy {FFFFFF}%s {FF0000}ban na %d hodín Dôvod: %s",Jmeno(playerid),Jmeno(id),hodiny,a[2]);
SendClientMessageToAll(-1,strong);
Kick(id);
return true;
}
stock BanPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"Timeban/%s.txt",playername);
return string;
}
stock Jmeno(playerid)
{
new n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,MAX_PLAYER_NAME);
return n;
}
stock UnFormat(str[],variables[][],cha,m=0)
{
new len = strlen(str),chcount,i,start,varcount;
while(i < len+1)
{
if(i == len && chcount != 0)
{
strmid(variables[varcount],str,start+1,strlen(str),128);
chcount++;
}
if(str == cha)
{
if((m == 0) || (chcount != m-1))
{
strmid(variables[varcount],str,start + ((start == 0) ? 0 : 1),i,128);
start = i;
chcount++;
varcount++;
}
}
i++;
}
return chcount;
}
stock date( timestamp, _form=1 )
{
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;
}
Keď na servery chcem niekoho zabanovať tak nikoho nezabanuje a neuloží nič do zložky... Jak to a pre čo? Už sa stím trápim celé hodiny
Link to comment
Share on other sites
34 odpovědí na tuto otázku
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now