12.06.2011, 16:49
Hello. I am making a saving system, and I want to use 1 function for all types of data (float, integer, string). I don't really have any ideas how to do it, except I saw this stuff in 'setproperty' page on wiki:
Therefore I could do this:
But would it work? I can't it test myself right now as I'm not home.
Thanks.
Код:
setproperty(.value = 123984334, .string = ":)");
Код:
stock ini_write(file, wfloat = NAN, wint = NAN, wstring[] = ";;[[;;[[") { if(wfloat == wfloat){ write a float } else if(wint == wint){ write an integer } else if(strcmp(wstring, ";;[[;;[[") > 0){ write a string } return 1; } //somewhere new Float:posX = 1.2, vehicleid = 245, name[MAX_PLAYER_NAME] = "Bob"; ini_write(file, .posX); ini_write(file, .vehicleid ); ini_write(file, .name);
Thanks.