[HELP] Info Wont Save
#1

The Score and the Money wont save

pawn Код:
#include <a_samp>
#include <Dini>

#define PlayerInfo  "Users/%s.ini"

enum Info
{
    Score,
    Money,
}

//-----------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
    new File[68];
    format(File,sizeof(File), PlayerInfo);

    if(!dini_Exists(File))
    {
        dini_Create(File);
        dini_IntSet(File, "Score" ,0);
        dini_IntSet(File, "Money" ,0);
    }
    SetPlayerScore(playerid, dini_Int(File, "Score"));
    GivePlayerMoney(playerid, dini_Int(File, "Money"));
    return 1;
}

//------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid, reason)
{
    new File[68];

    SetPlayerScore(playerid, dini_Int(File, "Score"));
    GivePlayerMoney(playerid, dini_Int(File, "Money"));
    return 1;
}
Reply
#2

Also another Question:

ERROR: "argument type mismatch (argument 3)" ERROR
pawn Код:
ShowPlayerDialog(playerid, DIALOG_STYLE_MSGBOX, "Info", "You ID: %s", "Done", "Cancel", playerid);
Reply
#3

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new File[68],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(File,sizeof(File),PlayerInfo,name);
    dini_IntSet(file,"Score",GetPlayerScore(playerid));
    dini_IntSet(file,"Money",GetPlayerMoney(playerid));
    return 1;
}

Change your OnPlayerDisconnect for that above ^
Reply
#4

You need to put the players name in the filename also the "dialogid" parameter comes before the "dialogtype" parameter.
pawn Код:
ShowPlayerDialog(playerid, DIALOGID_GOES_HERE, DIALOG_STYLE_MSGBOX, "Info", "You ID: %s", "Done", "Cancel", playerid);
1st question if you wish to create a file when they connect and not leave,
pawn Код:
public OnPlayerConnect(playerid)
{
    new
        File[68],
        name[MAX_PLAYER_NAME];
       
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(File,sizeof(File), PlayerInfo, name);

    if(!dini_Exists(File))
    {
        dini_Create(File);
        dini_IntSet(File, "Score" ,0);
        dini_IntSet(File, "Money" ,0);
    }
    SetPlayerScore(playerid, dini_Int(File, "Score"));
    GivePlayerMoney(playerid, dini_Int(File, "Money"));
    return 1;
}
Reply
#5

Thanks, and last problem then :P

I want it something like this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/status", true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            ShowPlayerDialog(playerid, DIALOGID_GOES_HERE, DIALOG_STYLE_MSGBOX, "Info", "You ID: %s", "Done", "Cancel", playerid);
            return 1;
        }
    }
    return 0;
}
Reply
#6

Fully:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/status", true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            new string[128];
            format(string,sizeof(string),"Your ID: %d",playerid);
            ShowPlayerDialog(playerid, DIALOGID_GOES_HERE, DIALOG_STYLE_MSGBOX, "Info", string, "Done", "Cancel", playerid);
            return 1;
        }
    }
    return 0;
}
Reply
#7

Didnt work =/

i want it like,

First i type "/status" then should an dialog like THIS show on my screen with my status

Statsus...

Name: %s
ID: %d
Reply
#8

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
Didnt work =/

i want it like,

First i type "/status" then should an dialog like THIS show on my scenn with my status

Statsus...

Name: %s
ID: %d
You didn't tell name -.-...

Try this one below:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/status", true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            new string[128],name[MAX_PLAYER_NAME];
            GetPlayerName(playerid,name,sizeof(name));
            format(string,sizeof(string),"Name: %s\nYour ID: %d",name,playerid);
            ShowPlayerDialog(playerid, DIALOGID_GOES_HERE, DIALOG_STYLE_MSGBOX, "Info", string, "Done", "Cancel", playerid);
            return 1;
        }
    }
    return 0;
}
Reply
#9

Im tierd of dialogs xD

Error: DIALOGID_GOES_HERE
Reply
#10

Quote:
Originally Posted by Larsey123IsMe
Посмотреть сообщение
Im tierd of dialogs xD

Error: DIALOGID_GOES_HERE
Your kidding?

Make it id 1 or smth, it was an example.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)