[pawn]if(strcmp(cmdtext, \"/saveteleport\", true) == 0)
{
#if !defined MAX_TELEPORT_NAMELEN
#define MAX_TELEPORT_NAMELEN 32
#endif
#if !defined MAX_TELEPORT_CMDLEN
#define MAX_TELEPORT_CMDLEN 32
#endif
new name[MAX_TELEPORT_NAMELEN],command[MAX_TELEPORT_CMDLEN];
if(sscanf(params, \"s[32]s[32]\", name, command))
return SendClientMessage(playerid,0xFFFFFFFF, \"Use: /saveteleport [name][command]\");
new File:savedteleports = fopen(\"savedteleports.txt\", io_write);
if(savedteleports)
{
new Float:x, Float:y, Float:z, Float:angle;
if(IsPlayerInAnyVehicle(playerid))
{
new vehicleid = GetPlayerVehicleID(playerid);
GetVehiclePos(vehicleid,x,y,z);
GetVehicleZAngle(vehicleid,angle);
} else {
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,angle);
}
new formatstring[256];
format(formatstring, 256, \"CreateTeleport(\\\"%s\\\", \\\"%s\\\", %.3f, %.3f, %.3f, %.3f);\\r\\n\",
name, command, x, y, z, angle);
fwrite(savedteleports, formatstring);
fclose(savedteleports);
SendClientMessage(playerid,0xFFFFFFFF, \"Teleport saved to savedteleports.txt (in your scriptfiles folder).\");
}
return 1;
}[/pawn]