Carregar dados em DOF2 -
AdsonWalber - 26.06.2013
Pessoal eu configuro pra setar a gangue e spawnar mas nгo da certo qual serб o problema?
public OnPlayerSpawn(playerid)
Code:
case 0: // Classid 0
{
SetPlayerTeam(playerid, 0);
}
case 1: // Classid 1
{
SetPlayerTeam(playerid, 1);
GivePlayerMoney(playerid, 1000);
}
case 2: // Classid 1
{
SetPlayerTeam(playerid, 2);
GivePlayerMoney(playerid, 1000);
}
case 3: // Classid 1
{
SetPlayerTeam(playerid, 3);
GivePlayerMoney(playerid, 1000);
}
public OnPlayerConnect
Code:
SendClientMessage(playerid, 0xFFFFFFFF, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
SendClientMessage(playerid, COR_Branco, "DM/TDM Base");
SendClientMessage(playerid, COR_Branco, ""); /* Texto Inicial Logo ao Connect */
SendClientMessage(playerid, 0xFFFFFFFF, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
if(DOF2_FileExists(Contas(playerid))) ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Logar", "Vocк й registrado digite sua senha para logar!\nSe errar 5 vezes sua conta serб banida!", "Confirma", "Cancelar");
else ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, "Registro", "Vocк ainda nгo й registrado digite uma senha para se registrar!", "Confirma", "Cancelar");
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, Textdrawa);
TextDrawShowForPlayer(playerid, Textdraw1);
new pname[MAX_PLAYER_NAME];
new string[256];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "[SERVER]: %s Entrou no Servidor!", pname);
SendClientMessageToAll(0xFFED00FF, string);
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6,0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222); // MP5 crouched not aiming
public OnDialogResponse
Code:
{
if(dialogid == DIALOG_REGISTRO)
{
if(!strval(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_PASSWORD, "Registro", "Digite apenas nъmeros!\nDigite sua senha novamente para se registrar!", "Confirma", "Cancelar");
if(!response) return Kick(playerid);
else
{
Player[playerid][Senha] = strval(inputtext);
SalvarContas(playerid);
ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Logar", "Vocк se cadastrou, agora й sу logar com sua senha registrada!", "Confirma", "Cancelar");
}
}
if(dialogid == DIALOG_LOGAR)
{
if(!strval(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Logar", "Digite apenas nъmeros!\nDigite sua senha cadastrada para logar!\nSe errar 5 vezes sua conta serб banida!", "Confirma", "Cancelar");
if(!response) return Kick(playerid);
else
{
Player[playerid][Senha] = DOF2_GetInt(Contas(playerid), "Senha");
if(strval(inputtext) == Player[playerid][Senha])
{
Player[playerid][Matou] = DOF2_GetInt(Contas(playerid), "Matou");
Player[playerid][Morreu] = DOF2_GetInt(Contas(playerid), "Morreu");
Player[playerid][Dinheiro] = DOF2_GetInt(Contas(playerid), "Dinheiro");
GivePlayerMoney(playerid, Player[playerid][Dinheiro]);
Player[playerid][Gangue] = DOF2_GetInt(Contas(playerid), "Gangue");
SetPlayerTeam(playerid, Player[playerid][Gangue]);
Player[playerid][Cor] = DOF2_GetInt(Contas(playerid), "Cor");
SetPlayerColor(playerid, Player[playerid][Cor]);
Player[playerid][Cor] = DOF2_GetInt(Contas(playerid), "Skin");
SetPlayerSkin(playerid, Player[playerid][Skin]);
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Logar", "Vocк digitou sua senha errado, digite-a novamente para logar!\nSe errar 5 vezes sua conta serб banida!", "Confirma", "Cancelar");
Erro[playerid]++;
if(Erro[playerid] == 5)
{
scm(playerid, Neutra, "Sua conta estб banida por errar 5 vezes a sua senha.");
Ban(playerid);
}
}
}
}
public OnPlayerDisconnect
Code:
SalvarContas(playerid);
Code:
stock Contas(playerid)
{
new arquivo[40], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, 32);
format(arquivo, 40, "Contas/%s.ini", name);
return arquivo;
}
stock SalvarContas(playerid)
{
if(!DOF2_FileExists(Contas(playerid))) DOF2_CreateFile(Contas(playerid));
{
Player[playerid][Dinheiro] = GetPlayerMoney(playerid);
Player[playerid][Skin] = GetPlayerSkin(playerid);
Player[playerid][Gangue] = GetPlayerTeam(playerid);
Player[playerid][Cor] = GetPlayerColor(playerid);
DOF2_SetInt(Contas(playerid), "Senha", Player[playerid][Senha]);
DOF2_SetInt(Contas(playerid), "Matou", Player[playerid][Matou]);
DOF2_SetInt(Contas(playerid), "Morreu", Player[playerid][Morreu]);
DOF2_SetInt(Contas(playerid), "Dinheiro", Player[playerid][Dinheiro]);
DOF2_SetInt(Contas(playerid), "Skin", Player[playerid][Skin]);
DOF2_SetInt(Contas(playerid), "Gangue", Player[playerid][Gangue]);
DOF2_SetInt(Contas(playerid), "Cor", Player[playerid][Cor]);
DOF2_SaveFile();
}
return 1;
}
Re: Carregar dados em DOF2 -
arakuta - 26.06.2013
Tente usar SetSpawnInfo antes do SpawnPlayer.