Como eu faзo pra salvar a gangue e spawnar o player quando logar?
public OnPlayerRequestClass
Code:
{
if(classid == 0)
{
Gang[playerid] = 0;
GameTextForPlayer(playerid,"~g~Groove Street",5000,5);
}
else if(classid == 1)
{
Gang[playerid] = 0;
GameTextForPlayer(playerid,"~g~Groove Street",5000,5);
}
else if(classid == 2)
{
Gang[playerid] = 1;
GameTextForPlayer(playerid,"~b~Gang Dos Ballas",5000,5);
}
else if(classid == 3)
{
Gang[playerid] = 1;
GameTextForPlayer(playerid,"~b~Gang dos Ballas",5000,5);
}
else if(classid == 4)
{
Gang[playerid] = 2;
GameTextForPlayer(playerid,"~y~Gang dos Vagos",5000,5);
}
else if(classid == 5)
{
Gang[playerid] = 2;
GameTextForPlayer(playerid,"~y~Gang dos Vagos",5000,5);
}
else if(classid == 6)
{
Gang[playerid] = 3;
GameTextForPlayer(playerid,"~b~Gang dos Aztecas",5000,5);
}
else if(classid == 7)
{
Gang[playerid] = 3;
GameTextForPlayer(playerid,"~b~Gang dos Aztecas",5000,5);
}
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
SetPlayerFacingAngle(playerid, 270 );
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); //smooth dancing
CreateExplosion(212.9525,1822.9084,6.4141, 11, 10.0);
return 1;
}
public OnPlayerConnect
Code:
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);
OnPlayerCommandText(playerid,"/top5");
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);
public OnPlayerSpawn
Code:
{
switch(Gang[playerid])
{
case 0: // Classid 0
{
SetPlayerTeam(playerid, 0);
SetPlayerPos(playerid,2529.2434,-1667.5001,15.1688);
SetPlayerColor(playerid,COR_Verde);
GivePlayerMoney(playerid, 1000);
}
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);
SetPlayerPos(playerid, 2232.2813,-1158.4985,29.7969);
GivePlayerMoney(playerid, 1000);
}
}
GangZoneShowForPlayer(playerid, Groove, gzcolor[0]);
GangZoneShowForPlayer(playerid, Ballas, gzcolor[1]);
GangZoneShowForPlayer(playerid, Vagos, gzcolor[2]);
GangZoneShowForPlayer(playerid, Aztecas, gzcolor[3]);
return 1;
}
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]);
StopAudioStreamForPlayer(playerid);
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);
}
}
}
}
Code:
stock PlayerName(playerid)
{
new Name[MAX_PLAYERS];
GetPlayerName(playerid, Name, sizeof(Name));
return Name;
}
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;
}