27.07.2013, 23:21
acho que e isto que vc quer, tenta ae;
salva de carro e on foot
salva de carro e on foot
pawn Код:
if(strcmp(cmd, "/save2", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
new File:fp, text[128], M,
Float:X, Float:Y, Float:Z, Float:A,
INT, comment[128];
if(fexist("SavedPositions.txt"))
{
fp = fopen("Saved2.txt", io_append);
}
else
{
fp = fopen("Saved2.txt", io_write);
}
if(!IsPlayerInAnyVehicle(playerid))
{
M = GetPlayerSkin(playerid);
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
}
else
{
new vehid = GetPlayerVehicleID(playerid);
M = GetVehicleModel(vehid);
GetVehiclePos(vehid, X, Y, Z);
GetVehicleZAngle(vehid, A);
}
INT = GetPlayerInterior(playerid);
strmid(comment, cmdtext, 7, strlen(cmdtext));
if(!strlen(comment))
{
format(text, sizeof text, "%d, %.4f, %.4f, %.4f, %.4f, %d\r\n", M, X, Y, Z, A, INT);
}
else
{
format(text, sizeof text, "%d, %.4f, %.4f, %.4f, %.4f, %d //%s\r\n", M, X, Y, Z, A, INT, comment);
}
fwrite(fp, text);
fclose(fp);
SendClientMessage(playerid, -1, "Posiзгo salva com sucesso!");
}
else
{
SendClientMessage(playerid, -1, "Vocк nгo tem permissгo.");
}
return 1;
}