stock LoadPlayerVehicles(playerid) { GetPlayerVehicles{playerid} = 0; verifydestroycar{playerid} = 0; new vehcount = 0; for(new v = 0; v < MAX_SHOP_VEHICLES; v++) { new file[40]; format(file, sizeof(file), VEH_FILE, v); if(fexist(file)) { INI_ParseFile(file, "LoadVeh_%s", .bExtra = true, .extra = v); if(!strcmp(GetName(playerid), VehicleInfo[v][vOwner], false)) { new newveh = CreateVehicle(VehicleInfo[v][vModel], VehicleInfo[v][vPosX], VehicleInfo[v][vPosY], VehicleInfo[v][vPosZ], VehicleInfo[v][vPosA], VehicleInfo[v][vColor1], VehicleInfo[v][vColor2], 500000); SetVehicleNumberPlate(newveh, VehicleInfo[v][vPlate]); if(VehicleInfo[v][vPaintJob] != 0) { ChangeVehiclePaintjob(newveh, VehicleInfo[v][vPaintJob]); } if(VehicleInfo[v][vHealth] <= 251.0) { SetVehicleHealth(newveh, 1000.0); VehicleInfo[v][vHealth] = 1000.0; } else { SetVehicleHealth(newveh, VehicleInfo[v][vHealth]); } for(new m = 0; m < 12; m++) { if(GetVehicleMods[v][m] > 0) { AddVehicleComponent(newveh, GetVehicleMods[v][m]); } } if(VehicleInfo[v][vLocked] == 1) { SetVehicleParamsForAll(newveh, 0, 1); GetVehicleParamsEx(newveh, engine, lights, alarm, doors, bonnet, boot, condition); SetVehicleParamsEx(newveh, engine, lights, alarm, ON, bonnet, boot, condition); } else if(VehicleInfo[v][vLocked] == 0) { SetVehicleParamsForAll(newveh, 0, 0); GetVehicleParamsEx(newveh, engine, lights, alarm, doors, bonnet, boot, condition); SetVehicleParamsEx(newveh, engine, lights, alarm, OFF, bonnet, boot, condition); } if(VehicleInfo[v][vNeons] != NO_NEONS && VehicleInfo[v][vNeons] == BLUE_NEONS) { blueneons[newveh] = CreateObject(18648,0,0,0,0,0,0); blueneons2[newveh] = CreateObject(18648,0,0,0,0,0,0); AttachObjectToVehicle(blueneons[newveh], newveh, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(blueneons2[newveh], newveh, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); } else if(VehicleInfo[v][vNeons] != NO_NEONS && VehicleInfo[v][vNeons] == RED_NEONS) { redneons[newveh] = CreateObject(18647,0,0,0,0,0,0); redneons2[newveh] = CreateObject(18647,0,0,0,0,0,0); AttachObjectToVehicle(redneons[newveh], newveh, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(redneons2[newveh], newveh, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); } else if(VehicleInfo[v][vNeons] != NO_NEONS && VehicleInfo[v][vNeons] == GREEN_NEONS) { greenneons[newveh] = CreateObject(18649,0,0,0,0,0,0); greenneons2[newveh] = CreateObject(18649,0,0,0,0,0,0); AttachObjectToVehicle(greenneons[newveh], newveh, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(greenneons2[newveh], newveh, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); } else if(VehicleInfo[v][vNeons] != NO_NEONS && VehicleInfo[v][vNeons] == YELLOW_NEONS) { yellowneons[newveh] = CreateObject(18650,0,0,0,0,0,0); yellowneons2[newveh] = CreateObject(18650,0,0,0,0,0,0); AttachObjectToVehicle(yellowneons[newveh], newveh, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(yellowneons2[newveh], newveh, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); } else if(VehicleInfo[v][vNeons] != NO_NEONS && VehicleInfo[v][vNeons] == PINK_NEONS) { pinkneons[newveh] = CreateObject(18651,0,0,0,0,0,0); pinkneons2[newveh] = CreateObject(18651,0,0,0,0,0,0); AttachObjectToVehicle(pinkneons[newveh], newveh, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(pinkneons2[newveh], newveh, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); } IsShopVehicle[newveh] = v; GetPlayerVehicles{playerid}++; GetServerVehicles++; GetVehicleFuel[newveh] = VehicleInfo[v][vFuel]; GetVehicleCurrentHealth[newveh] = VehicleInfo[v][vHealth]; vehcount++; if(vehcount == MAX_VIP_VEHS) { return 1; } } } } return 1; }
stock UnloadPlayerVehicles(playerid) { new vehcount = 0; for(new v = 0; v < MAX_VEHICLES; v++) { if(IsShopVehicle[v] != -1) { if(!strcmp(GetName(playerid), VehicleInfo[IsShopVehicle[v]][vOwner], false)) { new color1, color2; if(GetVehicleColor(v, color1, color2)) { VehicleInfo[IsShopVehicle[v]][vColor1] = color1; VehicleInfo[IsShopVehicle[v]][vColor2] = color2; } new Float:health; GetVehicleHealth(v, health); VehicleInfo[IsShopVehicle[v]][vHealth] = health; SaveVehicleStats(IsShopVehicle[v]); DestroyNeons(v); DestroyVehicle(v); GetPlayerVehicles{playerid}--; GetServerVehicles--; IsShopVehicle[v] = -1; vehcount++; if(vehcount == MAX_VIP_VEHS) { return 1; } } } } return 1; }
public OnPlayerDisconnect(playerid, reason) { UnloadPlayerVehicles(playerid);
OnPlayerConnect { LoadPlayerVehicles(playerid); }
ohhh yea......ammm....so u need to make a new code.....maybe it should be like....
function to show vehicle to all players....//like u are doing in loadplayervehicle....u just need to make same code that show all cars to all players... i think this may help u not sure cuz im really a noob scripter lol. |
i have tried many things but it isn't working i am speechless because i have heard that in forums there's has many scripters who can do anything and solve anything but now i am hopeless visit this page 100 times in a day but there's don't have a guy to solve it for me so sad
|
The support for y_ini, dini and generally file systems has been dropped lately, even myself avoid replying to those anymore.
The method for loading all the vehicles when the vehicle starts is pretty much the same like in LoadPlayerVehicles function. The loop is used, checks if the file exists and calls INI_ParseFile. The data are stored in the VehicleInfo array and creates the vehicle. You simply ignore the owner checking part and the part that increases the player's vehicles. |