08.04.2018, 19:57
Criei um sistema de login em DOF2, Ele estб funcionado por enquanto sem nenhum erro. Estou tentando quando logar no servidor pular aquela parada de "<<" "SPAWN" ">>". Se alguйm puder me ajudar nisso agradeзo
Codes
AGRADEЗO MUITO DКS DE JБ
Codes
PHP код:
#define DIALOG_REGISTRO 1
#define DIALOG_LOGIN 2
new Float:PosX[MAX_PLAYERS],
Float:PosY[MAX_PLAYERS],
Float:PosZ[MAX_PLAYERS],
Float:PosA[MAX_PLAYERS],
pSkin[MAX_PLAYERS],
pScore[MAX_PLAYERS],
pInterior[MAX_PLAYERS],
pVirtualWorld[MAX_PLAYERS],
pDinheiro[MAX_PLAYERS];
PHP код:
public OnPlayerConnect(playerid)
{
new arquivo[50],name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(arquivo, sizeof(arquivo), "Contas/n%sInfos.ini", name);
if(DOF2_FileExists(arquivo)){
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Logue\nLogue", "Confirmar", "Sair");
}else{
ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, "Registro", "Registre\nRegistre", "Confirmar", "Sair");
}
return 1;
}
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new arquivo[50],name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(arquivo, sizeof(arquivo), "Contas/n%sInfos.ini", name);
GetPlayerPos(playerid, PosX[playerid],PosY[playerid],PosZ[playerid]);
GetPlayerFacingAngle(playerid, PosA[playerid]);
DOF2_SetInt(arquivo, "Dinheiro", GetPlayerMoney(playerid));
DOF2_SetFloat(arquivo, "PosX", PosX[playerid]);
DOF2_SetFloat(arquivo, "PosY", PosY[playerid]);
DOF2_SetFloat(arquivo, "PosZ", PosZ[playerid]);
DOF2_SetFloat(arquivo, "PosA", PosA[playerid]);
DOF2_SetInt(arquivo, "Skin", GetPlayerSkin(playerid));
DOF2_SetInt(arquivo, "Score", GetPlayerScore(playerid));
DOF2_SetInt(arquivo, "Interior", GetPlayerInterior(playerid));
DOF2_SetInt(arquivo, "VirtualWorld", GetPlayerVirtualWorld(playerid));
DOF2_SetInt(arquivo, "Dinheiro",GetPlayerMoney(playerid));
DOF2_SaveFile();
return 1;
}
PHP код:
public OnPlayerSpawn(playerid)
{
new arquivo[50],name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(arquivo, sizeof(arquivo), "Contas/n%sInfos.ini", name);
PosX[playerid] = DOF2_GetFloat(arquivo, "PosX");
PosY[playerid] = DOF2_GetFloat(arquivo, "PosY");
PosZ[playerid] = DOF2_GetFloat(arquivo, "PosZ");
PosA[playerid] = DOF2_GetFloat(arquivo, "PosA");
pInterior[playerid] = DOF2_GetInt(arquivo, "Interior");
pScore[playerid] = DOF2_GetInt(arquivo, "Score");
pSkin[playerid] = DOF2_GetInt(arquivo, "Skin");
pVirtualWorld[playerid] = DOF2_GetInt(arquivo, "VirtualWorld");
pDinheiro[playerid] = DOF2_GetInt(arquivo, "Dinheiro");
SetPlayerPos(playerid, PosX[playerid],PosY[playerid],PosZ[playerid]);
SetPlayerFacingAngle(playerid, PosA[playerid]);
SetPlayerInterior(playerid, pInterior[playerid]);
SetPlayerScore(playerid, pScore[playerid]);
SetPlayerSkin(playerid, pSkin[playerid]);
SetPlayerVirtualWorld(playerid , pVirtualWorld[playerid]);
GivePlayerMoney(playerid, pDinheiro[playerid]);
return 1;
}
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new arquivo[50],name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(arquivo, sizeof(arquivo), "Contas/n%sInfos.ini", name);
// ==
if(dialogid == DIALOG_REGISTRO){
if(strlen(inputtext) < 4){
SendClientMessage(playerid, -1, "Senha pequena");
ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, "Registro", "Registre\nRegistre", "Confirmar", "Sair");
}else{
DOF2_CreateFile(arquivo);
DOF2_SetString(arquivo, "Senha", inputtext);
DOF2_SetInt(arquivo, "Dinheiro", 1000);
DOF2_SetFloat(arquivo, "PosX", 1139.4064);
DOF2_SetFloat(arquivo, "PosY", -1761.9249);
DOF2_SetFloat(arquivo, "PosZ", 13.5955);
DOF2_SetFloat(arquivo, "PosA", 4.5833);
DOF2_SaveFile();
SendClientMessage(playerid, -1, "Conta criada");
SpawnPlayer(playerid);
GivePlayerMoney(playerid, DOF2_GetInt(arquivo, "Dinheiro"));
}
}
if(!response){
Kick(playerid);
return 1;
}
// ==
if(dialogid == DIALOG_LOGIN){
if(!response){
Kick(playerid);
return 1;
}
if(strcmp(inputtext, DOF2_GetString(arquivo, "Senha"), true) == 0){
SpawnPlayer(playerid);
}else{
SendClientMessage(playerid, -1, "Senha errada");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Logue\nLogue", "Confirmar", "Sair");
return 1;
}
}
return 1;
}