28.01.2013, 08:16
is it possible to change a float direct to a sting. I mean instead of first convert to integer and then to string via valstr?
new Float: X, Float: Y, Float: Z, Float:a, string[256];
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, a);
format(string, sizeof(string) "X: %f, Y: %f, Z: %f, A: %f", X,Y,Z, a);
CMD:createbiz(playerid, params[]) { new tmp[30], tmp2[256], index; tmp = strtok(params, index); tmp2 = strtok(params, index); if(isnull(tmp)) return SendClientMessage(playerid, 0xFF00AA, "Usage: /createbiz [NAME (no spaces)] [price]"); if(isnull(tmp2)) return SendClientMessage(playerid, 0xFF00AA, "Usage: /createbiz [NAME (no spaces)] [price]"); new mprice = strval(tmp2); new File:ftw=fopen(BUSINESS_FILE_PATH, io_append); if(ftw) { new mytext[256], plstring[256]; new Float:mx, Float:my, Float:mz; GetPlayerPos(playerid, mx,my,mz); new mworld = GetPlayerVirtualWorld(playerid); new into = GetPlayerInterior(playerid); new string[25]; strcat(plstring, "You have added biz: "); strcat(mytext, tmp); strcat(mytext, ", "); strcat(mytext, tmp2); strcat(mytext, ", "); valstr(string, mx); strcat(mytext, string); strcat(mytext, ", "); valstr(string, my); strcat(mytext, string); strcat(mytext, ", "); valstr(string, mz); strcat(mytext, string); strcat(mytext, ", "); strcat(mytext, mworld); strcat(mytext, ", "); strcat(mytext, into); strcat(plstring, mytext); SendClientMessageToAll(0xFFFFFFFF,plstring); new mystring[30]; format(mystring, 30, "%s\r\n", mytext); fwrite(ftw, mystring); fclose(ftw); return 1; } return 1; }
new string[256];
format(string, sizeof(string), "%f | %f | %f, | %d| %d\r\n" mx,my,mz,mworld,into);
//this is how to do it in your terms
//it is written in order of its values