Meg kell adni hogy hova mentse,és honnan töltse be(udb_Create(pname, \"\")
,de ha nem jó,itt van egy dinis:
[pawn]#include <a_samp>
#include <dini>
new PlayerWeapons[12][MAX_PLAYERS];
new PlayerAmmo[12][MAX_PLAYERS];
new file[40];
public OnPlayerConnect(playerid)
{
for(new w=0;w<13;w++)
{
PlayerWeapons[w][playerid]=0;
PlayerAmmo[w][playerid]=0;
}
format(file,sizeof(file),\"%s.Weapons.txt\",oGetPlayerName(playerid));
if(!dini_Exists(file))
{
printf(\"no such file \'%s\'? created...\", file);
dini_Create(file);
}
return 1;
}
public OnPlayerDisconnect(playerid)
{
for(new weap=0;weap<13;weap++)
{
GetPlayerWeaponData(playerid,weap,PlayerWeapons[weap][playerid],PlayerAmmo[weap][playerid]);
format(file,sizeof(file),\"%s.Weapons.txt\",oGetPlayerName(playerid));
new slotname[20];
format(slotname,sizeof(slotname),\"Slot%d\",weap);
dini_IntSet(file,slotname,PlayerWeapons[weap][playerid]);
new slotammo[20];
format(slotammo,sizeof(slotammo),\"AmmoSlot%d\",weap);
dini_IntSet(file,slotammo,PlayerAmmo[weap][playerid]);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
for(new weap=0;weap<13;weap++)
{
format(file,sizeof(file),\"%s.Weapons.txt\",oGetPlayerName(playerid));
new slotname[20];
format(slotname,sizeof(slotname),\"Slot%d\",weap);
new slotammo[20];
format(slotammo,sizeof(slotammo),\"AmmoSlot%d\",weap);
PlayerWeapons[weap][playerid] = strval(dini_Get(file, slotname));
PlayerAmmo[weap][playerid] = strval(dini_Get(file, slotammo));
GivePlayerWeapon(playerid, PlayerWeapons[weap][playerid], PlayerAmmo[weap][playerid]);
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
for(new i=0;i<13;i++)
{
GetPlayerWeaponData(playerid,i,PlayerWeapons
[playerid],PlayerAmmo[playerid]);
format(file,sizeof(file),\"%s.Weapons.txt\",oGetPlayerName(playerid));
new slotname[20];
format(slotname,sizeof(slotname),\"Slot%d\",i);
dini_IntSet(file,slotname,PlayerWeapons[playerid]);
new slotammo[20];
format(slotammo,sizeof(slotammo),\"AmmoSlot%d\",i);
dini_IntSet(file,slotammo,PlayerAmmo[playerid]);
}
return 1;
}
stock oGetPlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
return name;
}[/pawn]