SA-MP Forums Archive
format and save to a file..hex colours - 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: format and save to a file..hex colours (/showthread.php?tid=68079)



format and save to a file..hex colours - Outbreak - 06.03.2009

I'm trying to save co-ordinates to a text file, i can only get it to save 0.0000

I'm also trying to save hex colours to a text file.

this is what i've tried

pawn Код:
new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    format(GangZoneInfo[spaces][zXpos1], 32, "%f", X);
    format(GangZoneInfo[spaces][zYpos1], 32, "%f", Y);
it compiles fine, no errors or warnings, then when i try to save the position with a command i made it saves as 0.0000

Alsoi've tried this

pawn Код:
new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    GangZoneInfo[spaces][zXpos1] = X;//warning 213: tag mismatch
    GangZoneInfo[spaces][zYpos1] = Y;//warning 213: tag mismatch
only this time i get two warnings.


Re: format and save to a file.. - Jefff - 06.03.2009

Код:
new Float:zXpos1,Float:zYpos1;



Re: format and save to a file.. - Outbreak - 06.03.2009

That won't work. zXpos1 is already a created variable.




Re: format and save to a file.. - Jefff - 06.03.2009

Yes and it must be a float


Re: format and save to a file.. - Outbreak - 06.03.2009

The variable zXpos1 is used to store the float, for it to be saved into a file.

pawn Код:
enum gzInfo
{
zName[32],
zXpos1,
zYpos1,
zXpos2,
zYpos2
};

new GangZoneInfo[MAX_GANG_ZONES][gzInfo];



Re: format and save to a file.. - Jefff - 06.03.2009

Код:
enum gzInfo
{
zName[32],
Float:zXpos1,
Float:zYpos1,
Float:zXpos2,
Float:zYpos2
};



Re: format and save to a file.. - Outbreak - 07.03.2009

Ah yes, cool. Thanks it works now


Do you know how to store hex colours in a variable?

I've tried adding zColor to the gangzone file.

Instead of it saving as a hex colour it saves as a number. for example "30"

pawn Код:
format(GangZoneInfo[spaces][zColor], 32, "0x00000042");
And for writing to the file
pawn Код:
format(info, 32, "Colour=%x\n", GangZoneInfo[spaces][zColor]);fwrite(gzfile, info);



Re: format and save to a file..hex colours - [RP]Rav - 07.03.2009

save them as a string


Re: format and save to a file..hex colours - Outbreak - 07.03.2009

Thanks ******, im always hopeful of a solution when i see you've replied to one of my posts

Also thanks to Jefff for all the help