Dini Support
#1

Hi boys, my name is Alex Palermitano, i write in this forum ask for help...

I can not Scripting a registration system Dini

The system must contain Level - Money - Skin - Dead - Kill

These data are to be saved every 30 minutes and when a player disconnects

You can get it for me?

I do not want the links, I do want one that works please let


Thank's

PS: Sorry for my English, I'm Italian
Reply
#2

Search a DINI registration system on TUTORIAL and just copy those stuff and read the tutorial, and after you copied and read the tutorial just make a timer that saves the account every 30 minutes
Reply
#3

Here is a simple script i have scripted for you

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

#define     PATH    "/Users/%s.ini"   //Change this

enum pInfo
{
    Level,
    Money,
    Skin,
    Kills,
    Deaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];

public OnPlayerConnect(playerid)
{
    new file[256];
    format(file, sizeof(file), PATH, GetName(playerid));
    if(dini_Exists(file))
    {
        SetPlayerSkin(playerid, dini_Int(file, "Skin"));
        GivePlayerMoney(playerid, dini_Int(file, "Money"));
        PlayerInfo[playerid][Level] = dini_Int(file, "Level");
        PlayerInfo[playerid][Kills] = dini_Int(file, "Kills");
        PlayerInfo[playerid][Deaths] = dini_Int(file, "Deaths");
    }
    else
    {
        dini_Create(file);
        dini_IntSet(file, "Level", 0);
        dini_IntSet(file, "Money", 0);
        dini_IntSet(file, "Skin", 0);
        dini_IntSet(file, "Kills", 0);
        dini_IntSet(file, "Deaths", 0);
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new file[256];
    PlayerInfo[playerid][Money] = GetPlayerMoney(playerid);
    PlayerInfo[playerid][Skin] = GetPlayerSkin(playerid);
    format(file, sizeof(file), PATH, GetName(playerid));
    dini_IntSet(file, "Level", PlayerInfo[playerid][Level]);
    dini_IntSet(file, "Money", PlayerInfo[playerid][Money]);
    dini_IntSet(file, "Skin", PlayerInfo[playerid][Skin]);
    dini_IntSet(file, "Kills", PlayerInfo[playerid][Kills]);
    dini_IntSet(file, "Deaths", PlayerInfo[playerid][Deaths]);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext,"/buylevel") == 0)
    {
        if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid,-1,"You don't have enough money to buy a next level ($5000)");
        PlayerInfo[playerid][Level] ++;
        SendClientMessage(playerid,-1,"You have buyed a nother level");
        GivePlayerMoney(playerid,-500);
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInfo[killerid][Kills] ++;
    PlayerInfo[playerid][Deaths] ++;
    return 1;
}

stock GetName(playerid)
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
    return pname;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)