SA-MP Forums Archive
whats wrong here? - 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: whats wrong here? (/showthread.php?tid=214876)



whats wrong here? - =WoR=Bruno - 22.01.2011

This is from Vortex RP

I spawn cars,save them,but in restart they dont load.

Its something wrong here?:

Код:
stock InitVehicles()
{
	new Vehicle[16];
	for(new i = 0; i < MAX_VEHICLES; i++)
	{
	    format(Vehicle, sizeof(Vehicle), "V_%d", i);
	    if(djIsSet(VEHICLES_FILE, Vehicle))
	    {
	        format(Vehicle, sizeof(Vehicle), "V_%d/PosX", i);
	        Vehicles[i][CarPosX] = djFloat(VEHICLES_FILE, Vehicle, true);
	        format(Vehicle, sizeof(Vehicle), "V_%d/PosY", i);
	        Vehicles[i][CarPosY] = djFloat(VEHICLES_FILE, Vehicle, true);
	        format(Vehicle, sizeof(Vehicle), "V_%d/PosZ", i);
	        Vehicles[i][CarPosZ] = djFloat(VEHICLES_FILE, Vehicle, true);
	        format(Vehicle, sizeof(Vehicle), "V_%d/ZAngle", i);
	        Vehicles[i][CarZAngle] = djFloat(VEHICLES_FILE, Vehicle, true);
	        format(Vehicle, sizeof(Vehicle), "V_%d/Model", i);
	        Vehicles[i][CarModel] = djInt(VEHICLES_FILE, Vehicle, true);
	        format(Vehicle, sizeof(Vehicle), "V_%d/Col1", i);
	        Vehicles[i][CarColour1] = djInt(VEHICLES_FILE, Vehicle, true);
	        format(Vehicle, sizeof(Vehicle), "V_%d/Col2", i);
	        Vehicles[i][CarColour2] = djInt(VEHICLES_FILE, Vehicle, true);
	        format(Vehicle, sizeof(Vehicle), "V_%d/Group", i);
	        Vehicles[i][CarGroup] = djInt(VEHICLES_FILE, Vehicle, true);
	        CarCount++;
	        
            if(Vehicles[i][CarModel] != 537 && Vehicles[i][CarModel] != 538 && Vehicles[i][CarModel] != 569 && 570 && Vehicles[i][CarModel] != 590)
            {
            	Vehicles[i][GameID] = AddStaticVehicleEx(Vehicles[i][CarModel], Vehicles[i][CarPosX], Vehicles[i][CarPosY], Vehicles[i][CarPosZ], Vehicles[i][CarZAngle], Vehicles[i][CarColour1], Vehicles[i][CarColour2], 3600);
            }
            
            printf("[system] InitVehicles(): Vehicle %d has spawned (spawned from %s).", i, VEHICLES_FILE);
	    }
	}
}

stock IsNumeric(string[]) { for (new i = 0, j = strlen(string); i < j; i++) if (string[i] > '9' || string[i] < '0') return 0; return 1; }



Re: whats wrong here? - Steven Paul - 22.01.2011

did you load it when gamemode starts


Re: whats wrong here? - =WoR=Bruno - 22.01.2011

it load by itself ...at console i see InitVehicle: Vehicle 0 Spawned

I think its missing something at the code,but my low scripting skills doesnt allow me to fix it xD