Cars wont spawn after server restart
#1

I have made it so an admin can create a personal vehicle for a player it spawns and when they relog it spawns but when the server restart it is deleted, why?


Код:
stock CreatePlayerVehicle(playerid, playervehicleid, modelid, Float: x, Float: y, Float: z, Float: angle, color1, color2, price)
{
	if(PlayerVehicleInfo[playerid][playervehicleid][pvId] == INVALID_PLAYER_VEHICLE_ID)
	{
	    PlayerCars++;
		PlayerVehicleInfo[playerid][playervehicleid][pvModelId] = modelid;
		PlayerVehicleInfo[playerid][playervehicleid][pvPosX] = x;
		PlayerVehicleInfo[playerid][playervehicleid][pvPosY] = y;
		PlayerVehicleInfo[playerid][playervehicleid][pvInsurance] = 0;
		PlayerVehicleInfo[playerid][playervehicleid][pvPosZ] = z;
		PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle] = angle;
		PlayerVehicleInfo[playerid][playervehicleid][pvColor1] = color1;
		PlayerVehicleInfo[playerid][playervehicleid][pvColor2] = color2;
		PlayerVehicleInfo[playerid][playervehicleid][pvPark] = 1;
		PlayerVehicleInfo[playerid][playervehicleid][pvPrice] = price;
		PlayerVehicleInfo[playerid][playervehicleid][pvFuel] = 100.0;
		PlayerVehicleInfo[playerid][playervehicleid][pvImpounded] = 0;
		PlayerVehicleInfo[playerid][playervehicleid][pvPlate] = 0;
		for(new m = 0; m < MAX_MODS; m++)
	    {
	    	PlayerVehicleInfo[playerid][playervehicleid][pvMods][m] = 0;
		}
		new carcreated = AddStaticVehicleEx(modelid,x,y,z,angle,color1,color2,-1);
		PlayerVehicleInfo[playerid][playervehicleid][pvId] = carcreated;
		//SetVehicleNumberPlate(carcreated, PlayerVehicleInfo[playerid][playervehicleid][pvNumberPlate]);
		return carcreated;
	}
	return INVALID_PLAYER_VEHICLE_ID;
}

stock LoadPlayerVehicles(playerid)
{
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, playername, sizeof(playername));
	printf(" Loading %s's vehicles.", playername);
	for(new v = 0; v < MAX_PLAYERVEHICLES; v++)
    {
        if(PlayerVehicleInfo[playerid][v][pvModelId] != 0 && PlayerVehicleInfo[playerid][v][pvImpounded] == 0)
        {
            PlayerCars++;
			new carcreated = AddStaticVehicleEx(PlayerVehicleInfo[playerid][v][pvModelId], PlayerVehicleInfo[playerid][v][pvPosX], PlayerVehicleInfo[playerid][v][pvPosY], PlayerVehicleInfo[playerid][v][pvPosZ], PlayerVehicleInfo[playerid][v][pvPosAngle],PlayerVehicleInfo[playerid][v][pvColor1], PlayerVehicleInfo[playerid][v][pvColor2], -1);
			PlayerVehicleInfo[playerid][v][pvId] = carcreated;
			if(!isnull(PlayerVehicleInfo[playerid][v][pvPlate]))
			{
				SetVehicleNumberPlate(carcreated, PlayerVehicleInfo[playerid][v][pvPlate]);
			}
			else
            {
					new string[128], randletter[2];
					randletter[0] = lAlphabet[random(sizeof(lAlphabet))][0];
					randletter[1] = lAlphabet[random(sizeof(lAlphabet))][0];
					format(string, sizeof(string), "%s%s%d", randletter[0], randletter[1], carcreated);
					SetVehicleNumberPlate(carcreated, string);
			}
			//SetVehicleNumberPlate(carcreated, PlayerVehicleInfo[playerid][v][pvNumberPlate]);
			if(PlayerVehicleInfo[playerid][v][pvLocked] == 1 && !IsABike(PlayerVehicleInfo[playerid][v][pvId])) LockPlayerVehicle(playerid, PlayerVehicleInfo[playerid][v][pvId], PlayerVehicleInfo[playerid][v][pvLock]);
        }
        else if(PlayerVehicleInfo[playerid][v][pvModelId] == 0 && PlayerVehicleInfo[playerid][v][pvImpounded] != 0)
            PlayerVehicleInfo[playerid][v][pvImpounded] = 0;
    }
    //LoadAllPlayerVehicleMods(playerid);
}

stock UnloadPlayerVehicles(playerid)
{
    new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, playername, sizeof(playername));
	printf(" Unloading %s's vehicles.", playername);
	for(new v = 0; v < MAX_PLAYERVEHICLES; v++)
    {
        if(PlayerVehicleInfo[playerid][v][pvId] != INVALID_PLAYER_VEHICLE_ID && PlayerVehicleInfo[playerid][v][pvImpounded] == 0)
        {
            //new Float:x, Float:y, Float:z, Float:angle;
            //GetVehiclePos(PlayerVehicleInfo[playerid][v][pvId], x, y, z);
            //GetVehicleZAngle(PlayerVehicleInfo[playerid][v][pvId], angle);
            //UpdatePlayerVehicleParkPosition(playerid, v, x, y, z, angle);
            PlayerCars--;
            if(LockStatus[PlayerVehicleInfo[playerid][v][pvId]] != 0) LockStatus[PlayerVehicleInfo[playerid][v][pvId]] = 0;
            //UpdatePlayerVehicleMods(playerid, v);
			DestroyVehicle(PlayerVehicleInfo[playerid][v][pvId]);
			PlayerVehicleInfo[playerid][v][pvId] = INVALID_PLAYER_VEHICLE_ID;
			if(PlayerVehicleInfo[playerid][v][pvAllowedPlayerId] != INVALID_PLAYER_ID)
	    	{
	    	    PlayerInfo[PlayerVehicleInfo[playerid][v][pvAllowedPlayerId]][pVehicleKeys] = INVALID_PLAYER_VEHICLE_ID;
	    	    PlayerInfo[PlayerVehicleInfo[playerid][v][pvAllowedPlayerId]][pVehicleKeysFrom] = INVALID_PLAYER_ID;
	    		PlayerVehicleInfo[playerid][v][pvAllowedPlayerId] = INVALID_PLAYER_ID;
			}
        }
    }
}
Reply
#2

why you west your time in this do simply CreateVehicle(522, 268.0431, 2937.4607, 1.7970, 3.8802, -1, -1, 10); auto car respawn when car destroy and auto colour set on her fix location
Reply
#3

Are you mad? That is not for a personal player, I'm doing it for a specific player....
Reply
#4

oh sorry you need this check it https://sampforum.blast.hk/showthread.php?tid=235593
Reply
#5

This vehicle system you had is from NGRP script dont you??

Anyeho, What do you mean by deleted? The player vehicle doesnt save? or the vehicle is deleted but it is still saved on players account?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)