Kcash problem 2.
#1

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 ..
Reply
#2

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

How? ..
Reply
#4

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

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"));
}
Reply
#6

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

I started to script more than a mounth ago ^^
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)