SA-MP Forums Archive
Help. - 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: Help. (/showthread.php?tid=559151)



Help. - Rabea - 21.01.2015

Okey i need some help i hope some one will help me.
i downloaded a server, in this server will load the owned vehicle when player connect and when player disconnect the owned vehicle will destroy to avoid lagging.
This kinda non-rp.
what i want is when i start the server, all owned vehicles be loaded.
i need to use InGameModeInit but idk how.

i have this code in "stock loadchar" < this like onplayerconnect.

pawn Код:
if(PlayerInfo[playerid][vModel])
    {
        PlayerInfo[playerid][pVeh] = CreateVehicle(PlayerInfo[playerid][vModel], PlayerInfo[playerid][vX],PlayerInfo[playerid][vY],PlayerInfo[playerid][vZ],PlayerInfo[playerid][vA],PlayerInfo[playerid][vC1],PlayerInfo[playerid][vC2],32000);
        ChangeVehiclePaintjob(PlayerInfo[playerid][pVeh], PlayerInfo[playerid][vPJ]);
        if(PlayerInfo[playerid][vLocked]) SetVehicleParamsEx(PlayerInfo[playerid][pVeh], 0, 0, 0, 1, 0, 0, 0);
        SetVehicleNumberPlate(PlayerInfo[playerid][pVeh], PlayerInfo[playerid][pVehPlate]);
        for(new i=0; i<14; i++)
        {
            AddVehicleComponent(PlayerInfo[playerid][pVeh], PlayerInfo[playerid][pVehMod][i]);
        }
    }
What i should do to make it when InGameModeInIt the owned vehicles will be loaded.


Re: Help. - BroZeus - 21.01.2015

Is it Y_ini or MySQL and if MySQL then what version of MySQL..?


Re: Help. - Rabea - 21.01.2015

Y_ini.
( y_ini is ysi right lel? )
i found this #include <YSI\y_ini>


Re: Help. - BroZeus - 21.01.2015

For this you need to loop through all user files OnGameModeInIt and load data and createvehicle.
BUT sadly currently it is impossible to get listing of files/directory through the natives that current SA-MP provides, for achieving this you need a file management plugin which supports directory/file listing functions
Here I found a list of File management plugins from Plugin List topic :


Re: Help. - Rabea - 21.01.2015

i didn't get it comletely.
what i need to do is copy all loadchar to ongamemodeinit.
and download all this links to be able to create files

EDIT: just add this "LoadChar()" to ongamemodeinit ?


Re: Help. - Rabea - 21.01.2015

i can't make file to save vehicles?
tell me what is the problem...


Re: Help. - Rabea - 22.01.2015

Bump


Re: Help. - Rabea - 22.01.2015

Bump, what is the soluation?


Re: Help. - Stanford - 22.01.2015

Alright,

You are saying that you are using Y_INI for loading/saving, well you cannot do a loop for all files, this will be quite easy in MySQL, but according to your system it's sort of 'impossible'.

To make this possible, I suggest re-creating the vehicles system and make it separated from the player.

I hope I helped


Re: Help. - Rabea - 22.01.2015

i'm using Y_INI for alot of things, not only vehicles.
so i can use y_ini to another things and vehicle system for mysql?