SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/03/2018, 12:56 AM   #1
ServerFiles
Little Clucker
 
Join Date: Dec 2017
Posts: 18
Reputation: 0
Default Account register sometimes doesn't work properly.

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.

PHP Code:
stock RegisterResponse(playeridparams[])
{
    if(
PlayerTemp[playerid][loggedIn]) return SendClientMessage(playerid,COLOR_SYSTEM_GM,"Already authed.");
    if(
strlen(params) > 40 || strlen(params) < || !strlen(params))
    {
        
SendClientError(playerid"Invalid password attempt, please try again.");
        
ShowDialog(playeridDIALOG_REGISTER);
         return 
1;
    }
    else
    {
        new 
iQuery[528];
        
WP_Hash(PlayerTemp[playerid][ppassword], 129params);
        
mysql_format(MySQLPipelineiQuerysizeof(iQuery), "INSERT INTO `PlayerInfo` (`PlayerName`, `Password`) VALUES ('%e', '%s')"PlayerName(playerid), PlayerTemp[playerid][ppassword]);
        
mysql_pquery(MySQLPipelineiQuery);
        new 
string128 ];
        
format(stringsizeof(string), "3[ REGISTER ] %s[%d] has registered."PlayerName(playerid), playerid);
        
iEcho(string);
        
ShortCutLoad(playerid);
    }
    return 
true;
}

stock ShortCutLoad(playerid)
{
    new 
iQuery[428];
    
mysql_format(MySQLPipelineiQuerysizeof(iQuery), "SELECT * FROM `PlayerInfo` WHERE `PlayerName` = '%e' AND `Password` = '%s' LIMIT 1"PlayerName(playerid), PlayerTemp[playerid][ppassword]);
    
mysql_pquery(MySQLPipelineiQuery"LoadPlayerAccount""d"playerid);
    return 
1;

PHP Code:
function:OnCheckPlayerAccount(playerid)
{
    new 
rowsfields;
    
cache_get_data(rowsfieldsMySQLPipeline);
    if(
rows)
    {
        new 
pPassword[129];
        
cache_get_field_content(0"Password"pPasswordMySQLPipeline);
        
myStrcpy(PlayerTemp[playerid][ppassword], pPassword);
        
ShowDialog(playeridDIALOG_LOGIN);
    }
    else 
ShowDialog(playeridDIALOG_REGISTER);

PHP Code:
        /*            [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(0MAX_DRUG_TYPESPlayerInfo[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(playerid0);
        
/*            [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(playeridPlayerTemp[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(playeridPlayerTemp[playerid][InfoBox]);
        
TextDrawHideForPlayer(playeridPlayerTemp[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(playeridPlayerTemp[playerid][Cargo]);
        
TextDrawHideForPlayer(playeridPlayerTemp[playerid][Harvest]);
        
TextDrawHideForPlayer(playeridPlayerTemp[playerid][plrwarning]);
        
TextDrawHideForPlayer(playeridPlayerTemp[playerid][jailtd]);
        
TextDrawHideForPlayer(playeridPlayerTemp[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 
013c++)
        {
            
PlayerTemp[playerid][PlayerWeapon][c] = 0;
            
PlayerTemp[playerid][PlayerAmmo][c] = 0;
        }
        for(new 
03c++) 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(playerid0);
        
SetPlayerWantedLevel(playerid0);
        
SetPlayerScore(playerid0); 
ServerFiles is offline   Reply With Quote
Old 14/03/2018, 06:36 AM   #2
wallen
Huge Clucker
 
wallen's Avatar
 
Join Date: Aug 2015
Location: Italia
Posts: 264
Reputation: 11
Default Re: Account register sometimes doesn't work properly.

Try debug it
__________________
Los Santos DM Battleground
wallen is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
UCP doesn't work properly Sc0pion Scripting Help 12 28/04/2017 05:16 PM
KEY_YES doesn't work properly? [+Rep] Amit1998 Scripting Help 2 07/03/2016 12:16 AM
Attach3DTextLabelToVehicle doesn't work properly. Drago987 Scripting Help 2 09/10/2014 10:48 PM
[Help]My SA-MP doesn't work properly. Chloride Client Support 5 31/07/2014 11:06 AM
Account doesn't save properly Bartels Scripting Help 2 29/01/2012 03:15 PM


All times are GMT. The time now is 12:31 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.