SA-MP Forums Archive
Saving vehicle plate using Y_INI(String) Problem - 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)
+--- Thread: Saving vehicle plate using Y_INI(String) Problem (/showthread.php?tid=370925)



Saving vehicle plate using Y_INI(String) Problem - andrew2695 - 21.08.2012

Fixed


Re: Saving vehicle plate using Y_INI(String) Problem - Shetch - 21.08.2012

replace
Код:
Info[playerid][Plate] = strval(inputtext);
with
Код:
format(Info[playerid][Plate], 64, "%s", strval(inputtext));



Re: Saving vehicle plate using Y_INI(String) Problem - andrew2695 - 21.08.2012

I did it, It compile right but it's not working.


Re : Saving vehicle plate using Y_INI(String) Problem - andrew2695 - 22.08.2012

Does anyone know how to solve this problem?


Re: Saving vehicle plate using Y_INI(String) Problem - clarencecuzz - 22.08.2012

pawn Код:
if(dialogid == VPLATE)
    {
        if(response)
        {
           format(Info[playerid][Plate], 14, "%s", inputtext); //I doubt your number plate is going to be 64 cells long... strval will only return numbers, as it is for values.
           SendClientMessageFormatted(playerid, COLOR_GREEN,"Your vehicle Plate has been set to %s.", inputtext);
        }
    }
However, if we move back to our enum values, we may need to adjust some things.

We're saving our plate as a string right? So instead of having just, for example:
pawn Код:
enum PlayerInfo {
    Plate,
    Kills
};
We would need to change
pawn Код:
Plate,
To:
pawn Код:
Plate[15]
I'm making it 15 because it's close to the maximum plate size + null terminator. You can also change the 14 to a 15 in the format used in your dialog response.

If you don't give it a string size, it might not save as a string, but as an integer. So you need to tell the script, you want this variable to be saved as a string, thus using [15].


Re : Saving vehicle plate using Y_INI(String) Problem - andrew2695 - 22.08.2012

Working like a charm! Thanks for the help clarencecuzz.