09.02.2012, 12:40
Hello everyone 
I made a registering dialog just for the password now i want to add more things to that,like age.
How should i start and put the saves?
Here is my code:
some more
Saving and loading...

I made a registering dialog just for the password now i want to add more things to that,like age.
How should i start and put the saves?
Here is my code:
Код:
public OnPlayerConnect(playerid) { new datoteka[64]; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(datoteka,sizeof(datoteka),"/Korisnici/%s.txt",name); if(dini_Exists(datoteka)) { ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Vaљ acc je pronaрen,unesite lozinku!","OK","Izlaz"); } else { ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registracija","Upisi svoj password","OK","Izlaz"); } return 1; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid==DIALOG_LOGIN) { if(response==0) { SendClientMessage(playerid,crvena,"Moraљ se logirati da bi igrao na serveru!"); Kick(playerid); return 1; } if(response==1) { if(!strlen(inputtext)) { SendClientMessage(playerid,crvena,"Lozinka koju ste unjeli je prekratka!"); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Vaљ acc je pronaрen,unesite lozinku!","OK","Izlaz"); return 1; } else { Login(playerid,inputtext); return 1; } } } if(dialogid==DIALOG_REGISTER) { if(response==0) { SendClientMessage(playerid,crvena,"Moraљ se registrirati da bi igrao na serveru!"); Kick(playerid); return 1; } if(response==1) { if(!strlen(inputtext)) { SendClientMessage(playerid,crvena,"Lozinka koju ste unjeli je prekratka!"); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registracija","Upisi svoj password","OK","Izlaz"); return 1; } else { Registracija(playerid,inputtext); return 1; } } } return 1; }
Код:
stock Registracija(playerid,key[]) { new datoteka[64]; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(datoteka,sizeof(datoteka),"/Korisnici/%s.txt",name); dini_Create(datoteka); dini_Set(datoteka,"Lozinka:",key); SendClientMessage(playerid,zelena,"USPJEЉNO STE SE REGISTRIRALI!"); SetPlayerScore(playerid,1); return 1; } stock Login(playerid,key[]) { new datoteka[64]; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(datoteka,sizeof(datoteka),"/Korisnici/%s.txt",name); if(!strcmp(key,dini_Get(datoteka,"Lozinka"),true)) { UcitavanjeAcc(playerid); SendClientMessage(playerid,zelena,"Uspjeљno ste se logirali!"); return 1; } else { SendClientMessage(playerid,crvena,"Unjeli ste krivu lozinku!"); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Vaљ acc je pronaрen,unesite lozinku!","OK","Izlaz"); return 1; } } stock UcitavanjeAcc(playerid) { new datoteka[64]; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(datoteka,sizeof(datoteka),"/Korisnici/%s.txt",name); SetPlayerScore(playerid,dini_Int(datoteka,"Level")); GivePlayerMoney(playerid,dini_Int(datoteka,"Novac")); SetPVarInt(playerid,"Adminlevel",dini_Int(datoteka,"Adminlevel")); SetPVarInt(playerid,"Organizacija",dini_Int(datoteka,"Organizacija")); //InfoIgraca[playerid][Adminlevel]=dini_Int(datoteka,"Adminleve"); //InfoIgraca[playerid][Organizacija]=dini_Int(datoteka,"Organizacija"); return 1; } stock SpremanjeAcc(playerid) { new datoteka[64]; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(datoteka,sizeof(datoteka),"/Korisnici/%s.txt",name); dini_IntSet(datoteka,"Level",GetPlayerScore(playerid)); dini_IntSet(datoteka,"Novac",GetPlayerMoney(playerid)); dini_IntSet(datoteka,"Adminlevel",GetPVarInt(playerid,"Adminlevel")); dini_IntSet(datoteka,"Organizacija",GetPVarInt(playerid,"ORganizacija")); return 1; }