SA-MP Forums Archive
Need some quick help! <3 - 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: Need some quick help! <3 (/showthread.php?tid=362647)



Need some quick help! <3 - maramizo - 25.07.2012

Well, I'm trying to create dynamic faction vehicles.
Anyhow, whenever I try to load the SASD faction vehicles, I get an "unknown command" error, here's the /loadfac command:
pawn Код:
CMD:loadfac(playerid, params[])
{
    new fid;
    new string[128];
    if(sscanf(params,"d",fid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /loadfac [SASD - 1] [LSPD - 2] [NOOSE - 3] [FDSA - 4] [FBI - 5].");
    switch(fid)
    {
        case 1:
        {
            LoadSASD();
            format(string, 128, "You have loaded SASD's vehicles successfully.");
            SendClientMessage(playerid, COLOR_WHITE, string);
            format(string, 128, "%s has Loaded SASD's vehicles.", GetPlayerNameEx(playerid));
            Log("logs/Loadfac.log", string);
            return 1;
        }
        case 2:
        {
            LoadLSPD();
            format(string, 128, "You have loaded LSPD's vehicles successfully.");
            SendClientMessage(playerid, COLOR_WHITE, string);
            format(string, 128, "%s has Loaded LSPD's vehicles.", GetPlayerNameEx(playerid));
            Log("logs/Loadfac.log", string);
            return 1;
        }
        case 3:
        {
            LoadNoose();
            format(string, 128, "You have loaded NOOSE's vehicles successfully.");
            SendClientMessage(playerid, COLOR_WHITE, string);
            format(string, 128, "%s has Loaded NOOSE's vehicles.", GetPlayerNameEx(playerid));
            Log("logs/Loadfac.log", string);
            return 1;
        }
        case 4:
        {
            LoadFDSA();
            format(string, 128, "You have loaded FDSA's vehicles successfully.");
            SendClientMessage(playerid, COLOR_WHITE, string);
            format(string, 128, "%s has Loaded FDSA's vehicles.", GetPlayerNameEx(playerid));
            Log("logs/Loadfac.log", string);
            return 1;
        }
        case 5:
        {
            LoadFBI();
            format(string, 128, "You have loaded FBI's vehicles successfully.");
            SendClientMessage(playerid, COLOR_WHITE, string);
            format(string, 128, "%s has Loaded FBI's vehicles.", GetPlayerNameEx(playerid));
            Log("logs/Loadfac.log", string);
            return 1;
        }
        default:
        {
            return SendClientMessage(playerid, COLOR_WHITE, "That is not a valid ID.");
        }
    }
    return 1;
}
This is LoadSASD():
pawn Код:
stock LoadSASD()
{
    if(!fexist("SASD.cfg")) fcreate("SASD.cfg");
    new string[256];
    new linfo[12][32];
    new File:file = fopen("SASD.cfg", io_read);
    if(file)
    {
        new idx = 0;
        while(idx < sizeof(SASDVehicles))
        {
            fread(file, string);
            split(string, linfo, '|');
            SASDVehicles[idx][0] = floatstr(linfo[0]);
            SASDVehicles[idx][1] = floatstr(linfo[1]);
            SASDVehicles[idx][2] = floatstr(linfo[2]);
            SASDVehicles[idx][3] = floatstr(linfo[3]);
            SASDVehicles[idx][4] = floatstr(linfo[4]);
            SASDVehicles[idx][5] = floatstr(linfo[5]);
            SASDVehicles[idx][6] = floatstr(linfo[6]);
            SASDVehicles[idx][7] = floatstr(linfo[7]);
            if(SASDVehicleIDs[idx][0] == 0)
            {
                if(SASDVehicles[idx][0] != 0)
                {
                    SASDVehicleIDs[idx][0] = AddStaticVehicleEx(floatround(SASDVehicles[idx][0],floatround_round),SASDVehicles[idx][1],SASDVehicles[idx][2],SASDVehicles[idx][3],SASDVehicles[idx][4],floatround(SASDVehicles[idx][5],floatround_round),floatround(SASDVehicles[idx][6],floatround_round),floatround(SASDVehicles[idx][7],floatround_round));
                }
            }
            else
            {
                if(SASDVehicles[idx][0] != 0)
                {
                    DestroyVehicle(SASDVehicleIDs[idx][0]);
                    SASDVehicleIDs[idx][0] = AddStaticVehicleEx(floatround(SASDVehicles[idx][0],floatround_round),SASDVehicles[idx][1],SASDVehicles[idx][2],SASDVehicles[idx][3],SASDVehicles[idx][4],floatround(SASDVehicles[idx][5],floatround_round),floatround(SASDVehicles[idx][6],floatround_round),floatround(SASDVehicles[idx][7],floatround_round));
                }
            }
            idx++;
        }
    }
    print("SASD Vehicles Loaded.");
    return 1;
}
Any help? Anyone? Thanks!


Re: Need some quick help! <3 - mrsamp - 25.07.2012

Any errors? Warnings?


Re: Need some quick help! <3 - maramizo - 25.07.2012

None.