Sveiki, daug kam reikia gui registracijos tai va sukuriau pamoka.
VISA PAMOKA PERSISKAITYKIT JEI META ERRORA AR KAZKAS PAS JUS NEVEIKIA, TADA TIK KLAUSKITE Pradekime:
Atsidarome savo gamemode, ir po public OnPlayerConnect(playerid)
{
Parasome sita koda:
new name [MAX_PLAYERS];
new w[128];
new file[128];
GetPlayerName(playerid,name,sizeof(name)); // Gauna zaidejo varda
format(file,sizeof(file),"saves/user/%s.ini",name); // Ziuri ar failas egzistuoja
if(fexist(file)) // Jei failas egzistuoja
{
format(w,sizeof(w),"Prisijungimo kodas:",name); // Ismeta gui su uzrasu Prisijungimo kodas
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Prisijungti","Exit"); // Gui lenteles pavadinimas ir 2 pasi.
}
GetPlayerName(playerid,name,sizeof(name)); // Gauna zaidejo varda
format(file,sizeof(file),"saves/user/%s.ini",name); // Ziuri ar failas egzistuojas
if(!fexist(file)) // Jeigu failas neegzistuoja
{
format(w,sizeof(w),"Registracijos kodas:",name); // Atidaro gui su uzrasu
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Registracija",w,"Registruotis","Exit"); // Gui lenteles pavadinimas su 2 pas.
}
Tada po public OnDialogResponse
Irasome:
new name[MAX_PLAYER_NAME],file[128];
new w[128], gw[128];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"saves/user/%s.ini",name);
if(dialogid == 1)
{
if(response == 1)
{
if(strlen(inputtext))
{
if(fexist(file))
{
}
else
{
dini_Create(file);
dini_IntSet(file,"slaptazodis",tohash(inputtext));
format(w,sizeof(w),"Registracija Sekminga! Jusu Slaptazodis: %s",inputtext,name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Login","Cancel");
}
}
else
{
format(gw,sizeof(gw),"Neivedete Slaptazodzio! Prasome Usiregistruoti:",name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Registracija",gw,"Register","Cancel");
}
}
if(response == 0)
{
Kick(playerid);
}
}
else if(dialogid == 2)
{
if(response == 1)
{
if(strlen(inputtext))
{
if(!fexist(file))
{
}
else
{
if(CheckPass(file,inputtext))
{
new exp = dini_Int(file,"Xp");
if(dini_Int(file,"Admin") == 1) playerDB[playerid][admin]=true;
if(playerDB[playerid][admin])
{
SendClientMessage(playerid,COLOR,"");
}else{
SendClientMessage(playerid,COLOR,"");
}
if(exp == -1) playerDB[playerid][authstate]=1; else
playerDB[playerid][authstate]=2;
return 1;
}
format(w,sizeof(w),"Neteisingas Slaptazodis! Prasome Prisijungti:",name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Login","Cancel");
}
}
else
{
format(w,sizeof(w),"Neivedete Slaptazodzio! Prasome Prisijungti:",name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Login","Cancel");
}
}
if(response == 0)
{
Kick(playerid);
}
}
return 0;
}
JEIGU NERA public OnDialogResponse Paciam modo gale parasote
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
Ir tada dedate:
new name[MAX_PLAYER_NAME],file[128];
new w[128], gw[128];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"saves/user/%s.ini",name);
if(dialogid == 1)
{
if(response == 1)
{
if(strlen(inputtext))
{
if(fexist(file))
{
}
else
{
dini_Create(file);
dini_IntSet(file,"slaptazodis",tohash(inputtext));
format(w,sizeof(w),"Registracija Sekminga! Jusu Slaptazodis: %s",inputtext,name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Login","Cancel");
}
}
else
{
format(gw,sizeof(gw),"Neivedete Slaptazodzio! Prasome Usiregistruoti:",name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Registracija",gw,"Register","Cancel");
}
}
if(response == 0)
{
Kick(playerid);
}
}
else if(dialogid == 2)
{
if(response == 1)
{
if(strlen(inputtext))
{
if(!fexist(file))
{
}
else
{
if(CheckPass(file,inputtext))
{
new exp = dini_Int(file,"Xp");
if(dini_Int(file,"Admin") == 1) playerDB[playerid][admin]=true;
if(playerDB[playerid][admin])
{
SendClientMessage(playerid,COLOR,"");
}else{
SendClientMessage(playerid,COLOR,"");
}
if(exp == -1) playerDB[playerid][authstate]=1; else
playerDB[playerid][authstate]=2;
return 1;
}
format(w,sizeof(w),"Neteisingas Slaptazodis! Prasome Prisijungti:",name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Login","Cancel");
}
}
else
{
format(w,sizeof(w),"Neivedete Slaptazodzio! Prasome Prisijungti:",name);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Prisijungimas",w,"Login","Cancel");
}
}
if(response == 0)
{
Kick(playerid);
}
}
return 0;
}
1. JEIGU META SITA ERRORA:
: error 017: undefined symbol "ShowPlayerDialog"
Eikite i gamemodes/data/a_samp ir prisirasyk:
#define DIALOG_STYLE_MSGBOX 0
#define DIALOG_STYLE_INPUT 1
#define DIALOG_STYLE_LIST 2
native ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]);
2. JEIGU META SITA ERRORA:
error 021: symbol already defined: "name"
SUSIRASKITE SITAS EILUTES:
if(InvalidNickKick(playerid)) return 0;
Clear(playerid);
new name[MAX_PLAYER_NAME],msg[128];
GetPlayerName(playerid,name,sizeof(name));
format(msg,sizeof(msg),"* %s prisijunge.",name);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(playerDB[i][admin])
{
SendClientMessage(i,COLOR,msg);
3. SITA EILUTE:
new name[MAX_PLAYER_NAME],msg[128];
PAKEISKITE I:
new msg[128];
4. JEIGU META SITA WARNING:
: warning 204: symbol is assigned a value that is never used: "asdf"
Pakeiskite sita eilute:
new asdf[MAX_PLAYER_NAME],msg[128];
I :
new msg[128];
5. JEIGU META SITA WARNING:
warning 235: public function lacks forward declaration (symbol "OnDialogResponse")
Eikite i gamemodes/data/a_samp ir pridekite si koda:
forward OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
6. Jeigu raso kaip pasirenkate skina ir spaudziat shift:
"Server Closed Connection"
Tada savo gamemode susiraskite visas eilutes:
Pirmiausia turite prisijungti, tai trunka vos kelias sek.!")
Ir trynkite visas lauk, tada nebus jokiu problemu
Radau kaip padaryti kad gautu xp ir litu taigi susiraskite public OnDialogResponse ir jame turi buti sitos eilute: if(exp == -1) playerDB[playerid][authstate]=1; else
playerDB[playerid][authstate]=2;
Po jomis yrasikite sita koda:
SetPlayerScore(playerid,KIEK NORIT KAD DUOTU); // duos xp
GivePlayerMoneyA(playerid,NORIT KAD DUOTU); //duos litu
Viskas
VISKA PADARE NEPAMIRSKITE SUKOMLIPNTI PAWNO FAILO
***PAMOKA KURTA MANO Vaska_Tomas (Rapolas)
***JEI KOKIE NORS ERRORAI RASYKITE PADESIU
***SKYPE: golen.