Player vehicles (PLEASE HELP +REP)
#1

Hey all... (+REP promised if it will work)
Please read all i have written !
My GM based when player connects it will load theirs vehicles, i want to switch it to load all the vehicles (when launch the server OnGameModeInit() ) from each account it will load the valid vehicles.
Example: I have 2 vehicles: sultan and huntley - so it will load them to their park in the server (the vehicle spawn point /park)

The problem is when i launch the server - i go to to my /park location of my vehicle and they aren't spawned.
NOTE*: I attempted to do it myself but no success
So this is the \scriptfiles\users folder with all the registered users:



Here i attempted to loop all the registered players from \scriptfiles\users and to check if they have vehicle but i have no idea.
OnGameModeInit()
Код:
for(new d = 0; d < sizeof(PlayerInfo); d++)
	{
		LoadPlayerVehicles(d);
	}
Another one from OnGameModeInit i addded:

Код:
for(new i = 0; i < MAX_PLAYERS; i++)
	{
		for(new v = 0; v < MAX_PLAYERVEHICLES; v++)
		{
			PlayerVehicleInfo[i][v][pvModelId] = 0;
			PlayerVehicleInfo[i][v][pvPosX] = 0.0;
			PlayerVehicleInfo[i][v][pvPosY] = 0.0;
			PlayerVehicleInfo[i][v][pvPosZ] = 0.0;
			PlayerVehicleInfo[i][v][pvPosAngle] = 0.0;
			PlayerVehicleInfo[i][v][pvPaintJob] = -1;
			PlayerVehicleInfo[i][v][pvColor1] = 126;
			PlayerVehicleInfo[i][v][pvColor2] = 126;
			PlayerVehicleInfo[i][v][pvPrice] = 0;
			PlayerVehicleInfo[i][v][pvFuel] = 100.0;
			PlayerVehicleInfo[i][v][pvImpounded] = 0;
		}
	}
The stock of loading the player's vehicles, from playerid i changed all to 'i' - (i) [i]
Код:
stock LoadPlayerVehicles(i)
{
	print(" Loading all players vehicles.");
	for(new v = 0; v < MAX_PLAYERVEHICLES; v++)
    {
        if(PlayerVehicleInfo[i][v][pvModelId] != 0 && PlayerVehicleInfo[i][v][pvImpounded] == 0)
        {
            PlayerCars++;
			new carcreated = CreateVehicle(PlayerVehicleInfo[i][v][pvModelId], PlayerVehicleInfo[i][v][pvPosX], PlayerVehicleInfo[i][v][pvPosY], PlayerVehicleInfo[i][v][pvPosZ], PlayerVehicleInfo[i][v][pvPosAngle],PlayerVehicleInfo[i][v][pvColor1], PlayerVehicleInfo[i][v][pvColor2], -1);
			PlayerVehicleInfo[i][v][pvId] = carcreated;
			VehicleFuel[carcreated] = PlayerVehicleInfo[i][v][pvFuel];
			SetVehicleHealth(carcreated, PlayerVehicleInfo[i][v][pvCarHealth]);
			//SetVehicleNumberPlate(carcreated, PlayerVehicleInfo[i][v][pvNumberPlate]);
			if(PlayerVehicleInfo[i][v][pvLocked] == 1) LockPlayerVehicle(i, PlayerVehicleInfo[i][v][pvId], PlayerVehicleInfo[i][v][pvLock]);
        }
        else if(PlayerVehicleInfo[i][v][pvModelId] == 0 && PlayerVehicleInfo[i][v][pvImpounded] != 0)
            PlayerVehicleInfo[i][v][pvImpounded] = 0;
    }
}
This is to check specific player name:
Код:
doesAccountExist(account_name[]) {

	new
		sz_accStr[MAX_PLAYER_NAME + 12];

	format(sz_accStr, sizeof(sz_accStr), "users/%s.ini", account_name);
	if(fexist(sz_accStr)) {

		new
			File: f_Handle = fopen(sz_accStr, io_read);

		if(flength(f_Handle) > 0) {
			fclose(f_Handle);
			return 1;
		}
		fclose(f_Handle);
	}
	return 0;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)