17.02.2018, 18:36
OnPlayerConnect:
CheckUser:
After login it will go to LoadPlayerData
Код:
public OnPlayerConnect(playerid) { pInfo[playerid][RemainingAtt] = 3; pInfo[playerid][pWarns] = 0; pInfo[playerid][pFaction] = 0; pInfo[playerid][pFactionPunish] = 0; pInfo[playerid][pFactionWarns] = 0; pInfo[playerid][pFactionRank] = 0; pInfo[playerid][pHouse] = 0; pInfo[playerid][pDrugs] = 0; pInfo[playerid][pMaterials] = 0; pInfo[playerid][pHiddens] = 0; pInfo[playerid][pAdmin] = 0; pInfo[playerid][pHelper] = 0; pInfo[playerid][pRespect] = 0; pInfo[playerid][pHours] = 0; pInfo[playerid][pCash] = 500000; pInfo[playerid][pPremiumPoints] = 0; pInfo[playerid][pLevel] = 0; pInfo[playerid][pLogged] = 0; pInfo[playerid][pPhoneNr] = 0; pInfo[playerid][pEmail] = 0; pInfo[playerid][pAge] = 0; pInfo[playerid][pSex] = 0; pInfo[playerid][pLanguage] = 0; pInfo[playerid][pRentedHouse] = 0; pInfo[playerid][pBankMoney] = 0; pInfo[playerid][pPremiumAccount] = 0; pInfo[playerid][pTreasurePoints] = 0; pInfo[playerid][pMuted] = 0; pInfo[playerid][pMutedTime] = 0; pInfo[playerid][pGasCan] = 0; pInfo[playerid][pIsRefuelling] = 0; pInfo[playerid][pFireWorks] = 0; pInfo[playerid][pPhonebook] = 0; pInfo[playerid][pWanted] = 0; pInfo[playerid][pWantedTime] = 0; pInfo[playerid][pJailed] = 0; pInfo[playerid][pJailTime] = 0; pInfo[playerid][pBiz] = 0; pInfo[playerid][pCarLic] = 0; pInfo[playerid][pCarLicT] = 0; pInfo[playerid][pCarLicSuspended] = 0; pInfo[playerid][pGunLic] = 0; pInfo[playerid][pGunLicT] = 0; pInfo[playerid][pGunLicSuspended] = 0; pInfo[playerid][pFlyLic] = 0; pInfo[playerid][pFlyLicT] = 0; pInfo[playerid][pBoatLic] = 0; pInfo[playerid][pBoatLicT] = 0; pInfo[playerid][pPayday] = 0; pInfo[playerid][pJob] = 0; pInfo[playerid][pRobSkill] = 1; pInfo[playerid][pRobTimes] = 0; pInfo[playerid][pRobRem] = 30; pInfo[playerid][pTruckSkill] = 1; pInfo[playerid][pTruckTimes] = 0; pInfo[playerid][pTruckRem] = 26; pInfo[playerid][pPizzaSkill] = 1; pInfo[playerid][pPizzaTimes] = 0; pInfo[playerid][pPizzaRem] = 26; pInfo[playerid][pFishSkill] = 1; pInfo[playerid][pFishTimes] = 0; pInfo[playerid][pFishRem] = 26; pInfo[playerid][pHackerSkill] = 1; pInfo[playerid][pHackerTimes] = 0; pInfo[playerid][pHackerRem] = 50; pInfo[playerid][pBusSkill] = 1; pInfo[playerid][pBusTimes] = 0; pInfo[playerid][pBusRem] = 26; pInfo[playerid][pGarbageSkill] = 1; pInfo[playerid][pGarbageTimes] = 0; pInfo[playerid][pGarbageRem] = 40; pInfo[playerid][pFarmSkill] = 1; pInfo[playerid][pFarmTimes] = 0; pInfo[playerid][pFarmRem] = 26; pInfo[playerid][pRobPoints] = 0; pInfo[playerid][pSleeping] = 0; pInfo[playerid][pRented] = 0; pInfo[playerid][pWTalkie] = 0; pInfo[playerid][pWTalkieChannel] = 0; pInfo[playerid][pNewbieTimeout] = 0; pInfo[playerid][pCredits] = 0; pInfo[playerid][pFightingStyle] = 0; pInfo[playerid][pCarSlots] = 3; pInfo[playerid][pHudHealth] = 0; pInfo[playerid][pHudArmour] = 0; pInfo[playerid][pHudPayDays] = 0; pInfo[playerid][pHudStatus] = 0; pInfo[playerid][pHudSkills] = 0; pInfo[playerid][pHudShowFPS] = 0; for(new idd; idd < MAX_PERSONAL_VEHICLES; idd++) { pInfo[playerid][pCarID][idd] = 0; pInfo[playerid][pCar][idd] = -1; pInfo[playerid][pCarModel][idd] = 0; pInfo[playerid][pCarLocX][idd] = 0.0; pInfo[playerid][pCarLocY][idd] = 0.0; pInfo[playerid][pCarLocZ][idd] = 0.0; pInfo[playerid][pCarAngle][idd] = 0.0; pInfo[playerid][pCarLLocX][idd] = 0.0; pInfo[playerid][pCarLLocY][idd] = 0.0; pInfo[playerid][pCarLLocZ][idd] = 0.0; pInfo[playerid][pCarAngle2][idd] = 0.0; pInfo[playerid][pCarBuyTime][idd] = 0; pInfo[playerid][pCarColor1][idd] = 1; pInfo[playerid][pCarColor2][idd] = 1; pInfo[playerid][pCarLock][idd] = 0; pInfo[playerid][pCarInsPrice][idd] = 0; pInfo[playerid][pCarIns][idd] = 0; pInfo[playerid][pCarKM][idd] = 0.0; pInfo[playerid][pCarVIP][idd] = 0; pInfo[playerid][pCarVipColors][idd] = 0; pInfo[playerid][pCarKMLast][idd] = 0; pInfo[playerid][pCarHP][idd] = 0.0; pInfo[playerid][pCarDamage1][idd] = 0; pInfo[playerid][pCarDamage2][idd] = 0; pInfo[playerid][pCarDamage3][idd] = 0; pInfo[playerid][pCarDamage4][idd] = 0; pInfo[playerid][pCarGas][idd] = 0; pInfo[playerid][pCarPaintJ][idd] = 6; CarVipName[playerid][idd] = ""; CarPlate[playerid][idd] = ""; CarOwner[playerid][idd] = ""; } BigEar[playerid] = 0; InitFly(playerid); GetPlayerName(playerid, pInfo[playerid][pName], MAX_PLAYER_NAME); TogglePlayerSpectating(playerid, true); ClearChatForPlayer(playerid); SCM(playerid, COLOR_DEFAULT, ""alb"SERVER: "w"Welcome to OldStyle RPG"); GameTextForPlayer(playerid, "~w~Please wait.~n~~r~CHECKING BAN STATUS...", 2500, 3); SetTimerEx("CheckUser", 2000, false, "i", playerid); AntiABImmunity[playerid] = gettime() + 5; return 1; }
Код:
public CheckUser(playerid) { new CheckBanQuery[255], rows; mysql_format(Database, CheckBanQuery, sizeof(CheckBanQuery), "SELECT * FROM `bans` WHERE `Username`='%s'", pInfo[playerid][pName]); mysql_query(Database, CheckBanQuery); cache_get_row_count(rows); if(rows) { new string[255]; cache_get_value_name(0, "Admin", bInfo[playerid][bAdmin], MAX_PLAYER_NAME); cache_get_value_name(0, "ExpireOn", bInfo[playerid][bExpireOn], 255); cache_get_value_name(0, "Reason", bInfo[playerid][bReason], 255); cache_get_value_name(0, "Date", bInfo[playerid][bDate], 255); cache_get_value_name(0, "Time", bInfo[playerid][bTime], 255); format(string, sizeof(string), "This account (%s) is banned.", pInfo[playerid][pName]); SCM(playerid, COLOR_BAN, string); format(string, sizeof(string), "Banned by: %s on %d %d, reason: %s", bInfo[playerid][bAdmin], bInfo[playerid][bDate], bInfo[playerid][bTime], bInfo[playerid][bReason]); SCM(playerid, COLOR_DEFAULT, string); if(strcmp(bInfo[playerid][bExpireOn], "permanent", true) == 0) { SCM(playerid, COLOR_DEFAULT, "This is a permanent ban"); } else { format(string, sizeof(string), "Ban will expire on %d %d", bInfo[playerid][bExpireOn], bInfo[playerid][bTime]); SCM(playerid, COLOR_DEFAULT, string); } SCM(playerid, COLOR_DEFAULT, "Poti face o cerere de unban pe **PANEL**, daca consideri ca ai luat ban degeaba."); KickEx(playerid); return 1; } else { new UserCheckQuery[255]; mysql_format(Database, UserCheckQuery, sizeof(UserCheckQuery), "SELECT * FROM `users` WHERE `Username` = '%s'", pInfo[playerid][pName]); mysql_query(Database, UserCheckQuery); cache_get_row_count(rows); if(rows) { cache_get_value_name(0, "Password", pInfo[playerid][pPassword], 65); cache_get_value_name(0, "Salt", pInfo[playerid][pSalt], 11); cache_get_value_int(0, "TutorialEnded", pInfo[playerid][pTutorialEnded]); SCM(playerid, COLOR_WHITE, ""alb"SERVER: "w"You already have a registered account, please enter your password into the dialog box."); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "SERVER: Login", "Welcome to OldStyle RPG.\n\nPlease enter your password below.", "Login", "Cancel"); } else { SCM(playerid, COLOR_WHITE, ""alb"SERVER: "w"You aren't registered yet, please your desired password in the dialog box to register."); ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "SERVER: Registration", "Welcome to OldStyle RPG.\n\nPlease enter your desired password below.", "Register", "Cancel"); } TextDrawShowForPlayer(playerid, Text:blackbox); } return 1; }