Help Not working
#1

This code aint getting my health or armour thats set in the user file but then again it dont save either
This In a New Forward function i created... Witch I have the Function In OnPlayerRequestClass
pawn Код:
forward OnPlayerLogged(playerid);
public OnPlayerLogged(playerid)
{
    new name[MAX_PLAYER_NAME], file[256], string[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), ARS_SERVERFILES, name);
    PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
    PlayerInfo[playerid][pJob] = dini_Int(file, "Job");
    PlayerInfo[playerid][pCash] = dini_Int(file,"Money");
    PlayerInfo[playerid][pAccount] = dini_Int(file,"Bank");
    PlayerInfo[playerid][pHealth] = dini_Int(file,"Health");
    PlayerInfo[playerid][pArmour] = dini_Int(file,"Armour");
    PlayerInfo[playerid][pCharacter] = dini_Int(file,"Character");
   
   
    format(string, 128, "You have succesfully logged into your account. Welcome back. %s ", name);
    SendClientMessage(playerid, DARKBLUE, string);
    SpawnLastSaved(playerid);
    PlayerOnline[playerid] = 1;
    return 1;
}
Then My Others Aint Saving The save player Position Works but not everything else I think i done confused my self here this code
pawn Код:
public SaveUserAccounts(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerOnline[playerid] == 1)
        {
            SaveStats(playerid);
            new file[24];
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            format(file, sizeof(file), ARS_SERVERFILES, name);
            dini_IntSet(file, "Account",PlayerInfo[playerid][pAccount]);
            dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
            dini_IntSet(file, "Money",PlayerInfo[playerid][pCash]);
            dini_IntSet(file, "Level",PlayerInfo[playerid][pScore]);
            dini_IntSet(file, "Firstname",PlayerInfo[playerid][pFirstname]);
            dini_IntSet(file, "Lastname",PlayerInfo[playerid][pLastname]);
            dini_IntSet(file, "Age",PlayerInfo[playerid][pAge]);
            dini_IntSet(file, "Gender",PlayerInfo[playerid][pGender]);
            dini_IntSet(file, "Registration",PlayerInfo[playerid][pReg]);
            dini_IntSet(file, "Vehicle",PlayerInfo[playerid][pVeh]);
            dini_IntSet(file, "House",PlayerInfo[playerid][pHouse]);
            dini_IntSet(file, "SSN",PlayerInfo[playerid][pId]);
            dini_IntSet(file, "FireRank",PlayerInfo[playerid][pFrank]);
            dini_IntSet(file, "PoliceRank",PlayerInfo[playerid][pPrank]);
            dini_IntSet(file, "Job",PlayerInfo[playerid][pJob]);
            dini_IntSet(file, "Health",PlayerInfo[playerid][pHealth]);
            dini_IntSet(file, "Armour",PlayerInfo[playerid][pArmour]);
            dini_IntSet(file, "Character", GetPlayerSkin(playerid));
            dini_IntSet(file, "LocX",PlayerInfo[playerid][pLocX]);
            dini_IntSet(file, "LocY",PlayerInfo[playerid][pLocY]);
            dini_IntSet(file, "LocZ",PlayerInfo[playerid][pLocZ]);
            dini_IntSet(file, "LocA",PlayerInfo[playerid][pLocA]);
            dini_IntSet(file, "LocI",PlayerInfo[playerid][pLocI]);
        }
    }
}
Please Ignore the other ones I havent got anything for them as of yet...
If Any Could help Me I'd Would be Greatly appreciated I would loved to be able to work on another script within my Gamemode with out having to worry about my save and Login stats not working right....
Reply
#2

https://sampwiki.blast.hk/wiki/Useful_Fu...#dini_FloatSet
https://sampwiki.blast.hk/wiki/GetPlayerArmour
https://sampwiki.blast.hk/wiki/GetPlayerHealth
Reply
#3

Jesus DUDE UR A Genius IF i wanted help from wiki I fucking look.. okay
Reply
#4

Why do you load and save strings and floats as integers?

PlayerInfo[..]; variable stores data, they cant set the player health/armour, use functions for it like SetPlayerHealth(); SetPlayerArmour();
Reply
#5

pawn Код:
new Float: health;
PlayerInfo[playerid][pHealth] = dini_Float(file,"Health");
dini_FloatSet(file, "Health",GetPlayerHealth(playerid, health));
Reply
#6

Quote:
Originally Posted by Jafet_Macario
Посмотреть сообщение
pawn Код:
new Float: health;
PlayerInfo[playerid][pHealth] = dini_Float(file,"Health");
dini_FloatSet(file, "Health",GetPlayerHealth(playerid, health));
You think that gonna set the player health? and i dont understand why do you store the health on a global variable, store the health on a variable when you gonna save it and use another variable (not global) to load and set the player health.

No need to use global variables for everything.

functionX: ...
{
new Float:healthvar;
GetPlayerHealth(...., healthvar);
dini_...Float(....,....);
...
}

Dont store the health on an enum, just create a variable on each function and get it when you gonna use it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)