Dini Support - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dini Support (
/showthread.php?tid=464317)
Dini Support -
IlPrincipino - 16.09.2013
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
Re: Dini Support - Patrick - 16.09.2013
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
Re: Dini Support -
xganyx - 16.09.2013
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;
}