04.01.2011, 10:39
Hi there,
I have some serious problem, when i try to compile some code, and i use fopen, fwrite etc.
Pawno simply crashes
Here is code that I'm trying to compile:
I have some serious problem, when i try to compile some code, and i use fopen, fwrite etc.
Pawno simply crashes
Here is code that I'm trying to compile:
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
new Float:x, Float:y, Float:z, Float:a;
forward CreateVehicle(playerid, vehicleid, color_1, color_2);
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
public CreateVehicle(playerid, vehicleid, color_1, color_2){
new VehicleParams[512];
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
CreateVehicle(vehicleid, x, y, z, a, color_1, color_2, 900);
format(VehicleParams, sizeof(VehicleParams), "%d,%d,%d,%f,%f,%f,%f\r\n", vehicleid, color_1, color_2, x, y, z, a);
new File:CreateVehicle = fopen("vehicles.txt", io_append);
fwrite(CreateVehicle, VehicleParams);
fclose(CreateVehicle);
return 1;
}