16.04.2013, 01:29
Buenas. Tengo un pequeсo problema, Explico. Resulta que el GM que estoy haciendo desde 0 al desconectarse se despwnean los vehiculos que el jugador haya comprado, El stock que uso serнa ''UnLoadPlayerVehicles'', Ok todo perfecto. Lo que yo queria hacer era que al desconectarse el jugador no se despawneen los vehiculos, Entonces saque el ''UnloadPlayerVehicles'' del callback OnPlayerDisconnect, Entonces asi no se despawnean, Tambien poseo otro stock que realiza la funcion de cargar el vehiculo del jugador al conectarse que es ''LoadPlayerVehicles'' que esta en el callback ''OnPlayerConnect'' entonces tambien lo quite para que no cause errores. Todo bien hasta ahн, Testee que funcionara bien desconectandome y todo bien. Pero mi error biene al apagar la consola y despues encenderla los vehiculos de los jugadores ya no spawnean, Peor aъn aparece como que no tuviesen ni uno, Teniendo antes de reiniciar la consola. Ya intente colocar la funciуn ''LoadPlayerVehicles'' en OnGamemodeInit, Asн carguen los autos de los jugadores al abrir la consola, Pero no funciono. Si alguien podrнa guiarme o decirme en que estoy fallando se lo agradecerнa mucho.
Aca dejo los stocks de ''UnloadPlayerVehicles'' y ''LoadPlayerVehicles''
Aca dejo los stocks de ''UnloadPlayerVehicles'' y ''LoadPlayerVehicles''
Код:
// Spawnea los autos que posea el jugador stock LoadPlayerVehicles(playerid) { new playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, sizeof(playername)); //printf(" Cargado los autos de %s.", playername); for(new v = 0; v < MAX_PLAYERVEHICLES; v++) { if(PlayerVehicleInfo[playerid][v][pvModelId] != 0 && PlayerVehicleInfo[playerid][v][pvImpounded] == 0) { PlayerCars++; new carcreated = CreateVehicle(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; VehicleFuel[carcreated] = PlayerVehicleInfo[playerid][v][pvFuel]; //SetVehicleNumberPlate(carcreated, PlayerVehicleInfo[playerid][v][pvNumberPlate]); if(PlayerVehicleInfo[playerid][v][pvLocked] == 1) 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); } // Despawnea los autos que posea el jugador 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]); VehicleFuel[PlayerVehicleInfo[playerid][v][pvId]] = 1000; 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; } } } }