[?] Setting an integer using PVars [Dini] - 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: [?] Setting an integer using PVars [Dini] (
/showthread.php?tid=150260)
[?] Setting an integer using PVars [Dini] -
Lewwy - 25.05.2010
Hello, I'm trying to create a GUI account system which will allow users to type information into the dialogues and thus saving them to a file. For this I am currently using Dini.
What the problem is, is I cannot set the age correctly without an error being displayed.
The code below goes under register which works fine.
pawn Code:
dini_IntSet(file, "Age", 0);
SetPVarInt(playerid, "Age", dini_Int(file, "Age"));
The next part of code also works fine, but goes under login.
pawn Code:
SetPVarInt(playerid, "Age", dini_Int(file, "Age"));
Next, is where the problem occurs. I cannot assign the age correctly as it displays an error in the compiler. If there is a way around this (maybe without PVars?) help would be appreciated.
This is the dialog where users are asked to enter their age in digits.
pawn Code:
if(dialogid == CHARAGE)
{
if(response == 1)
{
SetPVarInt(playerid, "Age", inputtext);
}
}
If it helps, I already tried setting the age with:
pawn Code:
SetPVarString(playerid, "Age", inputtext);
This is then displayed with the SetPVar:
Code:
C:\Documents and Settings\-\Desktop\GTA San Andreas\SA-MP\samp03asvr_R7_win32\gamemodes\-.pwn(313) : error 035: argument type mismatch (argument 3)
EDIT: If there is an obvious mistake here, I haven't noticed it. I've been off and on scripting for a while now, just regaining my knowledge really, haha.
Re: [?] Setting an integer using PVars [Dini] -
Grim_ - 25.05.2010
'inputtext' is a string, you need to convert it to a integer.
pawn Code:
SetPVarInt(playerid, "Age", strval(inputtext));
Re: [?] Setting an integer using PVars [Dini] -
Lewwy - 25.05.2010
Thank you very much, typical obvious mistake once again haha.
Cheers!
Re: [?] Setting an integer using PVars [Dini] -
Grim_ - 25.05.2010
Don't mention it