SA-MP Forums Archive
Delete ScriptFiles File! - 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)
+--- Thread: Delete ScriptFiles File! (/showthread.php?tid=348468)



Delete ScriptFiles File! - MarcoWesley - 05.06.2012

Hi everybody,
i need your help for my vehicle system. I explain:
When a player buy a vehicle, the GM creates a file called: Playername.cfg in a folder into "scriptfiles".

The exactly path is:"GM/scriptfiles/CR_Scriptfiles/Veh1".

The problem is that i need to delete this file when the player sell the car.

The cod of selling is this:

pawn Код:
{
                new vehicleid = GetOwnedVehicleID(playerid);
                if (vehicleid == INVALID_VEHICLE_ID) return SendClientMessage(playerid, RED, "You haven't a vehicle.");
                if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,RED,"You're not in a vehicle.");
                if(strcmp(VehicleInfo[GetPlayerVehicleID(playerid)][vOwner],GetName(playerid))) return SendClientMessage(playerid,RED,"This isn't your vehicle.");
                GivePlayerCash(playerid, GetVehicleCost(vehicleid)/2);
                new string[128];
                format(string, sizeof string, "|- You selled your vehicle to %s and you earned $%d -|", VehicleName[GetVehicleModel(vehicleid)-400], GetVehicleCost(vehicleid)/2);
                SendClientMessage(playerid, GREEN, string);
                DeleteVehicle(playerid);
                TogglePlayerControllable(playerid,1);
                vEngine[vehicleid] = 0;
            }
PS: This file is defined whit this code:

pawn Код:
#define VEH_SAVE_FILE   "/CRP_Scriptfiles/Veh1/%s.cfg"



Re: Delete ScriptFiles File! - dannyk0ed - 05.06.2012

pawn Код:
#define VEH_SAVE_FILE   "Veh1/%s.cfg"
make sure the folder is named'scriptfiles".


Re: Delete ScriptFiles File! - MarcoWesley - 05.06.2012

it's named 'scriptfiles'...


Re: Delete ScriptFiles File! - Firo - 05.06.2012

Where is the code to Delete file?


Re: Delete ScriptFiles File! - MarcoWesley - 05.06.2012

Quote:
Originally Posted by Firo
Посмотреть сообщение
Where is the code to Delete file?
I need it!


Re: Delete ScriptFiles File! - MarcoWesley - 07.06.2012

Nobody can help me??