Jump to content
  • 0

pomoc Anti Fake Nick


Guest SpiRinG

Dotaz

Mam script od qwera

Anti Fake Nick

 

Ale nevitvara subory. Zrejme je chyba v OnPlayerConnect

public OnPlayerConnect(playerid)
{
new str[128],cesta[50],ip[20];// Vytvoríme premeny
GetPlayerIp(playerid,ip,20);//zistíme si hráčovu IP
format(cesta,50,IPFILE,ip);//do stringu "cesta" uložíme cestu k súboru ("ip/jehoip.txt")
new File:aa;// vytvoríme premenu na súbor
new name[MAX_PLAYER_NAME];//premena na nick
GetPlayerName(playerid,name,MAX_PLAYER_NAME);//zistíme nick hráča
fcreate(cesta);//ak súbor neexistuje, vytvorí ho (funkcie sú nižšie)
aa = fopen(cesta,io_read);//otvoríme súbor s parametrom io_read na čítanie
new nasiel;//vytvoríme si premenu na kontrolu, či nick tam už zapísaný je
while(fread(aa,str)){//spustíme cyklus -> čítanie riadok po riadku
DelChar(str);//z prečítaného riadku zmažeme \r\n
if(!strcmp(name,str,false)){//skontrolujeme či sa prečítaný nick rovná aktuálnemu nicku
nasiel = 1;// ak áno, nastavíme premene hodnotu 1
break;//zastavíme cyklus
}
}
fclose(aa);//zavreme súbor
if(nasiel == 0){//ak tam aktuálny nick nieje
aa = fopen(cesta,io_append);// otvoríme súbor
format(str,128,"%s\r\n",name);//formatom nastavíme stringu text, ktorý chceme zapísať
fwrite(aa,str);//zapíšeme do súboru
fclose(aa);//zavreme súbor
}//ukončíme podmienku
return 1;
}

Link to comment
Share on other sites

14 odpovědí na tuto otázku

Recommended Posts

  • 0

Filterscrypt nevyvolava OnPlayerConnect ani OnPlayerDiconnect

H*vno s makom :d

Vyvoláva, prečoby nie

 

--------------------------------------

 

a pravdepodobne máš nahovno ten stock fcreate, skus ten svoj nahradiť týmto:

 

 

stock fcreate(way[])

{

if(fexist(way)) return 0;

new File:file = fopen(way, io_write);

if(!file) return 0;

fclose(file);

return 1;

}

 

 

a ak ti to stále nebude vytvárať:

 

Máš vytvorenú zložku do ktorej to má vytvářať tie súbory?

 

Link to comment
Share on other sites

  • 0

Skusim to. Hovoril som si veď to je blbosť žebi OnPlayerConnect nešlo v FS. QWEROU HS to ma na auta ne ?

 

---

 

#define IPFILE "(Subor)/IP/%s.txt"

 

 

A nejďe to stale. Pozeral som aj do org scriptu od qwera a ties tam pišu že to nejde

Link to comment
Share on other sites

  • 0

Tak reste si ja vam rekl cim to je :)

public OnPlayerConnect(playerid)
{
printf("connect %d",playerid);
return 1;

}

 

Zkus toto:

public OnPlayerRequestClass(playerid,classid)
{
OnPlayerConnect(playerid);
return 1;
}

Jestli ti to nezacne fungovat (ovsem az v okamziku kdy te to dopripoji a bude ti to chtit hodit vyber postavy)

 

A taky jak ti tady radi. Pawno neumi vytvaret slozky takze ji tam musis mit 100% uz pripravenou.

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...