How do I create a pname
#1

I was wondering how I can create a pname variable for my save system
Reply
#2

pawn Код:
new pName[24]; //Same as MAX_PLAYER_NAME
GetPlayerName(playerid, pName, 24);
Reply
#3

How would I save it on log out and at it to my enum here is my enum
Код HTML:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
And here is the on player disconnect
Код HTML:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Close(File);
    return 1;
}
Reply
#4

pawn Код:
enum pInfo
{
    pName[MAX_PLAYER_NAME],
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];

public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteString(File, "Name", GetName(playerid) );
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Close(File);
    return 1;
}

stock GetName(playerid)
{
        new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}
Reply
#5

How would I add it to the load user?
Код HTML:
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}
Reply
#6

pawn Код:
public LoadUser_data(playerid,name[],value[])
{
    INI_String("Name", PlayerInfo[playerid][pName]);
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}
Reply
#7

INI_String doesn't exist
Reply
#8

What if the OP does not have y_ini?
Stop copy-pasting codes from your script please...
OT: please can you be more specific? your saving system? do you have any enums defined before?
Reply
#9

Quote:
Originally Posted by lramos15
Посмотреть сообщение
INI_String doesn't exist
you using y_ini yeah?

INI_String
name[] - Name of the INI textual identifier.
variable - Variable to store to.
length - Length of the destination array.

Saves the passed value as a string if the name matches.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)