Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <dini>
- ////////defines//////////////
- #define BELA "{FFFFFF}"
- #define CRVENA "{FF3333}"
- #define COL_ZELENA "{008000}"
- #define COL_PLAVA "{00FFFF}"
- #define DIALOG_REGISTRACIJA 1
- #define DIALOG_LOGIN 2
- #define DIALOG_LOGIN_STYLE_INPUT
- ///////////////////////////////////
- main() {
- print("PROBA SRW ");
- print("PROBA SRW ");
- print("PROBA SRW ");
- print("PROBA SRW ");
- print("PROBA SRW ");
- print("///////////////// ");
- }
- public OnGameModeInit() {
- AddPlayerClass(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
- return 1; }
- public OnPlayerConnect(playerid)
- {
- new File[64]
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(File,sizeof(File),"/Nalozi/%s.txt",name);
- if(dini_Exists(File))
- {
- ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login :","Dobro dosli nazad, ukucajte svoju sifru da bi se ulogovao u svoj nalog !", "Uloguj se!" , "Odbij!");
- }
- else
- {
- ShowPlayerDialog(playerid,DIALOG_REGISTRACIJA,DIALOG_STYLE_INPUT,"Registracija :","Ukucaj sifru za svoj nalog!","Registruj se!","Odbij!");
- }
- return 1; }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_LOGIN)
- {
- if(response == 0)
- {
- SendClientMessage(playerid,COL_PLAVA,"Moras se ulogovati da bi mogao igrati na serveru!");
- Kick(playerid);
- }
- if(response == 1)
- {
- if(strlen(inputtext))
- {
- SendClientMessage(playerid,COL_ZELENA,"Pogresna sifra");
- ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login :","Dobro dosli nazad, ukucajte svoju sifru da bi se ulogovao u svoj nalog !", "Uloguj se!" , "Odbij!");
- return 1;
- }
- else
- {
- Uloguj(playerid,inputtext);
- return 1;
- }
- }
- }
- if(dialogid == DIALOG_REGISTRACIJA)
- }
- if(response == 0)
- {
- SendClientMessage(playerid,COL_PLAVA,"Moras se registrovati da bi mogao igrati na serveru!");
- Kick(playerid);
- }
- if(response == 1)
- {
- if(!strlen(inputtext)
- {
- SendClientMessage(playerid,COL_ZELENA,"Pogresna sifra");
- ShowPlayerDialog(playerid,DIALOG_REGISTRACIJA,DIALOG_STYLE_INPUT,"Registracija :","Ukucaj sifru za svoj nalog!","Registruj se!","Odbij!");
- return 1;
- }
- else
- {
- Registruj(playerid,(inputtext);
- return 1;
- }
- }
- stock Registruj(playerid,key[])
- {
- new File[64];
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(File,sizeof(File),"/Nalozi/%.txt",name);
- dini_Create(File);
- dini_Set(File,"Sifra",key);
- SendClientMessage(playerid,PLAVA,"Uspesno si se registrovao");
- sini_InSet(File,"Skor",0);
- SetPVarInt(playerid,"Ulogovan",1);
- return 1;
- }
- stock Uloguj(playerid,key[])
- {
- new File[64];
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(File,sizeof(File),"Nalozi/%s.txt",name);
- if(!strcmp(key,dini_Get(File,"Sifra"),false))
- {
- UcitajNalog(playerid);
- SendClientMessage(playerid),PLAVA,"Uspesno si se ulogovao!);
- return 1;
- }
- else
- {
- SendClientMessage(playerid,COL_ZELENA,"Pogresna sifra!);
- ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login :","Dobro dosli nazad, ukucajte svoju sifru da bi se ulogovao u svoj nalog !", "Uloguj se!" , "Odbij!");
- return 1;
- }
- }
- stock UcitajNalog(playerid)
- {
- new File[64];
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(File,sizeof(File),"Nalozi/%s.txt",name);
- SetPlayerScore(playerid),dini_Int(File,"Skor"));
- GivePlayerMoney(playerid,dini_Int(File,"Novac'));
- SetPVarInt(playerid,"ulogovan",1);
- return 1;
- }
- stock SnimiPodatke(playerid)
- {
- if(GetPVarInt(playerid,"ulogovan")== 1)
- {
- new File[64];
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(File,sizeof(File),"Nalozi/%s.txt",name);
- dini_IntSet(File,"Skor",GetPlayerScore(playerid));
- dini_IntSet(File,"Novac",GetplayerMoney
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid,reason)
- {
- if(GetPVarInt(playerid,"ulogovan")== 1)
- {
- SnimiPodatke(playerid);
- }
- return 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement