SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

Thread Tools Display Modes
Old 29/05/2011, 01:31 AM   #1
Skylar Paul
Huge Clucker
Skylar Paul's Avatar
Join Date: Feb 2011
Posts: 282
Reputation: 5
Default Re-loading a file?

Well, I currently have two functions (Created by Leth4l)

pawn Code:
stock AddLabelsFromFile(LFileName[])
    if(!fexist(LFileName)) return 0;

    new File:LFile, Line[128], LabelInfo[128], Float:LX, Float:LY, Float:LZ, lTotal = 0;

    LFile = fopen(LFileName, io_read);
    while(fread(LFile, Line))
        if(Line[0] == '/' || isnull(Line)) continue;
        unformat(Line, "p<,>s[128]fff", LabelInfo,LX,LY,LZ);
        CreateDynamic3DTextLabel(LabelInfo, 0xFFFFFFFF, LX, LY, LZ, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
    return lTotal;

stock AddLabelToFile(LFileName[], LabelInfo[], Float:LX, Float:LY, Float:LZ)
    new File:LFile, Line[128];

    format(Line, sizeof(Line), "%s,%.2f,%.2f,%.2f\r\n",LabelInfo, LX, LY, LZ);
    LFile = fopen(LFileName, io_append);
    fwrite(LFile, Line);
    return 1;

Which are used in my dynamic 3DTextLabel system, which works perfectly; Now, i'm wondering if there's a way to make a reload command so it would destroy the pickups in the file, and then reload them.

Here's my add command:

pawn Code:
COMMAND:add(playerid, params[]) //Fixed by Frederick Wright - [url][/url]

    else if(strcmp(params, "3DTextLabel", true, 11) == 0) {
        strdel(params, 0, 11);

        if(sscanf(params, "s[128]", LabelDesc)) {
            UsageMessage(playerid, "Add 3DTextLabel", "[Text]", "Creates a permanent 3DTextLabel viewable by all players at your position.");
            return 1;
        if(PVar[playerid][AuthLvl] >= 3) {
            GetPlayerPos(playerid, YourPos[0], YourPos[1], YourPos[2]);
            AddLabelToFile(LABEL_FILE_NAME, LabelDesc, YourPos[0], YourPos[1], YourPos[2]);
            CreateDynamic3DTextLabel(LabelDesc, 0xFFFFFFFF, YourPos[0], YourPos[1], YourPos[2], 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
            printf("[+] 3DTextLabel created at %f, %f, %f | Description: %s", YourPos[0], YourPos[1], YourPos[2], LabelDesc);
        else return AuthError(playerid, 3);
    else {
        UsageMessage(playerid, "Add", "[Parameters]", "MapIcon, Vehicle, Pickup, 3DTextLabel");
        return 1;
    return 1;
Skylar Paul is offline  
Old 29/05/2011, 05:37 AM   #2
Join Date: Jan 2009
Posts: 6,129
Reputation: 1127
Default Re: Re-loading a file?

Do you mean that you want to clear the file and start over or to destroy all active pickups and spawn them again based on what's in your pickups file?
Calgon is offline  

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading File Andrejs Help Archive 3 05/09/2010 08:26 PM
Loading my level from file? 0ne Help Archive 16 30/04/2010 01:59 PM
Problem with loading from file arnutisz Help Archive 2 27/10/2009 04:05 PM
File Loading (Jeff) Help Archive 1 21/10/2009 01:58 PM
Loading car spawns from file? Littlejth Help Archive 1 15/02/2009 05:58 PM

All times are GMT. The time now is 04:00 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.