[Ajuda] Morrer ao logar...
#1

Olб pessoal, bom eu estava com um problema no meu sistema de login com aquela coisa das setinhas, etc... e eu consegui resolver colocar o LOGIN na Callback OnPlayerRequestClass, mas sempre quando eu logo, eu comeзo a morrer do nada e vai para o Mark 0 do mapa, alguйm sabe o porque disso acontecer?

Code completo:

Код:
	new RCam = random(5);
	if(RCam == 0) {//           Vista panorвmica de Los Santos
		SetPlayerCameraPos(playerid, 1418.7, -870.9, 64.6);
		SetPlayerCameraLookAt(playerid, 1410, -776.6, 96.8);
	}
	if(RCam == 1) {//           Vinewood
    	SetPlayerCameraPos(playerid, 806.3, -1614.7, 87.3);
    	SetPlayerCameraLookAt(playerid, 722, -1666, 70.4);
	}
	if(RCam == 2) {//           Trilha
	    SetPlayerCameraPos(playerid, 1074, -2027.1, 54.5);
	    SetPlayerCameraLookAt(playerid, 1086.9, -2091.1, 63.3);
	}
	if(RCam == 3) { //          Esfinge
	    SetPlayerCameraPos(playerid, 2060.2, 1311.7, 67);
	    SetPlayerCameraLookAt(playerid, 2156, 1288.8, 50.1);
	}
	if(RCam == 4) { //          San Fierro
	    SetPlayerCameraPos(playerid, -1397.7, 1099.4, 205.5);
	    SetPlayerCameraLookAt(playerid, -1486.2, 1059.6, 181.1);
	}

	BWF[playerid] = TextDrawCreate(174.289901, 89.249984, "World ~g~Fuck");
	TextDrawLetterSize(BWF[playerid], 1.142008, 3.192497);
	TextDrawAlignment(BWF[playerid], 1);
	TextDrawColor(BWF[playerid], Azulado);
	TextDrawSetShadow(BWF[playerid], 1);
	TextDrawSetOutline(BWF[playerid], 0);
	TextDrawBackgroundColor(BWF[playerid], 51);
	TextDrawFont(BWF[playerid], 2);
	TextDrawSetProportional(BWF[playerid], 1);
	TextDrawShowForPlayer(playerid, BWF[playerid]);

	BV[playerid] = TextDrawCreate(226.764053, 116.083320, "Bem - Vindo");
	TextDrawLetterSize(BV[playerid], 0.449999, 1.600000);
	TextDrawAlignment(BV[playerid], 1);
	TextDrawColor(BV[playerid], BoasVindas2);
	TextDrawSetShadow(BV[playerid], 1);
	TextDrawSetOutline(BV[playerid], 0);
	TextDrawBackgroundColor(BV[playerid], 51);
	TextDrawFont(BV[playerid], 3);
	TextDrawSetProportional(BV[playerid], 1);
	TextDrawShowForPlayer(playerid, BV[playerid]);

 	SetPlayerPos(playerid, 0, 0, -1000);
	format(String, sizeof(String), PastaP, pName(playerid));
	if(!dini_Exists(String))
	{
	    Cadastro(playerid);
	    return 1;
	}
	Logar(playerid);

	if(dialogid == DIALOG_REGISTRAR)
	{
	    if(!response)
	    {
	        SendClientMessage(playerid, ColorErro, "[ ERRO ] Vocк cancelou o registro de sua conta.");
			Kick(playerid);
	        return 1;
	    }
	    if(!strlen(inputtext))
	    {
	        SendClientMessage(playerid, ColorErro, "[ ERRO ] Senha invбlida.");
	        Cadastro(playerid);
	        return 1;
	    }
	    if(strlen(inputtext) < 4)
	    {
	        SendClientMessage(playerid, ColorErro, "[ ERRO ] Senha muito pequena.");
	        Cadastro(playerid);
	        return 1;
	    }
	    if(strlen(inputtext) > 15)
	    {
	        SendClientMessage(playerid, ColorErro, "[ ERRO ] Senha muito grande.");
	        Cadastro(playerid);
	        return 1;
	    }
	    Logado[playerid] = true;
	    format(String, sizeof(String), PastaP, pName(playerid));
	    dini_Create(String);
	    dini_Set(String, "Senha", inputtext);
		SendClientMessage(playerid, Certo, "[ > ] Conta criada com sucesso.");
		Bolsa(playerid);
		return 1;
	}

	if(dialogid == DIALOG_LOGAR)
	{
	    if(!response)
	    {
	        SendClientMessage(playerid, ColorErro, "[ ERRO ] Vocк cancelou o login de sua.");
			Kick(playerid);
	        return 1;
	    }
	    if(!strlen(inputtext))
	    {
	        SendClientMessage(playerid, ColorErro, "[ ERRO ] Senha invбlida.");
	        Logar(playerid);
	        return 1;
	    }
	    format(String, sizeof(String), PastaP, pName(playerid));
	    if(strcmp(inputtext, dini_Get(String, "Senha"), false) != 0)
	    {
	        SendClientMessage(playerid, ColorErro, "[ ERRO ] Senha invбlida!");
	        Logar(playerid);
	        return 1;
	    }
	    SendClientMessage(playerid, Certo, "|| LOGADO COM SUCESSO ||");
	    SpawnPlayer(playerid);
    	CarregarDados(playerid);
	    return 1;
	}

stock SalvarDados(playerid)
{
	new
		Float:vida,
		Float:colete,
		Float:P[4];
	GetPlayerArmour(playerid, colete);
	GetPlayerHealth(playerid, vida);
	GetPlayerPos(playerid, P[0], P[1], P[2]);
	GetPlayerFacingAngle(playerid, P[3]);
	format(String, sizeof(String), PastaP, pName(playerid));
	dini_FloatSet(String, "X", P[0]);
	dini_FloatSet(String, "Y", P[1]);
	dini_FloatSet(String, "Z", P[2]);
	dini_FloatSet(String, "A", P[3]);
	dini_IntSet(String, "Dinheiro", GetPlayerMoney(playerid));
	dini_IntSet(String, "Level", GetPlayerScore(playerid));
	dini_FloatSet(String, "Vida", vida);
	dini_FloatSet(String, "Colete", colete);
	dini_IntSet(String, "Admin", Admin[playerid]);
	dini_IntSet(String, "Profissao", Profissao[playerid]);
	dini_IntSet(String, "Skin", GetPlayerSkin(playerid));
	return 1;
}

stock DestroyDialogForPlayer(playerid)
{
    ShowPlayerDialog(playerid, -1, DIALOG_STYLE_MSGBOX, "Destruindo Dialog", "Server SA-MP", "", "");
	return 1;
}

stock CarregarDados(playerid)
{
	SetCameraBehindPlayer(playerid);
	format(String, sizeof(String), PastaP, pName(playerid));
	SetPlayerHealth(playerid, dini_Float(String, "Vida"));
	SetPlayerArmour(playerid, dini_Float(String, "Colete"));
	GivePlayerMoney(playerid, dini_Int(String, "Dinheiro"));
	Admin[playerid] = dini_Int(String, "Admin");
	Profissao[playerid] = dini_Int(String, "Profissao");
	SetPlayerPos(playerid, dini_Float(String, "X"), dini_Float(String, "Y"), dini_Float(String, "Z"));
	SetPlayerScore(playerid, dini_Int(String, "Level"));
	SetPlayerSkin(playerid, dini_Int(String, "Skin"));
	
    TextDrawDestroy(BWF[playerid]);
    TextDrawDestroy(BV[playerid]);
	return 1;
}
Reply


Messages In This Thread
Morrer ao logar... - by DenilsonN - 02.07.2016, 08:00
Re: Morrer ao logar... - by Whoo - 02.07.2016, 23:50
Re: Morrer ao logar... - by DenilsonN - 03.07.2016, 00:01
Re: Morrer ao logar... - by DenilsonN - 04.07.2016, 03:55

Forum Jump:


Users browsing this thread: 1 Guest(s)