04.10.2015, 23:37
Nгo botei as imagens no tуpico pq sгo muito grandes
Basicamente ao entrar no servidor meu login й assim ( http://imgur.com/vo31Avx.png ), mas se eu errar a senha ele fica assim ( http://i.imgur.com/svBRU5j.png ) e dб para spawnar como mostra aqui ( http://i.imgur.com/mQdCX3g.jpg )
Alguйm me pode ajudar?
Cуdigo:
Grato!
Basicamente ao entrar no servidor meu login й assim ( http://imgur.com/vo31Avx.png ), mas se eu errar a senha ele fica assim ( http://i.imgur.com/svBRU5j.png ) e dб para spawnar como mostra aqui ( http://i.imgur.com/mQdCX3g.jpg )
Alguйm me pode ajudar?
Cуdigo:
PHP код:
public OnPlayerConnect(playerid)
{
new pName[MAX_PLAYER_NAME], dialogTitle[128], string[48 + MAX_PLAYER_NAME+1];
GetPlayerName(playerid, pName, sizeof(pName));
format(dialogTitle, sizeof(dialogTitle), "%s", SERVER_NAME);
format(string, sizeof(string), "{6FDD96}Server: {FFFFFF}%s has joined the server.", pName);
SendClientMessageToAll(-1, string);
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
ShowPlayerDialog(playerid,dLogin,DIALOG_STYLE_PASSWORD,dialogTitle,"Welcome back. Your account is registered in our users database.\nProcceed by typing your password in the blank space below and logging in.","Login","Quit");//Login dialog
}
else
{
ShowPlayerDialog(playerid,dRegister,DIALOG_STYLE_PASSWORD,dialogTitle,"Welcome to our server. Your account is not registered in our users database.\nProcceed by typing your password in the blank space below and registering.","Register","Quit");//Registration dialog
return 1;
}
SendClientMessage(playerid, COLOR_YELLOW, "[TNT]===========[TRUCK N' TRAILERS]============[TNT]");
SendClientMessage(playerid, COLOR_YELLOW, " ");
SendClientMessage(playerid, COLOR_YELLOW, " Welcome! You are playing on Truck n' Trailers now! ");
SendClientMessage(playerid, COLOR_YELLOW, " This server use 0.3.7 SA:MP Version ");
SendClientMessage(playerid, COLOR_YELLOW, " ");
SendClientMessage(playerid, COLOR_YELLOW, "[TNT]===========[SERVER ANNOUNCER]============[TNT]");
return 1;
}
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == dRegister)
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext) || strlen(inputtext) < 4)
{
ShowPlayerDialog(playerid,dRegister,DIALOG_STYLE_PASSWORD,"ERROR: MUST ENTER A PASSWORD","Welcome to our server. Your account is not registered in our users database.\nProcceed by typing your password in the blank space below and registering.","Register","Quit");
return 1;
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteString(file,"Password",hashpass);
INI_WriteInt(file,"Money",0);
INI_WriteInt(file,"Skin",0);
INI_WriteInt(file,"Kills",0);
INI_WriteInt(file,"Deaths",0);
INI_Close(file);
newReg[playerid] = true;
GivePlayerCash(playerid, 15000);
SendClientMessage(playerid,-1,"{6FDD96}Server: {FFFFFF}You're ready to play. Click the {6FDD96}SPAWN {FFFFFF}button and enjoy the server!");
return 1;
}
}
if(dialogid == dLogin)
{
if(!response) return Kick(playerid);
if(response)
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass, pInfo[playerid][Pass], false))
{
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
Logged[playerid] = true;
GivePlayerCash(playerid, pInfo[playerid][Money]);
SendClientMessage(playerid,-1,"{6FDD96}Server: {FFFFFF}Welcome back. You have successfully logged in!");
}
else
{
ShowPlayerDialog(playerid,dLogin,DIALOG_STYLE_PASSWORD,"ERROR: INCORRECT PASSWORD","Welcome back. Your account is registered in our users database.\nProcceed by typing your password in the blank space below and logging in.","Login","Quit");//We will tell to them that they've entered an incorrect password
return 1;
}
}
}
return 1;
}