help to fix this +rep
#1

well, at the beginning i was trying to create an account id system and no one helped me so i had to create it by my own and i tried to do it but it seems it wont work so any one can give me ideas here is my code
pawn Код:
stock Paccountid(playerid)
{
    new string[4], stravl1[128];
    new File:countfile = fopen("SFTDM/Server Logs/count.txt", io_write);
    fread(countfile, string);
    new count = strval(string) + 1;
    PlayerInfo[playerid][Accountid] = count;
    format(stravl1, sizeof stravl1, "%d", count);
    fwrite(countfile, stravl1);
    fclose(countfile);
    return 1;
}

CMD:register ,,,,
    dUserSetINT(PlayerName2(playerid)).("accountid",Paccountid(playerid));
i know there is some issues so please help

P.S at file count the numbers stays 1 it wont pull over!
Reply
#2

You are trying to make it so the account id will go up by one?
If so I also had this question which I did not know how to like create it but luckily there is mysql, and there is the AUTO_INCREMENT tick.
Reply
#3

am trying to save the last account number in a txt file then when another player registers a +1 on the last number i got no another choice ....
Reply
#4

bump*
Reply
#5

another bump!
Reply
#6

https://sampwiki.blast.hk/wiki/File_Functions

i hope this will help you
Reply
#7

bro i had already searched in dat bullshit! i need a code !!!!!!
Reply
#8

KillerStrike Stop Bumping I know whats the feeling when no one answers but wait.
Reply
#9

#define FILE_PATH "count.txt"

CountFile()
{
new string[64];
new File:countfile = fopen(FILE_PATH, io_read);
if(countfile)
{
fread(countfile, string);
new count = strval(string);
count ++;
fclose(countfile);
countfile = fopen(FILE_PATH, io_write);
valstr(string,count);
fwrite(countfile,string);
fclose(countfile);
}
}
Reply
#10

lol dude where is the +1 ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)