05.06.2011, 23:16
pawn Код:
public OnPlayerLogin(playerid,password[])
{
new tmp2[256];
new string2[64];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "Contas/%s.ini", playername2);
new file[256];
format(file, sizeof(file),"Contas/%s.ini", playername2);
if (dini_Exists(string2))
{
PlayerInfo[playerid][pKey] = dini_Int(file, "Key");
PlayerInfo[playerid][pLevel] = dini_Int(file, "Level");
PlayerInfo[playerid][pAdmin] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][pDonateRank] = dini_Int(file, "DonateRank");
PlayerInfo[playerid][gPupgrade] = dini_Int(file, "UpgradePoints");
PlayerInfo[playerid][pConnectTime] = dini_Int(file, "ConnectedTime");
PlayerInfo[playerid][pReg] = dini_Int(file, "Registered");
PlayerInfo[playerid][pSex] = dini_Int(file, "Sex");
PlayerInfo[playerid][pAge] = dini_Int(file, "Age");
PlayerInfo[playerid][pOrigin] = dini_Int(file, "Origin");
PlayerInfo[playerid][pCK] = dini_Int(file, "CK");
PlayerInfo[playerid][pMuted] = dini_Int(file, "Muted");
PlayerInfo[playerid][pExp] = dini_Int(file, "Respect");
PlayerInfo[playerid][pCash] = dini_Int(file, "Money");
PlayerInfo[playerid][pAccount] = dini_Int(file, "Bank");
PlayerInfo[playerid][pCrimes] = dini_Int(file, "Crimes");
PlayerInfo[playerid][pKills] = dini_Int(file, "Kills");
PlayerInfo[playerid][pDeaths] = dini_Int(file, "Deaths");
PlayerInfo[playerid][pArrested] = dini_Int(file, "Arrested");
PlayerInfo[playerid][pWantedDeaths] = dini_Int(file, "WantedDeaths");
PlayerInfo[playerid][pPhoneBook] = dini_Int(file, "Phonebook");
PlayerInfo[playerid][pLottoNr] = dini_Int(file, "LottoNr");
PlayerInfo[playerid][pFishes] = dini_Int(file, "Fishes");
PlayerInfo[playerid][pBiggestFish] = dini_Int(file, "BiggestFish");
PlayerInfo[playerid][pJob] = dini_Int(file, "Job");
PlayerInfo[playerid][pPayCheck] = dini_Int(file, "Paycheck");
PlayerInfo[playerid][pHeadValue] = dini_Int(file, "HeadValue");
PlayerInfo[playerid][pJailed] = dini_Int(file, "Jailed");
PlayerInfo[playerid][pJailTime] = dini_Int(file, "JailTime");
PlayerInfo[playerid][pMats] = dini_Int(file, "Materials");
PlayerInfo[playerid][pDrugs] = dini_Int(file, "Drugs");
PlayerInfo[playerid][pLeader] = dini_Int(file, "Leader");
PlayerInfo[playerid][pMember] = dini_Int(file, "Member");
PlayerInfo[playerid][pFMember] = dini_Int(file, "FMember");
PlayerInfo[playerid][pRank] = dini_Int(file, "Rank");
PlayerInfo[playerid][pChar] = dini_Int(file, "Char");
PlayerInfo[playerid][pContractTime] = dini_Int(file, "ContractTime");
PlayerInfo[playerid][pDetSkill] = dini_Int(file, "DetSkill");
PlayerInfo[playerid][pSexSkill] = dini_Int(file, "SexSkill");
PlayerInfo[playerid][pBoxSkill] = dini_Int(file, "BoxSkill");
PlayerInfo[playerid][pLawSkill] = dini_Int(file, "LawSkill");
PlayerInfo[playerid][pMechSkill] = dini_Int(file, "MechSkill");
PlayerInfo[playerid][pJackSkill] = dini_Int(file, "JackSkill");
PlayerInfo[playerid][pCarSkill] = dini_Int(file, "CarSkill");
PlayerInfo[playerid][pNewsSkill] = dini_Int(file, "NewsSkill");
PlayerInfo[playerid][pDrugsSkill] = dini_Int(file, "DrugsSkill");
PlayerInfo[playerid][pCookSkill] = dini_Int(file, "CookSkill");
PlayerInfo[playerid][pFishSkill] = dini_Int(file, "FishSkill");
PlayerInfo[playerid][pSHealth] = dini_Int(file, "SHealth");
PlayerInfo[playerid][pHealth] = dini_Int(file, "Health");
PlayerInfo[playerid][pInt] = dini_Int(file, "Int");
PlayerInfo[playerid][pLocal] = dini_Int(file, "Local");
PlayerInfo[playerid][pTeam] = dini_Int(file, "Team");
PlayerInfo[playerid][pModel] = dini_Int(file, "Model");
PlayerInfo[playerid][pPnumber] = dini_Int(file, "PhoneNr");
PlayerInfo[playerid][pPhousekey] = dini_Int(file, "House");
PlayerInfo[playerid][pPbiskey] = dini_Int(file, "Bizz");
PlayerInfo[playerid][pPos_x] = dini_Int(file, "Posx");
PlayerInfo[playerid][pPos_y] = dini_Int(file, "Posy");
PlayerInfo[playerid][pPos_z] = dini_Int(file, "Posz");
PlayerInfo[playerid][pCarLic] = dini_Int(file, "CarLic");
PlayerInfo[playerid][pFlyLic] = dini_Int(file, "FlyLic");
PlayerInfo[playerid][pBoatLic] = dini_Int(file, "BoatLic");
PlayerInfo[playerid][pFishLic] = dini_Int(file, "FishLic");
PlayerInfo[playerid][pGunLic] = dini_Int(file, "GunLic");
PlayerInfo[playerid][pGun1] = dini_Int(file, "Gun1");
PlayerInfo[playerid][pGun2] = dini_Int(file, "Gun2");
PlayerInfo[playerid][pGun3] = dini_Int(file, "Gun3");
PlayerInfo[playerid][pGun4] = dini_Int(file, "Gun4");
PlayerInfo[playerid][pAmmo1] = dini_Int(file, "Ammo1");
PlayerInfo[playerid][pAmmo2] = dini_Int(file, "Ammo2");
PlayerInfo[playerid][pAmmo3] = dini_Int(file, "Ammo3");
PlayerInfo[playerid][pAmmo4] = dini_Int(file, "Ammo4");
PlayerInfo[playerid][pCarTime] = dini_Int(file, "CarTime");
PlayerInfo[playerid][pPayDay] = dini_Int(file, "PayDay");
PlayerInfo[playerid][pPayDayHad] = dini_Int(file, "PayDayHad");
PlayerInfo[playerid][pCDPlayer] = dini_Int(file, "CDPlayer");
PlayerInfo[playerid][pWins] = dini_Int(file, "Wins");
PlayerInfo[playerid][pLoses] = dini_Int(file, "Loses");
PlayerInfo[playerid][pAlcoholPerk] = dini_Int(file, "AlcoholPerk");
PlayerInfo[playerid][pDrugPerk] = dini_Int(file, "DrugPerk");
PlayerInfo[playerid][pMiserPerk] = dini_Int(file, "MiserPerk");
PlayerInfo[playerid][pPainPerk] = dini_Int(file, "PainPerk");
PlayerInfo[playerid][pTraderPerk] = dini_Int(file, "TraderPerk");
PlayerInfo[playerid][pTut] = dini_Int(file, "Tutorial");
PlayerInfo[playerid][pMissionNr] = dini_Int(file, "Mission");
PlayerInfo[playerid][pWarns] = dini_Int(file, "Warnings");
PlayerInfo[playerid][pAdjustable] = dini_Int(file, "Adjustable");
PlayerInfo[playerid][pFuel] = dini_Int(file, "Fuel");
PlayerInfo[playerid][pMarried] = dini_Int(file, "Married");
PlayerInfo[playerid][pMarriedTo] = dini_Int(file, "MarriedTo");
PlayerInfo[playerid][pDrogas] = dini_Int(file, "Maconha");
PlayerInfo[playerid][pDrogas2] = dini_Int(file, "Cocaina");
PlayerInfo[playerid][pDrogas3] = dini_Int(file, "Crack");
PlayerInfo[playerid][pSafeDrogas] = dini_Int(file, "SafeMaconha");
PlayerInfo[playerid][pSafeDrogas2] = dini_Int(file, "SafeCocaina");
PlayerInfo[playerid][pSafeDrogas3] = dini_Int(file, "SafeCrack");
PlayerInfo[playerid][psMats] = dini_Int(file, "SafeMateriais");
}
else
{
new loginstring[450];
new loginname[MAX_PLAYER_NAME];
GetPlayerName(playerid,loginname,sizeof(loginname));
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 4) { SendClientMessage(playerid, COLOR_YELLOW, "Banido por Errar a Senha 4 Vezes.");Kick(playerid); }
format(loginstring,sizeof(loginstring),"%s Seja Bem Vindo ao\nBrasil Vila Online RPG \n Digite sua Senha para Logar!\nSenha Incorreta tente Novamente!",loginname);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login", loginstring, "Logar", "Sair");
return 1;
}
PlayerInfo[playerid][pAdjustable] = 0;
ResetPlayerMoneyEx(playerid);
ConsumingMoney[playerid] = 1;
GivePlayerMoneyEx(playerid,PlayerInfo[playerid][pCash]);
CurrentMoney[playerid] = PlayerInfo[playerid][pCash];
if(PlayerInfo[playerid][pReg] == 0)
{
PlayerInfo[playerid][pLevel] = 1;
PlayerInfo[playerid][pSHealth] = 0.0;
PlayerInfo[playerid][pHealth] = 50.0;
PlayerInfo[playerid][pPos_x] = 2246.6;
PlayerInfo[playerid][pPos_y] = -1161.9;
PlayerInfo[playerid][pPos_z] = 1029.7;
PlayerInfo[playerid][pInt] = 15;
PlayerInfo[playerid][pLocal] = 255;
PlayerInfo[playerid][pTeam] = 3;
PlayerInfo[playerid][pModel] = 2;
new randphone = 1000 + random(9999);
PlayerInfo[playerid][pPnumber] = randphone;
PlayerInfo[playerid][pPhousekey] = NONE_CAR;
PlayerInfo[playerid][pPbiskey] = 255;
PlayerInfo[playerid][pAccount] = 50000;
PlayerInfo[playerid][pReg] = 1;
GivePlayerMoneyEx(playerid, 50000);
}
/*else if(PlayerInfo[playerid][pCK] > 0)
{
Kick(playerid);
}*/
format(string2, sizeof(string2), "SERVER: Bem Vindo %s",playername2);
SendClientMessage(playerid, COLOR_WHITE,string2);
printf("%s esta logado no Servidor.",playername2);
SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
if(gTeam[playerid] == 0)
{
gTeam[playerid] = 3;
}
else
{
gTeam[playerid] = PlayerInfo[playerid][pTeam];
}
if(gPlayerLogged[playerid] == 1)
{
SpawnPlayer(playerid);
}
gPlayerLogged[playerid] = 1;
SpawnPlayer(playerid);
format(tmp2, sizeof(tmp2), "~w~Bem Vindo ~n~~y~ %s", playername2);
DateProp(playerid);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SendClientMessage(playerid, COLOR_YELLOW, motd);
if(PlayerInfo[playerid][pFMember] < 255)
{
format(tmp2, sizeof(tmp2), "Family MOTD: %s.", FamilyInfo[PlayerInfo[playerid][pFMember]][FamilyMOTD]);
SendClientMessage(playerid, COLOR_YELLOW, tmp2);
}
return 1;
}