14.03.2018, 00:56
This sometimes WORKED and sometimes DOESN'T.
The problem is, when people joined and register, sometimes it doesn't show a dialog and doesn't register the player account correctly (example, level 0, money 0, and spawned inside house number 0) and sometimes it worked correctly. I don't understand whats the problem here.
The problem is, when people joined and register, sometimes it doesn't show a dialog and doesn't register the player account correctly (example, level 0, money 0, and spawned inside house number 0) and sometimes it worked correctly. I don't understand whats the problem here.
PHP код:
stock RegisterResponse(playerid, params[])
{
if(PlayerTemp[playerid][loggedIn]) return SendClientMessage(playerid,COLOR_SYSTEM_GM,"Already authed.");
if(strlen(params) > 40 || strlen(params) < 5 || !strlen(params))
{
SendClientError(playerid, "Invalid password attempt, please try again.");
ShowDialog(playerid, DIALOG_REGISTER);
return 1;
}
else
{
new iQuery[528];
WP_Hash(PlayerTemp[playerid][ppassword], 129, params);
mysql_format(MySQLPipeline, iQuery, sizeof(iQuery), "INSERT INTO `PlayerInfo` (`PlayerName`, `Password`) VALUES ('%e', '%s')", PlayerName(playerid), PlayerTemp[playerid][ppassword]);
mysql_pquery(MySQLPipeline, iQuery);
new string[ 128 ];
format(string, sizeof(string), "3[ REGISTER ] %s[%d] has registered.", PlayerName(playerid), playerid);
iEcho(string);
ShortCutLoad(playerid);
}
return true;
}
stock ShortCutLoad(playerid)
{
new iQuery[428];
mysql_format(MySQLPipeline, iQuery, sizeof(iQuery), "SELECT * FROM `PlayerInfo` WHERE `PlayerName` = '%e' AND `Password` = '%s' LIMIT 1", PlayerName(playerid), PlayerTemp[playerid][ppassword]);
mysql_pquery(MySQLPipeline, iQuery, "LoadPlayerAccount", "d", playerid);
return 1;
}
PHP код:
function:OnCheckPlayerAccount(playerid)
{
new rows, fields;
cache_get_data(rows, fields, MySQLPipeline);
if(rows)
{
new pPassword[129];
cache_get_field_content(0, "Password", pPassword, MySQLPipeline);
myStrcpy(PlayerTemp[playerid][ppassword], pPassword);
ShowDialog(playerid, DIALOG_LOGIN);
}
else ShowDialog(playerid, DIALOG_REGISTER);
}
PHP код:
/* [PlayerInfo] */
PlayerInfo[playerid][SQL_ID] = -1;
PlayerInfo[playerid][bank] = 0;
PlayerInfo[playerid][playerlvl] = 5;
PlayerInfo[playerid][rpoints] = 0;
PlayerInfo[playerid][rpoints] = 0;
PlayerInfo[playerid][playertime] = 0;
PlayerInfo[playerid][jail] = 0;
myStrcpy(PlayerInfo[playerid][jailreason], "None");
PlayerInfo[playerid][jailtime] = 0;
PlayerInfo[playerid][banned] = 0;
myStrcpy(PlayerInfo[playerid][banreason], "None");
myStrcpy(PlayerInfo[playerid][whobannedme], "NoBodY");
myStrcpy(PlayerInfo[playerid][whenigotbanned], "Never");
PlayerInfo[playerid][Skin] = 7;
PlayerInfo[playerid][ranklvl] = 0;
PlayerInfo[playerid][rentprice] = 0;
PlayerInfo[playerid][driverlic] = 0;
PlayerInfo[playerid][flylic] = 0;
PlayerInfo[playerid][boatlic] = 0;
PlayerInfo[playerid][weaplic] = 0;
PlayerInfo[playerid][jobskill] = 0;
PlayerInfo[playerid][totalpayt] = 0;
PlayerInfo[playerid][kills] = 0;
PlayerInfo[playerid][deaths] = 0;
PlayerInfo[playerid][housenum] = -1;
PlayerInfo[playerid][loan] = 0;
PlayerInfo[playerid][guns] = 0;
PlayerInfo[playerid][sMaterials] = 0;
PlayerInfo[playerid][sdrugs] = 0;
PlayerInfo[playerid][power] = 0;
PlayerInfo[playerid][bail] = 0;
PlayerInfo[playerid][premium] = 0;
PlayerInfo[playerid][gotphone] = 0;
PlayerInfo[playerid][phonenumber] = 0;
PlayerInfo[playerid][phonebook] = 0;
PlayerInfo[playerid][laptop] = 0;
PlayerInfo[playerid][age] = 0;
PlayerInfo[playerid][premiumexpire] = 0;
PlayerInfo[playerid][playerteam] = 255;
PlayerInfo[playerid][radio] = 0;
PlayerInfo[playerid][freq1] = INVALID_RADIO_FREQ;
PlayerInfo[playerid][freq2] = INVALID_RADIO_FREQ;
PlayerInfo[playerid][freq3] = INVALID_RADIO_FREQ;
PlayerInfo[playerid][tbanned] = 0;
myStrcpy(PlayerInfo[playerid][job], "None");
PlayerInfo[playerid][totalruns] = 0;
PlayerInfo[playerid][fpay] = 0;
LOOP:c(0, MAX_DRUG_TYPES) PlayerInfo[playerid][hasdrugs][c] = 0;
PlayerInfo[playerid][warns] = 0;
PlayerInfo[playerid][helper] = 0;
PlayerInfo[playerid][curfreq] = 0;
myStrcpy(PlayerInfo[playerid][rankname], "CIV");
PlayerInfo[playerid][phonechanges] = 0;
PlayerInfo[playerid][namechanges] = 0;
PlayerInfo[playerid][lastonline] = 0;
PlayerInfo[playerid][vMax] = 0;
PlayerInfo[playerid][vSpawnMax] = 0;
PlayerInfo[playerid][pbkills] = 0;
PlayerInfo[playerid][pbdeaths] = 0;
PlayerInfo[playerid][pGender] = 0;
PlayerInfo[playerid][pEthnicity] = 0;
PlayerInfo[playerid][pBoomBox] = 0;
PlayerInfo[playerid][allowCBug] = 0;
PlayerInfo[playerid][pBoomBoxBan] = 0;
PlayerInfo[playerid][wantedLvl] = 0;
SetPlayerWantedLevel(playerid, 0);
/* [PlayerTemp] */
ResetPlayerWeaponsEx(playerid);
PlayerTemp[playerid][sm] = 0;
PlayerTemp[playerid][candrop] = 0;
PlayerTemp[playerid][Duty] = 0;
PlayerTemp[playerid][callingtaxi] = 0;
PlayerTemp[playerid][phoneoff] = 0;
PlayerTemp[playerid][oocoff] = 0;
PlayerTemp[playerid][tokick] = 0;
PlayerTemp[playerid][onphone] = INVALID_PLAYER_ID;
PlayerTemp[playerid][phone] = 0;
PlayerTemp[playerid][muted] = 0;
PlayerTemp[playerid][mutedtick] = 0;
PlayerTemp[playerid][rentcar] = 0;
PlayerTemp[playerid][carfrozen] = 0;
PlayerTemp[playerid][wlock] = 0;
PlayerTemp[playerid][tmphouse] = -1;
PlayerTemp[playerid][tmpbiz] = -1;
PlayerTemp[playerid][jqmessage] = 0;
PlayerTemp[playerid][hname] = 0;
PlayerTemp[playerid][onpaint] = 0;
PlayerTemp[playerid][pbteam] = 0;
PlayerTemp[playerid][playertosms] = INVALID_PLAYER_ID;
PlayerTemp[playerid][adminduty] = 0;
PlayerTemp[playerid][helperduty] = 0;
PlayerTemp[playerid][adminspy] = 0;
PlayerTemp[playerid][admincmdspy] = 0;
PlayerTemp[playerid][DropTimer] = 0;
PlayerTemp[playerid][isdropping] = 0;
TextDrawHideForPlayer(playerid, PlayerTemp[playerid][Status]);
myStrcpy(PlayerTemp[playerid][IP], "0.0.0.0");
PlayerTemp[playerid][canrob] = 0;
PlayerTemp[playerid][RobTimer] = 0;
PlayerTemp[playerid][spawnrdy] = 0;
PlayerTemp[playerid][WrongPass] = 0;
PlayerTemp[playerid][cmdtick] = 0;
PlayerTemp[playerid][tp] = 0;
PlayerTemp[playerid][hashadhelp] = 0;
PlayerTemp[playerid][RobBizTimer] = 0;
PlayerTemp[playerid][seeds] = 0;
PlayerTemp[playerid][drugtick] = 0;
PlayerTemp[playerid][fishamount] = 0;
PlayerTemp[playerid][fishtick] = 0;
PlayerTemp[playerid][fontick] = 0;
PlayerTemp[playerid][lictimer] = 0;
myStrcpy(PlayerTemp[playerid][ppassword], "Nothing");
PlayerTemp[playerid][totalfish] = 0;
PlayerTemp[playerid][totalrob] = 0;
PlayerTemp[playerid][totalguns] = 0;
PlayerTemp[playerid][totallogin] = 0;
TextDrawHideForPlayer(playerid, PlayerTemp[playerid][InfoBox]);
TextDrawHideForPlayer(playerid, PlayerTemp[playerid][InfoBoxTitle]);
PlayerTemp[playerid][key_enter] = 2;
PlayerTemp[playerid][imprisoned] = 2;
PlayerTemp[playerid][HasRedScreen] = 2;
PlayerTemp[playerid][RobbingHouse] = -1;
PlayerTemp[playerid][GYM_CURKEY] = 0;
PlayerTemp[playerid][GYM_CURDONE] = 0;
PlayerTemp[playerid][oocmode] = 0;
PlayerTemp[playerid][fightstyleleft] = 0;
PlayerTemp[playerid][lastpm] = INVALID_PLAYER_ID;
PlayerTemp[playerid][PlayerUsingBug] = 0;
PlayerTemp[playerid][PlayerBugTimer] = 0;
PlayerTemp[playerid][animation] = 0;
PlayerTemp[playerid][pupdates] = 0;
PlayerTemp[playerid][CPTimer] = 0;
PlayerTemp[playerid][airbreakcount] = 0;
PlayerTemp[playerid][BlindFold] = false;
PlayerTemp[playerid][iconcount] = 0;
PlayerTemp[playerid][cuffed] = false;
PlayerTemp[playerid][weapon] = 0;
PlayerTemp[playerid][ammo] = 0;
PlayerTemp[playerid][tazed] = 0;
PlayerTemp[playerid][gettingTreatmentFromHospital] = false;
TextDrawHideForPlayer(playerid, PlayerTemp[playerid][Cargo]);
TextDrawHideForPlayer(playerid, PlayerTemp[playerid][Harvest]);
TextDrawHideForPlayer(playerid, PlayerTemp[playerid][plrwarning]);
TextDrawHideForPlayer(playerid, PlayerTemp[playerid][jailtd]);
TextDrawHideForPlayer(playerid, PlayerTemp[playerid][LocationTD]);
PlayerTemp[playerid][pFurnitureCategorySelect][MAIN_CATEGORY_SELECT] = -1;
PlayerTemp[playerid][pFurnitureCategorySelect][SUB_CATEGORY_SELECT] = -1;
PlayerTemp[playerid][pFurnitureSelectID] = -1;
PlayerTemp[playerid][pMaterialSlotEdit] = -1;
PlayerTemp[playerid][pAFK] = 0;
PlayerTemp[playerid][spectatingID] = 0;
PlayerTemp[playerid][gPlayerUsingLoopingAnim] = 0;
PlayerTemp[playerid][gPlayerAnimLibsPreloaded] = 0;
PlayerTemp[playerid][ticket] = 0;
PlayerTemp[playerid][isCCTV] = 0;
PlayerTemp[playerid][loggedIn] = false;
PlayerTemp[playerid][jobDuty] = false;
for(new c = 0; c < 13; c++)
{
PlayerTemp[playerid][PlayerWeapon][c] = 0;
PlayerTemp[playerid][PlayerAmmo][c] = 0;
}
for(new c = 0; c < 3; c++) PlayerTemp[playerid][PlayerPosition][c] = 0.0;
PlayerTemp[playerid][PlayerHealth] = 0.0;
PlayerTemp[playerid][PlayerArmour] = 0.0;
PlayerTemp[playerid][PlayerInterior] = 0;
PlayerTemp[playerid][PlayerVirtualWorld] = 0;
PlayerTemp[playerid][RecentlyShot] = 0;
SetPlayerMoney(playerid, 0);
SetPlayerWantedLevel(playerid, 0);
SetPlayerScore(playerid, 0);