Load player when he clicked spawn
#1

Hello how to load player stats when he's clicked spawn button or he's spawned?

im trying but doesn't load:

Код:
forward Loadplayerdata(playerid);
public Loadplayerdata(playerid)
{
    AntiDeAMX();
    
        new szRows, szFields;
        cache_get_data(szRows, szFields, Mysql_users);
        if(szRows)
        {
            for(new i; i < szRows; i++)
            {
                cache_get_field_content(i, "Password", PlayerData[playerid][Password], Mysql_users, 129);
                cache_get_field_content(i, "Fullname", PlayerData[playerid][Fullname], Mysql_users, 126);
                PlayerData[playerid][AdminLevel] = cache_get_field_content_int(i, "AdminLevel", Mysql_users);
                PlayerData[playerid][AdminKey] = cache_get_field_content_int(i, "AdminKey", Mysql_users);
                PlayerData[playerid][AdminTime] = cache_get_field_content_int(i, "AdminTime", Mysql_users);
                PlayerData[playerid][VipLevel] = cache_get_field_content_int(i, "VipLevel", Mysql_users);
                PlayerData[playerid][VipKey] = cache_get_field_content_int(i, "VipKey", Mysql_users);
                PlayerData[playerid][VipTime] = cache_get_field_content_int(i, "VipTime", Mysql_users);
                PlayerData[playerid][Banned] = cache_get_field_content_int(i, "Banned", Mysql_users);
                cache_get_field_content(i, "BanReason", PlayerData[playerid][BanReason], Mysql_users, 126);
                cache_get_field_content(i, "BannedBy", PlayerData[playerid][BannedBy], Mysql_users, 126);
                if(gIsPlayerSpawned[playerid] == 1) //this when player spawned
                {
                    PlayerData[playerid][PositionX] = cache_get_field_content_float(i, "PositionX", Mysql_users);
                    PlayerData[playerid][PositionY] = cache_get_field_content_float(i, "PositionY", Mysql_users);
                    PlayerData[playerid][PositionZ] = cache_get_field_content_float(i, "PositionZ", Mysql_users);
                    PlayerData[playerid][PositionA] = cache_get_field_content_float(i, "PositionA", Mysql_users);
                    PlayerData[playerid][Health] = cache_get_field_content_float(i, "Health", Mysql_users);
                    PlayerData[playerid][Armour] = cache_get_field_content_float(i, "Armour", Mysql_users);
                    PlayerData[playerid][Interior] = cache_get_field_content_int(i, "Interior", Mysql_users);
                    PlayerData[playerid][VirtualWorld] = cache_get_field_content_int(i, "VirtualWorld", Mysql_users);
                    PlayerData[playerid][Warnings] = cache_get_field_content_int(i, "Warnings", Mysql_users);
                    cache_get_field_content(i, "Warning1Reason", PlayerData[playerid][Warning1Reason], Mysql_users, 126);
                    cache_get_field_content(i, "Warning2Reason", PlayerData[playerid][Warning2Reason], Mysql_users, 126);
                    cache_get_field_content(i, "Warning3Reason", PlayerData[playerid][Warning3Reason], Mysql_users, 126);
                    cache_get_field_content(i, "WarnedBy1", PlayerData[playerid][WarnedBy1], Mysql_users, 126);
                    cache_get_field_content(i, "WarnedBy2", PlayerData[playerid][WarnedBy2], Mysql_users, 126);
                    cache_get_field_content(i, "WarnedBy3", PlayerData[playerid][WarnedBy3], Mysql_users, 126);
                    PlayerData[playerid][Dead] = cache_get_field_content_int(i, "Dead", Mysql_users);
                    PlayerData[playerid][HospitalTime] = cache_get_field_content_int(i, "HospitalTime", Mysql_users);
                    PlayerData[playerid][Helper] = cache_get_field_content_int(i, "Helper", Mysql_users);
                    PlayerData[playerid][Money] = cache_get_field_content_int(i, "Money", Mysql_users);
                    PlayerData[playerid][MoneyBank] = cache_get_field_content_int(i, "MoneyBank", Mysql_users);
                    PlayerData[playerid][Score] = cache_get_field_content_int(i, "Score", Mysql_users);
                    PlayerData[playerid][Skin] = cache_get_field_content_int(i, "Skin", Mysql_users);
                    PlayerData[playerid][Day] = cache_get_field_content_int(i, "Day", Mysql_users);
                    PlayerData[playerid][Hour] = cache_get_field_content_int(i, "Hour", Mysql_users);
                    PlayerData[playerid][Min] = cache_get_field_content_int(i, "Min", Mysql_users);
                    PlayerData[playerid][Sec] = cache_get_field_content_int(i, "Sec", Mysql_users);
                    PlayerData[playerid][Kills] = cache_get_field_content_int(i, "Kills", Mysql_users);
                    PlayerData[playerid][Deaths] = cache_get_field_content_int(i, "Deaths", Mysql_users);
                    PlayerData[playerid][Kreditai] = cache_get_field_content_int(i, "Kreditai", Mysql_users);
                    PlayerData[playerid][Taskai] = cache_get_field_content_int(i, "Taskai", Mysql_users);
                    PlayerData[playerid][nLicenzija] = cache_get_field_content_int(i, "nLicenzija", Mysql_users);
                    PlayerData[playerid][Navigacija] = cache_get_field_content_int(i, "Navigacija", Mysql_users);
                    PlayerData[playerid][Radijas] = cache_get_field_content_int(i, "Radijas", Mysql_users);
                    PlayerData[playerid][Muted] = cache_get_field_content_int(i, "Muted", Mysql_users);
                    PlayerData[playerid][MutedTime] = cache_get_field_content_int(i, "MutedTime", Mysql_users);
                    PlayerData[playerid][Premium] = cache_get_field_content_int(i, "Premium", Mysql_users);
                    PlayerData[playerid][PremiumTime] = cache_get_field_content_int(i, "PremiumTime", Mysql_users);
                    // ginklai
                    PlayerData[playerid][Weapon1] = cache_get_field_content_int(i, "Weapon1", Mysql_users);
                    PlayerData[playerid][Weapona1] = cache_get_field_content_int(i, "Weapona1", Mysql_users);
                    PlayerData[playerid][Weapon2] = cache_get_field_content_int(i, "Weapon2", Mysql_users);
                    PlayerData[playerid][Weapona2] = cache_get_field_content_int(i, "Weapona2", Mysql_users);
                    PlayerData[playerid][Weapon3] = cache_get_field_content_int(i, "Weapon3", Mysql_users);
                    PlayerData[playerid][Weapona3] = cache_get_field_content_int(i, "Weapona3", Mysql_users);
                    PlayerData[playerid][Weapon4] = cache_get_field_content_int(i, "Weapon4", Mysql_users);
                    PlayerData[playerid][Weapona4] = cache_get_field_content_int(i, "Weapona4", Mysql_users);
                    PlayerData[playerid][Weapon5] = cache_get_field_content_int(i, "Weapon5", Mysql_users);
                    PlayerData[playerid][Weapona5] = cache_get_field_content_int(i, "Weapona5", Mysql_users);
                    PlayerData[playerid][Weapon6] = cache_get_field_content_int(i, "Weapon6", Mysql_users);
                    PlayerData[playerid][Weapona6] = cache_get_field_content_int(i, "Weapona6", Mysql_users);
                    PlayerData[playerid][Weapon7] = cache_get_field_content_int(i, "Weapon7", Mysql_users);
                    PlayerData[playerid][Weapona7] = cache_get_field_content_int(i, "Weapona7", Mysql_users);
                    PlayerData[playerid][Weapon8] = cache_get_field_content_int(i, "Weapon8", Mysql_users);
                    PlayerData[playerid][Weapona8] = cache_get_field_content_int(i, "Weapona8", Mysql_users);
                    PlayerData[playerid][Weapon9] = cache_get_field_content_int(i, "Weapon9", Mysql_users);
                    PlayerData[playerid][Weapona9] = cache_get_field_content_int(i, "Weapona9", Mysql_users);
                    PlayerData[playerid][Weapon10] = cache_get_field_content_int(i, "Weapon10", Mysql_users);
                    PlayerData[playerid][Weapona10] = cache_get_field_content_int(i, "Weapona10", Mysql_users);
                    PlayerData[playerid][Weapon11] = cache_get_field_content_int(i, "Weapon11", Mysql_users);
                    PlayerData[playerid][Weapona11] = cache_get_field_content_int(i, "Weapona11", Mysql_users);
                    PlayerData[playerid][Weapon12] = cache_get_field_content_int(i, "Weapon12", Mysql_users);
                    PlayerData[playerid][Weapona12] = cache_get_field_content_int(i, "Weapona12", Mysql_users);
                    // DARBAS
                    PlayerData[playerid][Job] = cache_get_field_content_int(i, "Job", Mysql_users);
                    PlayerData[playerid][JobSkin] = cache_get_field_content_int(i, "JobSkin", Mysql_users);
                    PlayerData[playerid][UseJobSkin] = cache_get_field_content_int(i, "UseJobSkin", Mysql_users);
                    PlayerData[playerid][Alga] = cache_get_field_content_int(i, "Alga", Mysql_users);
                    PlayerData[playerid][PakviestasDarbe] = cache_get_field_content_int(i, "PakviestasDarbe", Mysql_users);
                    PlayerData[playerid][Dyrikas] = cache_get_field_content_int(i, "Dyrikas", Mysql_users);
                    PlayerData[playerid][Pavaduotojas] = cache_get_field_content_int(i, "Pavaduotojas", Mysql_users);
                    PlayerData[playerid][dIspejimai] = cache_get_field_content_int(i, "dIspejimai", Mysql_users);
                    PlayerData[playerid][pIspejimai] = cache_get_field_content_int(i, "pIspejimai", Mysql_users);
                    PlayerData[playerid][DarboIspejimai] = cache_get_field_content_int(i, "DarboIspejimai", Mysql_users);
                    // TELEFONU SISTEMA
                    PlayerData[playerid][Telefonas] = cache_get_field_content_int(i, "Telefonas", Mysql_users);
                    PlayerData[playerid][Tinklas] = cache_get_field_content_int(i, "Tinklas", Mysql_users);
                    PlayerData[playerid][Numeris] = cache_get_field_content_int(i, "Numeris", Mysql_users);
                    PlayerData[playerid][tBaterijosBukle] = cache_get_field_content_int(i, "tBaterijosBukle", Mysql_users);
                    PlayerData[playerid][tBaterija] = cache_get_field_content_int(i, "tBaterija", Mysql_users);
                    PlayerData[playerid][tBukle] = cache_get_field_content_int(i, "tBukle", Mysql_users);
                    PlayerData[playerid][tPakrovejas] = cache_get_field_content_int(i, "tPakrovejas", Mysql_users);
                    PlayerData[playerid][tSaskaitoje] = cache_get_field_content_int(i, "tSaskaitoje", Mysql_users);
                    PlayerData[playerid][tPapildymas] = cache_get_field_content_int(i, "tPapildymas", Mysql_users);
                    // TELEFONU SISTEMA
                    PlayerData[playerid][Gender] = cache_get_field_content_int(i, "Gender", Mysql_users);
                    PlayerData[playerid][Wanted] = cache_get_field_content_int(i, "Wanted", Mysql_users);
                    PlayerData[playerid][pHouseID] = cache_get_field_content_int(i, "HouseID", Mysql_users);
                    PlayerData[playerid][pBusinessID] = cache_get_field_content_int(i, "BusinessID", Mysql_users);
                    cache_get_field_content(i, "Registered", PlayerData[playerid][Registered], Mysql_users, 126);
                    cache_get_field_content(i, "LastLogin", PlayerData[playerid][LastLogin], Mysql_users, 126);
                    cache_get_field_content(i, "LastIP", PlayerData[playerid][LastIP], Mysql_users, 126);
                    PlayerData[playerid][Autopilotas] = cache_get_field_content_int(i, "Autopilotas", Mysql_users);
                    PlayerData[playerid][Autopilotas2] = cache_get_field_content_int(i, "Autopilotas2", Mysql_users);
                    PlayerData[playerid][Rep] = cache_get_field_content_int(i, "Rep", Mysql_users);
                    PlayerData[playerid][RepTime] = cache_get_field_content_int(i, "RepTime", Mysql_users);
                    //Event
                    PlayerData[playerid][EventGold] = cache_get_field_content_int(i, "EventGold", Mysql_users);
                    PlayerData[playerid][EventSilver] = cache_get_field_content_int(i, "EventSilver", Mysql_users);
                    PlayerData[playerid][EventBronze] = cache_get_field_content_int(i, "EventBronze", Mysql_users);
                    // INVENTORIUS
                    JobInventorData[playerid][Picos] = cache_get_field_content_int(i, "Picos", Mysql_users);
                    // MISIJOS
                    MissionData[playerid][Misija1] = cache_get_field_content_int(i, "Misija1", Mysql_users);
                    MissionData[playerid][Misija2] = cache_get_field_content_int(i, "Misija2", Mysql_users);
                    MissionData[playerid][Misija3] = cache_get_field_content_int(i, "Misija3", Mysql_users);
                    MissionData[playerid][Misija4] = cache_get_field_content_int(i, "Misija4", Mysql_users);
                    MissionData[playerid][Misija5] = cache_get_field_content_int(i, "Misija5", Mysql_users);
                    MissionData[playerid][Misija6] = cache_get_field_content_int(i, "Misija6", Mysql_users);
                    MissionData[playerid][Misija7] = cache_get_field_content_int(i, "Misija7", Mysql_users);
                    MissionData[playerid][Misija8] = cache_get_field_content_int(i, "Misija8", Mysql_users);
                    MissionData[playerid][Misija9] = cache_get_field_content_int(i, "Misija9", Mysql_users);
                    MissionData[playerid][Misija10] = cache_get_field_content_int(i, "Misija10", Mysql_users);
                    MissionData[playerid][Misija11] = cache_get_field_content_int(i, "Misija11", Mysql_users);
                    MissionData[playerid][Misija12] = cache_get_field_content_int(i, "Misija12", Mysql_users);
                    MissionData[playerid][Misija13] = cache_get_field_content_int(i, "Misija13", Mysql_users);
                    MissionData[playerid][Misija14] = cache_get_field_content_int(i, "Misija14", Mysql_users);
                    MissionData[playerid][Misija15] = cache_get_field_content_int(i, "Misija15", Mysql_users);
                    MissionData[playerid][Misija16] = cache_get_field_content_int(i, "Misija16", Mysql_users);
                    MissionData[playerid][Misija17] = cache_get_field_content_int(i, "Misija17", Mysql_users);
                    MissionData[playerid][Misija18] = cache_get_field_content_int(i, "Misija18", Mysql_users);
                    MissionData[playerid][Misija19] = cache_get_field_content_int(i, "Misija19", Mysql_users);
                    MissionData[playerid][Misija20] = cache_get_field_content_int(i, "Misija20", Mysql_users);
                    MissionData[playerid][Misija21] = cache_get_field_content_int(i, "Misija21", Mysql_users);
                    MissionData[playerid][Misija22] = cache_get_field_content_int(i, "Misija22", Mysql_users);
                    MissionData[playerid][Misija23] = cache_get_field_content_int(i, "Misija23", Mysql_users);
                    MissionData[playerid][Misija24] = cache_get_field_content_int(i, "Misija24", Mysql_users);
                    MissionData[playerid][Misija25] = cache_get_field_content_int(i, "Misija25", Mysql_users);
                    MissionData[playerid][Misija26] = cache_get_field_content_int(i, "Misija26", Mysql_users);
                    MissionData[playerid][Misija27] = cache_get_field_content_int(i, "Misija27", Mysql_users);
                    MissionData[playerid][Misija28] = cache_get_field_content_int(i, "Misija28", Mysql_users);
                    MissionData[playerid][Misija29] = cache_get_field_content_int(i, "Misija29", Mysql_users);
                    MissionData[playerid][Misija30] = cache_get_field_content_int(i, "Misija30", Mysql_users);
                    // DARBO Patirtis
                    DarboPatirtis[playerid][Policija] = cache_get_field_content_int(i, "Policija", Mysql_users);
                    DarboPatirtis[playerid][Gydytojai] = cache_get_field_content_int(i, "Gydytojai", Mysql_users);
                    DarboPatirtis[playerid][Mechanikai] = cache_get_field_content_int(i, "Mechanikai", Mysql_users);
                    DarboPatirtis[playerid][Taksi] = cache_get_field_content_int(i, "Taksi", Mysql_users);
                    DarboPatirtis[playerid][Furistai] = cache_get_field_content_int(i, "Furistai", Mysql_users);
                    DarboPatirtis[playerid][Dyleriai] = cache_get_field_content_int(i, "Dyleriai", Mysql_users);
                    DarboPatirtis[playerid][Picerija] = cache_get_field_content_int(i, "Picerija", Mysql_users);
                    DarboPatirtis[playerid][KeliuSlavejai] = cache_get_field_content_int(i, "KeliuSlavejai", Mysql_users);
                    DarboPatirtis[playerid][Autobusai] = cache_get_field_content_int(i, "Autobusai", Mysql_users);
                    DarboPatirtis[playerid][Mikroautobusai] = cache_get_field_content_int(i, "Mikroautobusai", Mysql_users);
                    DarboPatirtis[playerid][Ukininkai] = cache_get_field_content_int(i, "Ukininkai", Mysql_users);
                    DarboPatirtis[playerid][Medkirciai] = cache_get_field_content_int(i, "Medkirciai", Mysql_users);
                    DarboPatirtis[playerid][Sodininkai] = cache_get_field_content_int(i, "Sodininkai", Mysql_users);
                    DarboPatirtis[playerid][Ugnegesiai] = cache_get_field_content_int(i, "Ugnegesiai", Mysql_users);
                    // Vairavimo mokykla
                    PlayerData[playerid][Teorija] = cache_get_field_content_int(i, "Teorija", Mysql_users);
                    cache_get_field_content(i, "tIslaike", PlayerData[playerid][tIslaike], Mysql_users, 126);
                    PlayerData[playerid][aTeises] = cache_get_field_content_int(i, "aTeises", Mysql_users);
                    cache_get_field_content(i, "aIslaikeData", PlayerData[playerid][aIslaikeData], Mysql_users, 126);
                    PlayerData[playerid][aTeisesPaimtos] = cache_get_field_content_int(i, "aTeisesPaimtos", Mysql_users);
                    PlayerData[playerid][aIslaike] = cache_get_field_content_int(i, "aIslaike", Mysql_users);
                    PlayerData[playerid][bTeises] = cache_get_field_content_int(i, "bTeises", Mysql_users);
                    cache_get_field_content(i, "bIslaikeData", PlayerData[playerid][bIslaikeData], Mysql_users, 126);
                    PlayerData[playerid][bTeisesPaimtos] = cache_get_field_content_int(i, "bTeisesPaimtos", Mysql_users);
                    PlayerData[playerid][bIslaike] = cache_get_field_content_int(i, "bIslaike", Mysql_users);
                    PlayerData[playerid][cTeises] = cache_get_field_content_int(i, "cTeises", Mysql_users);
                    cache_get_field_content(i, "cIslaikeData", PlayerData[playerid][cIslaikeData], Mysql_users, 126);
                    PlayerData[playerid][cTeisesPaimtos] = cache_get_field_content_int(i, "cTeisesPaimtos", Mysql_users);
                    PlayerData[playerid][cIslaike] = cache_get_field_content_int(i, "cIslaike", Mysql_users);
                    PlayerData[playerid][dTeises] = cache_get_field_content_int(i, "dTeises", Mysql_users);
                    cache_get_field_content(i, "dIslaikeData", PlayerData[playerid][dIslaikeData], Mysql_users, 126);
                    PlayerData[playerid][dTeisesPaimtos] = cache_get_field_content_int(i, "dTeisesPaimtos", Mysql_users);
                    PlayerData[playerid][dIslaike] = cache_get_field_content_int(i, "dIslaike", Mysql_users);
                    PlayerData[playerid][Pravaziavimas] = cache_get_field_content_int(i, "Pravaziavimas", Mysql_users);
                    cache_get_field_content(i, "pIslaike", PlayerData[playerid][pIslaike], Mysql_users, 126);
                    PlayerData[playerid][DuotiLaikytiA] = cache_get_field_content_int(i, "DuotiLaikytiA", Mysql_users);
                    PlayerData[playerid][DuotiLaikytiB] = cache_get_field_content_int(i, "DuotiLaikytiB", Mysql_users);
                    PlayerData[playerid][DuotiLaikytiC] = cache_get_field_content_int(i, "DuotiLaikytiC", Mysql_users);

                    SetSpawnInfo(playerid, 0, PlayerData[playerid][Skin], PlayerData[playerid][PositionX], PlayerData[playerid][PositionY], PlayerData[playerid][PositionZ], PlayerData[playerid][PositionA], 0,0,0,0,0,0);
                    SetPlayerHealth(playerid, PlayerData[playerid][Health]);
                    SetPlayerArmour(playerid, PlayerData[playerid][Armour]);
                    GivePlayerMoney(playerid, PlayerData[playerid][Money]);
                    SetPlayerScore(playerid, PlayerData[playerid][Score]);
                    SetPlayerSkin(playerid, PlayerData[playerid][Skin]);

                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon1], PlayerData[playerid][Weapona1]);
                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon2], PlayerData[playerid][Weapona2]);
                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon3], PlayerData[playerid][Weapona3]);
                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon4], PlayerData[playerid][Weapona4]);
                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon5], PlayerData[playerid][Weapona5]);
                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon6], PlayerData[playerid][Weapona6]);
                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon7], PlayerData[playerid][Weapona7]);
                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon8], PlayerData[playerid][Weapona8]);
                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon9], PlayerData[playerid][Weapona9]);
                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon10], PlayerData[playerid][Weapona10]);
                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon11], PlayerData[playerid][Weapona11]);
                    GivePlayerWeapon(playerid, PlayerData[playerid][Weapon12], PlayerData[playerid][Weapona12]);

                    SetPlayerWantedLevel(playerid, PlayerData[playerid][Wanted]);
                
                }
            }
        }
        return 1;
}
Reply
#2

What's the error ? Or is the player not loading at all ?
Reply
#3

writed passwords, doesn't load weapons, positions, hp, armor and etc, i want if player writed passwords and click login, load weapons, positions, hp, armor and etc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)