SA-MP Forums Archive
Vehicle Saving / Loading? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Vehicle Saving / Loading? (/showthread.php?tid=212226)



Vehicle Saving / Loading? - Luis- - 16.01.2011

I made these two commands and they don't work;
pawn Код:
if(strcmp(cmd, "/saveveh", true) == 0)
    {
        new file[128];
        format(file, sizeof(file), "Vehicles/%s.ini", GetPlayerVehicleID(playerid));
        if(PlayerInfo[playerid][pAdmin] >= 1337)
        {
            new Float:X, Float:Y, Float:Z, Float:A;
            GetVehiclePos(vehicleid, X, Y, Z);
        GetVehicleZAngle(vehicleid, A);
            dini_Create(file);

        dini_FloatSet(file, "PosX", X);
        dini_FloatSet(file, "PosY", Y);
        dini_FloatSet(file, "PosZ", Z);
        dini_FloatSet(file, "PosA", A);
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE-INFO] Vehicle Saved");
        }
        return 1;
    }
    if(strcmp(cmd, "/loadveh", true) == 0)
    {
        new file[128];
        for(new i = 1; i <= MAX_VEHICLES; i++)
        {
            format(file, sizeof(file), "Vehicles/%s.ini", GetPlayerVehicleID(playerid));
            if(!fexist(file))
            {
                return SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE INFO] Vehicles Loaded");
            }
            CreateVehicle(i, vInfo[vehicleid][vPosX], vInfo[vehicleid][vPosY], vInfo[vehicleid][vPosZ], vInfo[vehicleid][vPosA], random(151), random(151), false);
        }
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE INFO] Vehicles Loaded");
        return 1;
    }
Could someone tell me what I am doing wrong?


Re: Vehicle Saving / Loading? - Luis- - 16.01.2011

Please, I need this.


Re: Vehicle Saving / Loading? - Anthonyx3' - 17.01.2011

can you explain what you mean they dont work? does it save vehicle at all?