SA-MP Forums Archive
Kcash problem 2. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Kcash problem 2. (/showthread.php?tid=95207)



Kcash problem 2. - Sal_Kings - 02.09.2009

Ok so ..
My server uses this crappy money named "Kcash" it's like points but it is our currency.
Anyways ..

This is the cmd to show how much KCASH you have.

Код:
 if(!strcmp(cmdtext,"/kcash",true))
{
  format(string, sizeof string, "You have %i KCASH in your bag.", KCASH[playerid]);
  SendClientMessage(playerid,COLOR_GREEN,string);
  return 1;
}
Is there anyway so that this "KCASH" can save on your username?
No matter if the server restarts or if you log out or crash or w/e it will always save on your name ..


Re: Kcash problem 2. - dougbrowne - 02.09.2009

You would have to save the data somewhere to do that. ex. a mysql database, ini file, etc..


Re: Kcash problem 2. - Sal_Kings - 02.09.2009

How? ..


Re: Kcash problem 2. - Clavius - 02.09.2009

Check out DJson, it's really easy to use.
http://forum.sa-mp.com/index.php?topic=71125.0


Re: Kcash problem 2. - Alice[WS] - 02.09.2009

An exemple using dini :

Код:
#include <Dini>

stock Player(playerid)
{
 new player[MAX_PLAYER_NAME];
 GetPlayerName(playerid, player, sizeof(player));
 return player;
}

stock FileStats(playerid)
{
  new a[256];
  format(a, sizeof(a), "%s.ini",Player(playerid));
  return a;
}

OnPlayerDisconnect(playerid)
{
  dini_IntSet(FileStats(playerid), "Kcash", KCash[playerid]);

KCash[playerid] = 0; // important, avoid identation losing
}

OnPlayerConnect(playerid)
{
  GivePlayerKCash(playerid,dini_Int(FileStats(playerid),"Kcash"));
}



Re: Kcash problem 2. - The_Tough - 02.09.2009

OFFTOPIC : Lol alice you are scripter ? I know you from WS



Re: Kcash problem 2. - Alice[WS] - 02.09.2009

I started to script more than a mounth ago ^^


Re: Kcash problem 2. - The_Tough - 08.09.2009

Quote:
Originally Posted by Alice[WS
]
I started to script more than a mounth ago ^^
Ok !! If you need any help here I am :P'

pm me and send me your msn,Cu