help with 'format' - 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: help with 'format' (
/showthread.php?tid=75422)
help with 'format' -
pehapx - 01.05.2009
Hi, i made admin function, which spawn and save vehicle:
Код:
else if(!strcmp(cmd, "/veh", true))
{
cmd=strtok(cmdtext,idx);
if(!strlen(cmd)) return SendClientMessage(playerid,0xAA3333AA,"UŻYCIE: /veh [nazwa] [id] [kolor 1] [kolor 2]");
new nazwa=strval(cmd);
cmd=strtok(cmdtext,idx);
if(!strlen(cmd)) return SendClientMessage(playerid,0xAA3333AA,"UŻYCIE: /veh [nazwa] [id] [kolor 1] [kolor 2]");
new car=strval(cmd);
cmd=strtok(cmdtext,idx);
if(!strlen(cmd)) return SendClientMessage(playerid,0xAA3333AA,"UŻYCIE: /veh [nazwa] [id] [kolor 1] [kolor 2]");
new color1=strval(cmd);
cmd=strtok(cmdtext,idx);
if(!strlen(cmd)) return SendClientMessage(playerid,0xAA3333AA,"UŻYCIE: /veh [nazwa] [id] [kolor 1] [kolor 2]]");
new color2=strval(cmd);
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
CreateVehicle(car, X, Y, Z , Angle, color1, color2, 300);
new File:pos=fopen("cars.txt", io_append);
new zapisz[256];
format(zapisz, 256, "%s = CreateVehicle(%d, %f, %f, %f, %f, %d, %d, 300);\r\n", nazwa, car, X, Y, Z, Angle, color1, color2);
fwrite(pos, zapisz);
fclose(pos);
return 1;
}
, but (red) part
<format(zapisz, 256,
"%s = CreateVehicle(%d, %f, %f, %f, %f, %d, %d, 300);\r\n",
nazwa, car, X, Y, Z, Angle, color1, color2);>
is not working. Vehicles spawn, but file cars.txt is ex:
Код:
= CreateVehicle(500, 0.000000, 0.000000, 0.000000, 0.000000, 3, 5, 300);
= CreateVehicle(500, 0.000000, 0.000000, 0.000000, 0.000000, 3, 5, 300);
= CreateVehicle(500, 0.000000, 0.000000, 0.000000, 0.000000, 3, 5, 300);
nazwa doesn't save, what's wrong with it?
Re: help with 'format' -
Jefff - 01.05.2009
nazwa cant be a integer so u cant save as strval
Re: help with 'format' -
pehapx - 01.05.2009
oh, thanks, it works