Prepaid bugg ? - 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: Prepaid bugg ? (
/showthread.php?tid=143528)
Prepaid bugg ? -
sjvt - 23.04.2010
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?
Re: Prepaid bugg ? -
Babul - 23.04.2010
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);
Re: Prepaid bugg ? -
sjvt - 23.04.2010
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?
Re: Prepaid bugg ? -
Babul - 23.04.2010
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.
Re: Prepaid bugg ? -
sjvt - 23.04.2010
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