Prepaid bugg ?
#1

hello, i did made a prepaid system in my script, it work, but it give automatic prepaid 11 .. and it must be 0

pawn Код:
//pInfo
pPrepaid,

//OnPlayerReset
PlayerInfo[playerid][pPrepaid] = 0;

//Register command
format(var, 32, "%d pPrepaid\n", PlayerInfo[playerid][pPrepaid]);fwrite(hFile, var);

//LoginPlayer
fread(file, valtmp);PlayerInfo[playerid][pPrepaid] = strlen(valtmp);

//UpdatePlayer
format(var, 32, "%d pPrepaid\n", PlayerInfo[playerid][pPrepaid]);fwrite(hFile, var);
its more, but you don't need the dialog/menu of it and you dont need the command

does someone know the fault?
Reply
#2

the string "0 pPrepaid\n" is 11 (cells) long, you simply forgot to use strval instead of strlen:
Код:
//LoginPlayer
fread(file, valtmp);PlayerInfo[playerid][pPrepaid] = strval(valtmp);
Reply
#3

Quote:
Originally Posted by Babul
the string "0 pPrepaid\n" is 11 (cells) long, you simply forgot to use strval instead of strlen:
Код:
//LoginPlayer
fread(file, valtmp);PlayerInfo[playerid][pPrepaid] = strval(valtmp);
huh?
Reply
#4

strlen (lenght) of "1234567890" is 10 (plus 1 for terminating the string = 11),
strval (value) of "1234567890" is 1234567890. thats the value you want to read, not the lenght, i guess.
Reply
#5

Quote:
Originally Posted by Babul
strlen (lenght) of "1234567890" is 10 (plus 1 for terminating the string = 11),
strval (value) of "1234567890" is 1234567890. thats the value you want to read, not the lenght, i guess.
aha now i know it thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)