[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
#2

mano vocк posto tudo bagunзado dialog com tudo misturado poste cada callback separada se nгo ninguem vai ententer.. teste para ver se da problemas..

@edit sу testar

OnPlayerRequestClass
PHP код:
/*-----------------------------------------------------------------*/
if(Logado[playerid]== false){
    
format(Stringsizeof(String), PastaPpName(playerid));
    if(
dini_Exists(String)){    
        
Logar(playerid);
    }else{
        
Registrar(playerid);
    }
}
new 
RCam random(5);
switch(
RCam){
    case 
0:{
        
SetPlayerCameraPos(playerid1418.7, -870.964.6);
        
SetPlayerCameraLookAt(playerid1410, -776.696.8);
    }
    case 
1:{
        
SetPlayerCameraPos(playerid806.3, -1614.787.3);
        
SetPlayerCameraLookAt(playerid722, -166670.4);
    }
    case 
2:{
        
SetPlayerCameraPos(playerid1074, -2027.154.5);
        
SetPlayerCameraLookAt(playerid1086.9, -2091.163.3);
    }
    case 
3:{
        
SetPlayerCameraPos(playerid2060.21311.767);
        
SetPlayerCameraLookAt(playerid21561288.850.1);
    }
    case 
4:{
        
SetPlayerCameraPos(playerid, -1397.71099.4205.5);
        
SetPlayerCameraLookAt(playerid, -1486.21059.6181.1);
    }
}
BWF[playerid] = TextDrawCreate(174.28990189.249984"World ~g~Fuck");
TextDrawLetterSize(BWF[playerid], 1.1420083.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(playeridBWF[playerid]);
BV[playerid] = TextDrawCreate(226.764053116.083320"Bem - Vindo");
TextDrawLetterSize(BV[playerid], 0.4499991.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(playeridBV[playerid]);
/*-----------------------------------------------------------------*/ 
Dialogs
PHP код:
/*-----------------------------------------------------------------*/
if(dialogid == DIALOG_REGISTRAR)
{
    
    if(
response)
    {
        
        if(!
strlen(inputtext) || strlen(inputtext) < || strlen(inputtext) > 15)
        {
            
            
SendClientMessage(playeridColorErro"[ ERRO ] Senha invбlida.");
            
Cadastro(playerid);
            return 
1;
        }
        
Logado[playerid] = true;
        
format(Stringsizeof(String), PastaPpName(playerid));
        
dini_Create(String);
        
dini_Set(String"Senha"inputtext);
        
SendClientMessage(playeridCerto"[ > ] Conta criada com sucesso.");
        
Bolsa(playerid);
    }
    else
    {
            
        
SendClientMessage(playeridColorErro"[ ERRO ] Vocк cancelou o registro de sua conta.");
        
Kick(playerid);
        return 
1;
    }
    return 
1;
}
if(
dialogid == DIALOG_LOGAR)
{
    
    if(
response)
    {
        
        if(!
strlen(inputtext))
        {
            
            
SendClientMessage(playeridColorErro"[ ERRO ] Senha invбlida.");
            
Logar(playerid);
            return 
1;
        }
        
format(Stringsizeof(String), PastaPpName(playerid));
        if(
strcmp(inputtextdini_Get(String"Senha"), false) == 0)
        {
            
            
SendClientMessage(playeridCerto"|| LOGADO COM SUCESSO ||");
            
SpawnPlayer(playerid);
            
CarregarDados(playerid);
            
Logado[playerid] = true;
        }
        else
        {
            
            
SendClientMessage(playeridColorErro"[ ERRO ] Senha invбlida!");
            
Logar(playerid);
            return 
1;
        }
    }
    else
    {
        
        
SendClientMessage(playeridColorErro"[ ERRO ] Vocк cancelou o login de sua.");
        
Kick(playerid);
        return 
1;
    }
    return 
1;

stocks
PHP код:
/*-----------------------------------------------------------------*/
stock SalvarDados(playerid)
{
    new
    
Float:vida,
    
Float:colete,
    
Float:P[4];
    
GetPlayerArmour(playeridcolete);
    
GetPlayerHealth(playeridvida);
    
GetPlayerPos(playeridP[0], P[1], P[2]);
    
GetPlayerFacingAngle(playeridP[3]);
    
format(Stringsizeof(String), PastaPpName(playerid));
    if(
dini_Exists(String)){
        
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, -1DIALOG_STYLE_MSGBOX"Destruindo Dialog""Server SA-MP""""");
    return 
1;
}
stock CarregarDados(playerid)
{
    
SetCameraBehindPlayer(playerid);
    
format(Stringsizeof(String), PastaPpName(playerid));
    
SetPlayerHealth(playeriddini_Float(String"Vida"));
    
SetPlayerArmour(playeriddini_Float(String"Colete"));
    
GivePlayerMoney(playeriddini_Int(String"Dinheiro"));
    
Admin[playerid] = dini_Int(String"Admin");
    
Profissao[playerid] = dini_Int(String"Profissao");
    
SetPlayerPos(playeriddini_Float(String"X"), dini_Float(String"Y"), dini_Float(String"Z"));
    
SetPlayerScore(playeriddini_Int(String"Level"));
    
SetPlayerSkin(playeriddini_Int(String"Skin"));
    
TextDrawDestroy(BWF[playerid]);
    
TextDrawDestroy(BV[playerid]);
    return 
1;

Reply
#3

Ok, desculpe, rs...

OnPlayerRequestClass
Код:
public OnPlayerRequestClass(playerid, classid)
{
	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);
	return 1;
}
Response REGISTRAR
Код:
 	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;
	}
Response LOGIN

Код:
 	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;
	    }
	    Logado[playerid] = true;
	    SendClientMessage(playerid, Certo, "|| LOGADO COM SUCESSO ||");
	    SpawnPlayer(playerid);
    	CarregarDados(playerid);
	    return 1;
	}
	return 1;
}
Stock Cadastro

Код:
 stock Cadastro(playerid)
{
	format(String, sizeof(String), ""CINZA"••• Olб "DESTAQUE"%s "CINZA"\n••• Seja bem - vindo!\n••• Checando dados... \n "VERMELHO"Vocк nгo й registrado, coloque uma senha para se registrar.", pName(playerid));
	ShowPlayerDialog(playerid, DIALOG_REGISTRAR, DIALOG_STYLE_PASSWORD, ""CINZA"CADASTRO  "AMARELO"B"VERDE"r"AZUL"a"AMARELO"s"VERDE"i"AZUL"l "WORLD"World "FUCK"Fuck "CINZA" RPG", String, "Cadastrar", "Cancelar");
	return 1;
}
Stock Logar

Код:
 stock Logar(playerid)
{
	format(String, sizeof(String), ""CINZA"••• Olб "DESTAQUE"%s "CINZA"\n••• Seja bem - vindo!\n ••• Checando dados... \n "VERMELHO"Vocк jб й registrado, coloque sua senha para logar-se.", pName(playerid));
	ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, ""CINZA"LOGIN  "AMARELO"B"VERDE"r"AZUL"a"AMARELO"s"VERDE"i"AZUL"l "WORLD"World "FUCK"Fuck "CINZA" RPG", String, "Logar", "Cancelar");
	return 1;
}
CarregarDados

Код:
 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;
}
SalvarDados

Код:
 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;
}
Espero que esteja melhor agora, rs...
Reply
#4

Alguйm sabe o problema?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)