Little help regarding sscanf. -
Hello. Some time ago, I've been developing a command to add properties to my Server. Well done, I must say.
By the way, there's a little problem. When I must set the property name, in case that's a composed name (My prop, two+ words), I must use an "_" to separate the names. Its kinda ugly, and will ruin the properties's name. Here's the command:
Код:
CMD:addprop(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, c_r, "You cannot make properties from inside a vehicle! Quit it first!");
new tmp[256], tmp2[256], tmp3[256], tmp4[256], bstring[256], string[256];
new Float:bX, Float:bY, Float:bZ;
if(sscanf(params, "is[256]ii", tmp, tmp2,tmp3,tmp4)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Format: /Addprop [InteriorID] [Prop Name] [Price] [Profit]");
if(IsNumeric(tmp2)) return 0;
GetPlayerPos(playerid, bX, bY, bZ);
format(bstring, 256, "%f,%f,%f,%i,%s,%i,%i\r\n", bX, bY, bZ, tmp, tmp2, tmp3, tmp4);
new File:Bfile;
Bfile = fopen("LFRP/BusinessToSave.txt", io_append);
fwrite(Bfile, bstring);
fclose(Bfile);
format(string, 256, "You have sucessuly created a new property! (Name: %s |Price:%d|Profit:%d|)", tmp2, tmp3, tmp4);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}
Can someone more experienced please help me? I'd like a lot.
Re: Little help regarding sscanf. -