exit parancsnál lesz a hiba, mivel jössz ki a házból? azt a részt másold be.
House_Exit(playerid, HouseID){// Set the player in the normal world againSetPlayerVirtualWorld(playerid, 0);SetPlayerInterior(playerid, 0);// Set the position of the player at the entrance of his houseSetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]);// Also clear the tracking-variable to track in which house the player isAPlayerData[playerid][CurrentHouse] = 0;// Check if there is a timer-value set for exiting the house (this timer freezes the player while the environment is being loaded)if (ExitHouseTimer > 0){// Don\'t allow the player to fall TogglePlayerControllable(playerid, 0);// Let the player know he\'s frozen for 5 secondsGameTextForPlayer(playerid, TXT_ExitHouseReloadEnv, ExitHouseTimer, 4);// Start a timer that will allow the player to fall again when the environment has loadedSetTimerEx(\"House_ExitTimer\", ExitHouseTimer, false, \"ii\", playerid, HouseID);}return 1;}
House_Exit(playerid, HouseID){// Set the player in the normal world againSetPlayerVirtualWorld(playerid, 0);SetPlayerInterior(playerid, 0);// Set the position of the player at the entrance of his houseSetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]);// Also clear the tracking-variable to track in which house the player isAPlayerData[playerid][CurrentHouse] = 0;// Check if there is a timer-value set for exiting the house (this timer freezes the player while the environment is being loaded)if (ExitHouseTimer > 0){// Let the player know he\'s frozen for 5 secondsGameTextForPlayer(playerid, TXT_ExitHouseReloadEnv, ExitHouseTimer, 4);// Start a timer that will allow the player to fall again when the environment has loadedTogglePlayerControllable(playerid, 1);// Respawn the player\'s vehicles near the house (only the vehicles that belong to this house)for (new CarSlot; CarSlot < 10; CarSlot++)if (AHouseData[HouseID][VehicleIDs][CarSlot] != 0) SetVehicleToRespawn(AHouseData[HouseID][VehicleIDs][CarSlot]);}return 1;}
House_Exit(playerid, HouseID){// Set the player in the normal world againSetPlayerVirtualWorld(playerid, 0);SetPlayerInterior(playerid, 0);// Set the position of the player at the entrance of his houseSetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]);// Also clear the tracking-variable to track in which house the player isAPlayerData[playerid][CurrentHouse] = 0;// Check if there is a timer-value set for exiting the house (this timer freezes the player while the environment is being loaded)if (ExitHouseTimer > 0){// Let the player know he\'s frozen for 5 secondsGameTextForPlayer(playerid, TXT_ExitHouseReloadEnv, ExitHouseTimer, 4);// Start a timer that will allow the player to fall again when the environment has loadedTogglePlayerControllable(playerid, 1);// Respawn the player\'s vehicles near the house (only the vehicles that belong to this house)for (new CarSlot; CarSlot < 10; CarSlot++)if (AHouseData[HouseID][VehicleIDs][CarSlot] != 0) SetVehicleToRespawn(AHouseData[HouseID][VehicleIDs][CarSlot]);}return 1;} próbáld így berakni és az alatti függvényt kitörölni és próbáld úgy le
szóval egy parancs sem működik amikor kilépsz a házból? próbáld úgy megnézni a parancsokat amikor belépsz a házba..
mutasd a belépési parancsot a házba
Hogy találom meg?
// ************************************************************************************************************************************************************// PPC_Housing// ************************************************************************************************************************************************************// This function returns the first free house-slot for the given playerPlayer_GetFreeHouseSlot(playerid){// Check if the player has room for another house (he hasn\'t bought the maximum amount of houses per player yet)// and get the slot-idfor (new HouseIndex; HouseIndex < MAX_HOUSESPERPLAYER; HouseIndex++) // Loop through all house-slots of the playerif (APlayerData[playerid][Houses][HouseIndex] == 0) // Check if this house slot is free return HouseIndex; // Return the free HouseIndex for this player// If there were no free house-slots, return \"-1\"return -1;}// This function returns the maximum number of car-slots, based on the house-levelHouse_GetMaxCarSlots(HouseID){// Return the maximum number of carslots, based on the house-level (every level has one carslot, so return the houselevel)return AHouseData[HouseID][HouseLevel];}// This function returns the first free carslot in the given house (or -1 if no free slot is found)House_GetFreeCarSlot(HouseID){// Get the maximum number of carslots for this house (based on the house-level)new MaxCarSlots = House_GetMaxCarSlots(HouseID);// Get the maximum number of carslots for this house and make a loop through all carslots for this housefor (new CarSlot; CarSlot < MaxCarSlots; CarSlot++){// Check if the carslot is emptyif (AHouseData[HouseID][VehicleIDs][CarSlot] == 0) return CarSlot; // Return the carslot-id}// If no carslots are free, return -1return -1;} // This function sets ownership to the given playerHouse_SetOwner(playerid, HouseID){// Setup local variablesnew HouseSlotFree, Name[24], Msg[128];// Get the first free house-slot from this playerHouseSlotFree = Player_GetFreeHouseSlot(playerid);// Check if the player has a free house-slotif (HouseSlotFree != -1){// Get the player\'s nameGetPlayerName(playerid, Name, sizeof(Name));// Store the house-id for the playerAPlayerData[playerid][Houses][HouseSlotFree] = HouseID;// Let the player pay for the houseRewardPlayer(playerid, -AHouseData[HouseID][HousePrice], 0);// Set the house as ownedAHouseData[HouseID][Owned] = true;// Store the owner-name for the houseformat(AHouseData[HouseID][Owner], 24, Name);// Set the level to 1AHouseData[HouseID][HouseLevel] = 1;// Set the default house-name (\"<playername>\'s house\")format(AHouseData[HouseID][HouseName], 100, TXT_DefaultHouseName, Name);// Also, update the pickup and map-icon for this houseHouse_UpdateEntrance(HouseID);// Save the player-file (and also his houses/businesses)PlayerFile_Save(playerid);// Let the player know he bought the houseformat(Msg, 128, TXT_PlayerBoughtHouse, AHouseData[HouseID][HousePrice]);SendClientMessage(playerid, 0xFFFFFFFF, Msg);}else SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerOwnsMaxHouses);return 1;} // This function is used to spawn back at the entrance of your house House_Exit(playerid, HouseID) { // Set the player in the normal world again SetPlayerVirtualWorld(playerid, 0); SetPlayerInterior(playerid, 0); // Set the position of the player at the entrance of his house SetPlayerPos(playerid, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]); // Also clear the tracking-variable to track in which house the player is APlayerData[playerid][CurrentHouse] = 0; // Check if there is a timer-value set for exiting the house (this timer freezes the player while the environment is being loaded) if (ExitHouseTimer > 0) { // Let the player know he\'s frozen for 5 seconds GameTextForPlayer(playerid, TXT_ExitHouseReloadEnv, ExitHouseTimer, 4); // Start a timer that will allow the player to fall again when the environment has loaded TogglePlayerControllable(playerid, 1); // Respawn the player\'s vehicles near the house (only the vehicles that belong to this house) for (new CarSlot; CarSlot < 10; CarSlot++) if (AHouseData[HouseID][VehicleIDs][CarSlot] != 0) SetVehicleToRespawn(AHouseData[HouseID][VehicleIDs][CarSlot]); } return 1; }forward House_ExitTimer(playerid, HouseID);public House_ExitTimer(playerid, HouseID){// Allow the player to move again (environment should have been loaded now) TogglePlayerControllable(playerid, 1);// Respawn the player\'s vehicles near the house (only the vehicles that belong to this house)for (new CarSlot; CarSlot < 10; CarSlot++)if (AHouseData[HouseID][VehicleIDs][CarSlot] != 0) SetVehicleToRespawn(AHouseData[HouseID][VehicleIDs][CarSlot]);return 1;} // This function adds a pickup for the given houseHouse_CreateEntrance(HouseID){// Setup local variablesnew Msg[128], Float:x, Float:y, Float:z;// Get the coordinates of the house\'s pickup (usually near the door)x = AHouseData[HouseID][HouseX];y = AHouseData[HouseID][HouseY];z = AHouseData[HouseID][HouseZ];// Add a new pickup at the house\'s location (usually near the door), green = free, blue = ownedif (AHouseData[HouseID][Owned] == true){// Create a blue house-pickup (house is owned) AHouseData[HouseID][PickupID] = CreateDynamicPickup(1272, 1, x, y, z, 0);// Create the 3DText that appears above the house-pickup (displays the housename and the name of the owner)format(Msg, 128, TXT_PickupHouseOwned, AHouseData[HouseID][HouseName], AHouseData[HouseID][Owner], AHouseData[HouseID][HouseLevel]);AHouseData[HouseID][DoorText] = CreateDynamic3DTextLabel(Msg, 0x008080FF, x, y, z + 1.0, 50.0);// Add a streamed icon to the map (red house), type = 32, color = 0, world = 0, interior = 0, playerid = -1, drawdist = 150.0if (ShowBoughtHouses == true) AHouseData[HouseID][MapIconID] = CreateDynamicMapIcon(x, y, z, 32, 0, 0, 0, -1, 150.0);}else{ // Create a green house-pickup (house is free)AHouseData[HouseID][PickupID] = CreateDynamicPickup(1273, 1, x, y, z, 0);// Create the 3DText that appears above the house-pickup (displays the price of the house)format(Msg, 128, TXT_PickupHouseForSale, AHouseData[HouseID][HousePrice], AHouseData[HouseID][HouseMaxLevel]);AHouseData[HouseID][DoorText] = CreateDynamic3DTextLabel(Msg, 0x008080FF, x, y, z + 1.0, 50.0);// Add a streamed icon to the map (green house), type = 31, color = 0, world = 0, interior = 0, playerid = -1, drawdist = 150.0AHouseData[HouseID][MapIconID] = CreateDynamicMapIcon(x, y, z, 31, 0, 0, 0, -1, 150.0);}}// This function changes the pickup (and map-icon) for the given house (used when buying or selling a house)House_UpdateEntrance(HouseID){// Setup local variablesnew Msg[128], Float:x, Float:y, Float:z;// Get the coordinates of the house\'s pickup (usually near the door)x = AHouseData[HouseID][HouseX];y = AHouseData[HouseID][HouseY];z = AHouseData[HouseID][HouseZ];// Destroy the pickup and map-icon near the house\'s entranceDestroyDynamicPickup(AHouseData[HouseID][PickupID]);DestroyDynamicMapIcon(AHouseData[HouseID][MapIconID]);// Add a new pickup at the house\'s location (usually near the door), green = free, blue = ownedif (AHouseData[HouseID][Owned] == true){// Create a blue house-pickup (house is owned) AHouseData[HouseID][PickupID] = CreateDynamicPickup(1272, 1, x, y, z, 0);// Update the 3DText that appears above the house-pickup (displays the housename and the name of the owner)format(Msg, 128, TXT_PickupHouseOwned, AHouseData[HouseID][HouseName], AHouseData[HouseID][Owner], AHouseData[HouseID][HouseLevel]);UpdateDynamic3DTextLabelText(AHouseData[HouseID][DoorText], 0x008080FF, Msg);// Add a streamed icon to the map (red house), type = 32, color = 0, world = 0, interior = 0, playerid = -1, drawdist = 150.0if (ShowBoughtHouses == true) AHouseData[HouseID][MapIconID] = CreateDynamicMapIcon(x, y, z, 32, 0, 0, 0, -1, 150.0);}else{ // Create a green house-pickup (house is free)AHouseData[HouseID][PickupID] = CreateDynamicPickup(1273, 1, x, y, z, 0);// Update the 3DText that appears above the house-pickup (displays the price of the house)format(Msg, 128, TXT_PickupHouseForSale, AHouseData[HouseID][HousePrice], AHouseData[HouseID][HouseMaxLevel]);UpdateDynamic3DTextLabelText(AHouseData[HouseID][DoorText], 0x008080FF, Msg);// Add a streamed icon to the map (green house), type = 31, color = 0, world = 0, interior = 0, playerid = -1, drawdist = 150.0AHouseData[HouseID][MapIconID] = CreateDynamicMapIcon(x, y, z, 31, 0, 0, 0, -1, 150.0);}}// This function adds a vehicle to the house (if possible)House_AddVehicle(HouseID, cModel, cPaint, cComponents[], Float:cx, Float:cy, Float:cz, Float:crot, Col1, Col2){// Setup local variablesnew vid, CarSlot, vText[128];// Get a free carslot from the houseCarSlot = House_GetFreeCarSlot(HouseID);// Check if there is a free carslotif (CarSlot != -1){// Create a new vehicle and get the vehicle-idvid = CreateVehicle(cModel, cx, cy, cz, crot, Col1, Col2, 600);// Store the vehicle-id in the house\'s free carslotAHouseData[HouseID][VehicleIDs][CarSlot] = vid;// Save the model of the vehicleAVehicleData[vid][Model] = cModel;// Save the paintjob of the vehicle and apply itAVehicleData[vid][PaintJob] = cPaint;if (cPaint != 0) ChangeVehiclePaintjob(vid, cPaint - 1);// Also update the car-colorChangeVehicleColor(vid, Col1, Col2);// Save the colors of the vehicleAVehicleData[vid][Color1] = Col1;AVehicleData[vid][Color2] = Col2;// Save the components of the vehicle and apply themfor (new i; i < 14; i++){ AVehicleData[vid][Components] = cComponents; // Check if the componentslot has a valid component-id if (AVehicleData[vid][Components] != 0) AddVehicleComponent(vid, AVehicleData[vid][Components]); // Add the component to the vehicle}// Save the spawn-data of the vehicle AVehicleData[vid][spawnX] = cx; AVehicleData[vid][spawnY] = cy; AVehicleData[vid][spawnZ] = cz; AVehicleData[vid][spawnRot] = crot;// Also set the fuel to maximumAVehicleData[vid][Fuel] = MaxFuel;// Also set the ownerAVehicleData[vid][Owned] = true;format(AVehicleData[vid][Owner], 24, AHouseData[HouseID][Owner]);// Save the HouseID for the vehicleAVehicleData[vid][belongsToHouse] = HouseID;// Add a 3DText label to the vehicle, displaying the name of the owner format(vText, sizeof(vText), \"Vehicle owned by: \\n%s\", AVehicleData[vid][Owner]); AVehicleData[vid][VehicleText] = CreateDynamic3DTextLabel(vText, 0xFFFFFF, 0.0, 0.0, 0.0, 80.0, INVALID_PLAYER_ID, vid);}else // No free carslot was found, return 0return 0;// Exit the function and return the vehicle-idreturn vid;}// This function is used only when you respawn your vehicles by exiting your houseHouse_ReplaceVehicle(HouseID, CarSlot){// Setup local variablesnew vid, cModel, cPaint, cComponents[14], Float:cx, Float:cy, Float:cz, Float:crot, Col1, Col2, Float:Health, cFuel, Neons;new panels, doors, lights, tires;// Get the data from the already existing vehicle that was parked beforevid = AHouseData[HouseID][VehicleIDs][CarSlot];cModel = AVehicleData[vid][Model];cPaint = AVehicleData[vid][PaintJob];cFuel = AVehicleData[vid][Fuel];for (new i; i < 14; i++) cComponents = AVehicleData[vid][Components];Col1 = AVehicleData[vid][Color1];Col2 = AVehicleData[vid][Color2];cx = AVehicleData[vid][spawnX];cy = AVehicleData[vid][spawnY];cz = AVehicleData[vid][spawnZ];crot = AVehicleData[vid][spawnRot];Neons = AVehicleData[vid][NeonObjectModel];GetVehicleHealth(vid, Health);GetVehicleDamageStatus(vid, panels, doors, lights, tires);// Remove neonsif (AVehicleData[vid][NeonObjectModel] != 0){ DestroyObject(AVehicleData[vid][NeonLeft]); DestroyObject(AVehicleData[vid][NeonRight]); AVehicleData[vid][NeonLeft] = 0; AVehicleData[vid][NeonRight] = 0;AVehicleData[vid][NeonObjectModel] = 0;}// Delete the vehicle and clear the dataVehicle_Delete(vid);// Create a new vehicle in the same carslotvid = House_AddVehicle(HouseID, cModel, cPaint, cComponents, Float:cx, Float:cy, Float:cz, Float:crot, Col1, Col2);// Update the fuel of the vehicle to the previous settingAVehicleData[vid][Fuel] = cFuel;// Update the health to what it was before and update the bodyworkSetVehicleHealth(vid, Health);UpdateVehicleDamageStatus(vid, panels, doors, lights, tires);// Re-apply the neons if they were thereif (Neons != 0){AVehicleData[vid][NeonObjectModel] = Neons; AVehicleData[vid][NeonLeft] = CreateObject(AVehicleData[vid][NeonObjectModel],0,0,0,0,0,0); AVehicleData[vid][NeonRight] = CreateObject(AVehicleData[vid][NeonObjectModel],0,0,0,0,0,0);AttachObjectToVehicle(AVehicleData[vid][NeonLeft], vid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);AttachObjectToVehicle(AVehicleData[vid][NeonRight], vid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);}return vid;}// This function is used only when a player logs out (the vehicles are unloaded)House_RemoveVehicles(HouseID){// Setup local variablesnew vid;// Loop through all carslots of this housefor (new CarSlot; CarSlot < 10; CarSlot++){// Get the vehicle-idvid = AHouseData[HouseID][VehicleIDs][CarSlot];// Check if there was a vehicle in this carslotif (vid != 0){ // Delete the vehicle and clear the data DestroyVehicle(vid); AHouseData[HouseID][VehicleIDs][CarSlot] = 0; AVehicleData[vid][Owned] = false; AVehicleData[vid][Owner] = 0; AVehicleData[vid][Model] = 0; AVehicleData[vid][PaintJob] = 0; for (new i; i < 14; i++) AVehicleData[vid][Components] = 0; AVehicleData[vid][spawnX] = 0.0; AVehicleData[vid][spawnY] = 0.0; AVehicleData[vid][spawnZ] = 0.0; AVehicleData[vid][spawnRot] = 0.0; AVehicleData[vid][belongsToHouse] = 0; DestroyDynamic3DTextLabel(AVehicleData[vid][VehicleText]); // Remove neons if (AVehicleData[vid][NeonObjectModel] != 0) { DestroyObject(AVehicleData[vid][NeonLeft]); DestroyObject(AVehicleData[vid][NeonRight]); AVehicleData[vid][NeonLeft] = 0; AVehicleData[vid][NeonRight] = 0; AVehicleData[vid][NeonObjectModel] = 0; }}}}// This function calculates the sell-price for the given houseHouse_CalcSellPrice(HouseID){// Setup local variablesnew SellPrice, NumUpgrades, UpgradePrice;// Calculate 50% of the original buying price (base-price for selling)SellPrice = AHouseData[HouseID][HousePrice] / 2;// Calculate the number of upgrades applied to the houseNumUpgrades = AHouseData[HouseID][HouseLevel] - 1;// Also calculate 50% for each upgrade, based on the percentage for upgrading the houseUpgradePrice = ((AHouseData[HouseID][HousePrice] / 100) * HouseUpgradePercent) * NumUpgrades;// Add 50% of the upgrade-price to the sell-priceSellPrice = SellPrice + UpgradePrice;// Return the total sell-price to the calling functionreturn SellPrice;}// his function returns \"1\" if the given player is the owner of the given houseHouse_PlayerIsOwner(playerid, HouseID){// Loop through all houses owner by this playerfor (new i; i < MAX_HOUSESPERPLAYER; i++){// Check if the player owns the house in any of his house-slotsif (APlayerData[playerid][Houses] == HouseID) return 1;}// If the player doesn\'t own the house, return 0return 0;}