counting
#1

how do i make something when i type a command like /count it sends me a message saying you have counted two times...

/count - You have counted 1 times
/count - You have counted 2 times

It saves when u logout and on death. How?

I want to add it to my /buygun so each time you type /buygun it says you have bought a gun one time.
Reply
#2

Well the count bit itself is fairly simple, but to save it requires some additional parts.

pawn Code:
new Count[MAX_PLAYERS];
new string[128];
pawn Code:
if (strcmp("/count", cmdtext, true, 6) == 0)
    {
    Count[playerid]++;
    format(string, sizeof(string), "You have counted %d times", Count[playerid]);
    SendClientMessage(playerid, 0xFF00FFFF, string);
    return 1;
    }
The above script will only work for a single session and each time you restart the script it'll be back to 0. Now you have a choice of how you wish to save your variables. You can use fwrite() to create your own saving system, or use one that is already set-up like DJSon or Dini (both by Dracoblue). You could also use Dudb, but it would be a bit of a shame to create a file for every player that only contains 1 variable...


Reply
#3

Thx bro
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)