Üzenetek megjelenítése

Ez a szekció lehetővé teszi a felhasználó által írt összes hozzászólás megtekintését. Vedd figyelembe, hogy csak azokba a fórumokba írt hozzászólásokat látod, amelyekhez hozzáférésed van.


Témák - Tobi

Oldalak: [1]
1
Segítségkérés / Chat Box dialog
« Dátum: 2015. július 01. - 16:15:03 »
Sziasztok.
Már nagyon régóta kerekes egy ehhez hasonló \"Chat Boxot\", de sajnos sehol se találok.
Nos ennek az lenne a lényege, hogy amint beírom a parancsot megjelenik egy Inputos dialog. És 10 sor erejéig képes megjegyezni a beírt szövegeket(Lásd kép).
Továbbá még, hogy ha valaki üzenetet rögzít akkor a Chat-be jelezze SendClientel.
Továbbá az is nagyszerű lenne, hogy ha DINI-vel kezelve az üzeneteket rögzítené egy TXT-be.
A leírtakhoz hasonlót hol a viharba találok? Már 3 napja csak a nettet bújom de sehol semmi, mint ha ilyen nem létezne.
A box adminchat célra kellene.
\"sa-mp-014_m_solata_www.kepfeltoltes.hu_.png\"
\"sa-mp-014_www.kepfeltoltes.hu_.png\"
Égető sürgősséggel kellene a cuccli.
Köszi előre is!
Képek:
http://kepfeltoltes.hu/150701/sa-mp-014_www.kepfeltoltes.hu_.png
http://kepfeltoltes.hu/150701/sa-mp-014_m_solata_www.kepfeltoltes.hu_.png

2
Segítségkérés / háztörlés funkció
« Dátum: 2014. december 25. - 12:29:08 »
Sziasztok...Tudnátok segíteni abba hogy ha beírok egy parancsot és akkor törölje az összes házat ami azon a profilon van? És ami a house mappába is van .ini fájét profil parancsot kezdtem el de nem jutok egyről a kettőre..Tudnátok segíteni hogy mit hova?
 
// This command searches every house and business that the player owns and restores the data for it in the player\'s account
COMMAND:profil(playerid, params[])
{
// Setup local variables
new Name[24], AdminName[24], Msg[128], OtherPlayer;
// Send the command to all admins so they can see it
SendAdminText(playerid, \"/profil\", params);
    if ((GetPlayerState(playerid) == PLAYER_STATE_WASTED) || (GetPlayerState(playerid) == PLAYER_STATE_NONE)) return SendClientMessage(playerid, 0xFFFFFFFF, \"{FF0000}Először spawnol le a parancs használatára!\");
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player\'s admin-level is at least 5
if (APlayerData[playerid][PlayerLevel] >= 5)
{
   if (sscanf(params, \"u\", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, \"Használd: \\\"/profil <JátékosNév/ID>\\\"\");
   else
   {
       // Check if the other player is logged in
      //if (APlayerData[OtherPlayer][LoggedIn] == true)
      //{
         // Get the names of both players
         GetPlayerName(playerid, AdminName, sizeof(AdminName));
         GetPlayerName(OtherPlayer, Name, sizeof(Name));
                       // Setup local variables
         //new Msg[128];
         // Loop through all player-owned houses
         for (new HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
         {
            // Check if the house exists (it must have a valid pickup)
            if (IsValidDynamicPickup(AHouseData[HouseID][PickupID]))
            {
               // Check if the player is in range of the house-pickup
               //if (IsPlayerInRangeOfPoint(playerid, 2.0, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
               //{
                  // Delete the house, inform the owner if he\'s online and remove the house from the owner\'s account
                  House_Delete(HouseID);
                  // Also let the player know he deleted the house
                  format(Msg, 128, \"{00FF00}Te tőrőltél egy házat ID: {FFFF00}%i\", HouseID);
                  SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                  // Exit the function
                  return 1;
               //}
            }
         }
         // In case no house was found in range, try to find a business to delete
         // Loop through all businesses
         for (new BusID = 1; BusID < MAX_BUSINESS; BusID++)
         {
            // Check if the business exists (it must have a valid pickup)
            if (IsValidDynamicPickup(ABusinessData[busID][PickupID]))
            {
               // Check if the player is in range of the house-pickup
               //if (IsPlayerInRangeOfPoint(playerid, 2.5, ABusinessData[busID][businessX], ABusinessData[busID][businessY], ABusinessData[busID][businessZ]))
               //{
                  // Delete the business, inform the owner if he\'s online and remove the business from the owner\'s account
                  Business_Delete(BusID);
                  // Also let the player know he deleted the business
                  format(Msg, 128, \"{00FF00}Te torőltél egy bóltot ID: {FFFF00}%i\", BusID);
                  SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                  // Exit the function
                  return 1;
               //}
            }
         }
         // Clear the houses and businesses that the player owns right now
         for (new i; i < MAX_HOUSESPERPLAYER; i++)
             APlayerData[OtherPlayer][Houses] = 0;
         for (new i; i < MAX_BUSINESSPERPLAYER; i++)
             APlayerData[OtherPlayer][business] = 0;
         // Now search through all houses and re-add them to the player
         for (new HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
            if (AHouseData[HouseID][Owned] == true) // Check if the house is owned by somebody
               if (strcmp(AHouseData[HouseID][Owner], Name, false) == 0) // Check if the player is the owner of the house
               {
                  for (new i; i < MAX_HOUSESPERPLAYER; i++) // Loop through all houses the player owns
                      if (APlayerData[OtherPlayer][Houses] == 0) // Check if the houseslot is free
                      {
                        APlayerData[OtherPlayer][Houses] = HouseID; // Store the HouseID
                        break; // Stop searching for more free slots
                      }
               }
         // Now search through all businesses and re-add them to the player
         for (new BusID = 1; BusID < MAX_BUSINESS; BusID++)
            if (ABusinessData[busID][Owned] == true) // Check if the business is owner by someone
               if (strcmp(ABusinessData[busID][Owner], Name, false) == 0) // Check if the player is the owner of the business
               {
                  for (new i; i < MAX_BUSINESSPERPLAYER; i++) // Loop through all businesses the player owns
                      if (APlayerData[OtherPlayer][business] == 0) // Check if the businessslot is free
                      {
                        APlayerData[OtherPlayer][business] = BusID; // Store the BusID
                        break; // Stop searching for more free slots
                      }
               }
         // Let the other player know his property has been restored
         format(Msg, 128, \"{00FF00}Sikeresen javítottad az adatait by: {FFFF00}%s\", AdminName);
         SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
         // Save the other player\'s account
         PlayerFile_Save(OtherPlayer);
      /*}
      else*/
         // SendClientMessage(playerid, 0xFFFFFFFF, \"{FF0000}Ez a játkos nem csatlakozott/vagy nincs fent\");
   }
}
else
   return 0;
}
else
    return 0;
// Let the server know that this was a valid command
return 1;
}
// This command lets the player evict a house or business (remove ownership of the house or business to make it available for sale again)
COMMAND:evict(playerid, params[])
{
// Send the command to all admins so they can see it
SendAdminText(playerid, \"/evict\", params);
// Exit the command if the player hasn\'t logged in using his password
if (APlayerData[playerid][LoggedIn] == false) return 0;
// Exit the command if the player has an admin-level lower than 5
if (APlayerData[playerid][PlayerLevel] < 5) return 0;
// Exit the command if the player is inside a vehicle
if (GetPlayerVehicleSeat(playerid) != -1) return SendClientMessage(playerid, 0xFFFFFFFF, \"{FF0000}Nem használhatod /evict -parancsot járműben\");
// Setup local variables
new Msg[128];
// Loop through all player-owned houses
for (new HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
{
// Check if the house exists (it must have a valid pickup)
if (IsValidDynamicPickup(AHouseData[HouseID][PickupID]))
{
   // Check if the player is in range of the house-pickup
   if (IsPlayerInRangeOfPoint(playerid, 2.5, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
   {
      // Check if the house is owned
      if (AHouseData[HouseID][Owned] == true)
      {
         // Evict the house, inform the owner if he\'s online and remove the house from the owner\'s account
         House_Evict(HouseID);
         // Also let the player know he evicted the house
         format(Msg, 128, \"{00FF00}Lefoglaltad a házad ID: {FFFF00}%i\", HouseID);
         SendClientMessage(playerid, 0xFFFFFFFF, Msg);
         // Exit the function
         return 1;
      }
      else
         return SendClientMessage(playerid, 0xFFFFFFFF, \"{FF0000}Ennek a háznak nincs tulajdonosa ezért lefoglatuk\");
   }
}
}
// In case no house was found in range, try to find a business to delete
// Loop through all businesses
for (new BusID = 1; BusID < MAX_BUSINESS; BusID++)
{
// Check if the business exists (it must have a valid pickup)
if (IsValidDynamicPickup(ABusinessData[busID][PickupID]))
{
   // Check if the player is in range of the house-pickup
   if (IsPlayerInRangeOfPoint(playerid, 2.5, ABusinessData[busID][businessX], ABusinessData[busID][businessY], ABusinessData[busID][businessZ]))
   {
      // Check if the business is owned
      if (ABusinessData[busID][Owned] == true)
      {
         // Evict the business, inform the owner if he\'s online and remove the business from the owner\'s account
         Business_Evict(BusID);
         // Also let the player know he evicted the business
         format(Msg, 128, \"{00FF00}Lefoglaltad az üzletet ID: {FFFF00}%i\", BusID);
         SendClientMessage(playerid, 0xFFFFFFFF, Msg);
         // Exit the function
         return 1;
      }
      else
         return SendClientMessage(playerid, 0xFFFFFFFF, \"{FF0000}Ennek a boltnak nincs tulajdonosa ezért lefoglaltuk\");
   }
}
}
// There was no house or business in range, so let the player know about it
SendClientMessage(playerid, 0xFFFFFFFF, \"{FF0000}Nincs ház/bolt a kőzelben\");
// Let the server know that this was a valid command
return 1;
}
 
// This function will delete the given house from the server and from the owner\'s account (if it has an owner)
House_Delete(HouseID)
{
// Setup local variables
new file[100], Msg[128], Name[24], bool:PlayerOnline = false;
// Check if the house is owned
if (AHouseData[HouseID][Owned] == true)
{
// Loop through all players to find the owner (if he\'s online)
for (new pid; pid < MAX_PLAYERS; pid++)
{
   // Check if this player is online
    if (IsPlayerConnected(pid))
    {
        // Get that player\'s name
        GetPlayerName(pid, Name, sizeof(Name));
        // Compare if this player has the same name as the owner of the house
      if (strcmp(AHouseData[HouseID][Owner], Name, false) == 0)
      {
          // Set PlayerOnline to \"true\"
          PlayerOnline = true;
         // Inform the player that his house is being deleted
         format(Msg, 128, \"{FFF000}A {FF0000}\\\"%s\\\"{FFF000} házad törölve lett\", AHouseData[HouseID][HouseName]);
         SendClientMessage(pid, 0xFFFFFFFF, Msg);
         // Also remove the HouseID from his list of houses
         for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
             // Check if the house is stored in this houseslot
             if (APlayerData[pid][Houses][HouseSlot] == HouseID)
                 // If the house is stored in this slot, clear the slot
                 APlayerData[pid][Houses][HouseSlot] = 0;
         // Save the player\'s account again
         PlayerFile_Save(pid);
         // Stop this For-loop, as the owner was already found and informed
         break;
      }
    }
}
// Check if the player was not online
if (PlayerOnline == false)
   // Remove the house from the player\'s account (open the account, remove the data and re-save it)
   PlayerFile_RemoveProperty(AHouseData[HouseID][Owner], HouseID, 0);
}
// First remove all vehicles from the house
House_RemoveVehicles(HouseID);
// Clear all data of the house
AHouseData[HouseID][HouseName] = 0;
AHouseData[HouseID][insurance] = 0;
AHouseData[HouseID][HouseX] = 0.0;
AHouseData[HouseID][HouseY] = 0.0;
AHouseData[HouseID][HouseZ] = 0.0;
AHouseData[HouseID][HouseLevel] = 0;
AHouseData[HouseID][HouseMaxLevel] = 0;
AHouseData[HouseID][HousePrice] = 0;
AHouseData[HouseID][Owned] = false;
AHouseData[HouseID][Owner] = 0;
// Destroy the mapicon, 3DText and pickup for the house
DestroyDynamicPickup(AHouseData[HouseID][PickupID]);
DestroyDynamicMapIcon(AHouseData[HouseID][MapIconID]);
DestroyDynamic3DTextLabel(AHouseData[HouseID][DoorText]);
AHouseData[HouseID][PickupID] = 0;
AHouseData[HouseID][MapIconID] = 0;
// Delete the House-file
format(file, sizeof(file), HouseFile, HouseID); // Construct the complete filename for this house-file
if (fexist(file)) // Make sure the file exists
fremove(file); // Delete the file
}
// This function will evict the given house from the server and from the owner\'s account (if it has an owner)
House_Evict(HouseID)
{
// Setup local variables
new Msg[128], Name[24], bool:PlayerOnline = false;
// Check if the house is owned
if (AHouseData[HouseID][Owned] == true)
{
// Loop through all players to find the owner (if he\'s online)
for (new pid; pid < MAX_PLAYERS; pid++)
{
   // Check if this player is online
    if (IsPlayerConnected(pid))
    {
        // Get that player\'s name
        GetPlayerName(pid, Name, sizeof(Name));
        // Compare if this player has the same name as the owner of the house
      if (strcmp(AHouseData[HouseID][Owner], Name, false) == 0)
      {
          // Set PlayerOnline to \"true\"
          PlayerOnline = true;
         // Inform the player that his house is being deleted
         format(Msg, 128, \"{FFF000}A {FF0000}\\\"%s\\\"{FFF000} házad le lett foglalva!\", AHouseData[HouseID][HouseName]);
         SendClientMessage(pid, 0xFFFFFFFF, Msg);
         // Also remove the HouseID from his list of houses
         for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
             // Check if the house is stored in this houseslot
             if (APlayerData[pid][Houses][HouseSlot] == HouseID)
                 // If the house is stored in this slot, clear the slot
                 APlayerData[pid][Houses][HouseSlot] = 0;
         // Save the player\'s account again
         PlayerFile_Save(pid);
         // Stop this For-loop, as the owner was already found and informed
         break;
      }
    }
}
// Check if the player was not online
if (PlayerOnline == false)
   // Remove the house from the player\'s account (open the account, remove the data and re-save it)
   PlayerFile_RemoveProperty(AHouseData[HouseID][Owner], HouseID, 0);
}
// First remove all vehicles from the house
House_RemoveVehicles(HouseID);
// Clear ownership of the house
AHouseData[HouseID][Owned] = false;
AHouseData[HouseID][Owner] = 0;
// Update the entrance of the house
House_UpdateEntrance(HouseID);
// Save the housefile
HouseFile_Save(HouseID);
}
// This function will delete the given business from the server and from the owner\'s account (if it has an owner)
Business_Delete(BusID)
{
// Setup local variables
new file[100], Msg[128], Name[24], bool:PlayerOnline = false;
// Check if the business is owned
if (ABusinessData[busID][Owned] == true)
{
// Loop through all players to find the owner (if he\'s online)
for (new pid; pid < MAX_PLAYERS; pid++)
{
   // Check if this player is online
    if (IsPlayerConnected(pid))
    {
        // Get that player\'s name
        GetPlayerName(pid, Name, sizeof(Name));
        // Compare if this player has the same name as the owner of the business
      if (strcmp(ABusinessData[busID][Owner], Name, false) == 0)
      {
          // Set PlayerOnline to \"true\"
          PlayerOnline = true;
         // Inform the player that his business is being deleted
         format(Msg, 128, \"{FFF000}A {FF0000}\\\"%s\\\"{FFF000} üzleted törölve lett!\", ABusinessData[busID][businessName]);
         SendClientMessage(pid, 0xFFFFFFFF, Msg);
         // Also remove the BusID from his list of businesses
         for (new BusSlot; BusSlot < MAX_BUSINESSPERPLAYER; BusSlot++)
             // Check if the business is stored in this business-slot
             if (APlayerData[pid][business][busSlot] == BusID)
                 // If the business is stored in this slot, clear the slot
                 APlayerData[pid][business][busSlot] = 0;
         // Save the player\'s account again
         PlayerFile_Save(pid);
         // Stop this For-loop, as the owner was already found and informed
         break;
      }
    }
}
// Check if the player was not online
if (PlayerOnline == false)
   // Remove the house from the player\'s account (open the account, remove the data and re-save it)
   PlayerFile_RemoveProperty(ABusinessData[busID][Owner], 0, BusID);
}
// Clear all data of the business
ABusinessData[busID][businessName] = 0;
ABusinessData[busID][businessX] = 0.0;
ABusinessData[busID][businessY] = 0.0;
ABusinessData[busID][businessZ] = 0.0;
ABusinessData[busID][businessType] = 0;
ABusinessData[busID][businessLevel] = 0;
ABusinessData[busID][LastTransaction] = 0;
ABusinessData[busID][Owned] = false;
ABusinessData[busID][Owner] = 0;
// Destroy the mapicon, 3DText and pickup for the business
DestroyDynamicPickup(ABusinessData[busID][PickupID]);
DestroyDynamicMapIcon(ABusinessData[busID][MapIconID]);
DestroyDynamic3DTextLabel(ABusinessData[busID][DoorText]);
ABusinessData[busID][PickupID] = 0;
ABusinessData[busID][MapIconID] = 0;
// Delete the business-file
format(file, sizeof(file), BusinessFile, BusID); // Construct the complete filename for this business-file
if (fexist(file)) // Make sure the file exists
fremove(file); // Delete the file
}
// This function will evict the given business from the server and from the owner\'s account (if it has an owner)
Business_Evict(BusID)
{
// Setup local variables
new Msg[128], Name[24], bool:PlayerOnline = false;
// Check if the business is owned
if (ABusinessData[busID][Owned] == true)
{
// Loop through all players to find the owner (if he\'s online)
for (new pid; pid < MAX_PLAYERS; pid++)
{
   // Check if this player is online
    if (IsPlayerConnected(pid))
    {
        // Get that player\'s name
        GetPlayerName(pid, Name, sizeof(Name));
        // Compare if this player has the same name as the owner of the business
      if (strcmp(ABusinessData[busID][Owner], Name, false) == 0)
      {
          // Set PlayerOnline to \"true\"
          PlayerOnline = true;
         // Inform the player that his business is being deleted
         format(Msg, 128, \"{FFF000}A {FF0000}\\\"%s\\\"{FFF000} üzleted le lett foglalva!\", ABusinessData[busID][businessName]);
         SendClientMessage(pid, 0xFFFFFFFF, Msg);
         // Also remove the BusID from his list of businesses
         for (new BusSlot; BusSlot < MAX_BUSINESSPERPLAYER; BusSlot++)
             // Check if the business is stored in this business-slot
             if (APlayerData[pid][business][busSlot] == BusID)
                 // If the business is stored in this slot, clear the slot
                 APlayerData[pid][business][busSlot] = 0;
         // Save the player\'s account again
         PlayerFile_Save(pid);
         // Stop this For-loop, as the owner was already found and informed
         break;
      }
    }
}
// Check if the player was not online
if (PlayerOnline == false)
   // Remove the house from the player\'s account (open the account, remove the data and re-save it)
   PlayerFile_RemoveProperty(ABusinessData[busID][Owner], 0, BusID);
}
// Clear ownership of the business
ABusinessData[busID][Owned] = false;
ABusinessData[busID][Owner] = 0;
// Update the entrance of the business
Business_UpdateEntrance(BusID);
// Save the businessfile
BusinessFile_Save(BusID);
}
 
// This function loads the playerfile for the given player, removes the lines that contain the HouseID or BusinessID and resaves the file
PlayerFile_RemoveProperty(Name[], HouseID, BusID)
{
// Setup local variables
new file[100], File:PFile, LineFromFile[100], Index, SearchString[100];
// Construct the complete filename for this player\'s account
format(file, sizeof(file), PlayerFile, Name);
// Check if the player\'s datafile exists
if (fexist(file))
{
// First clear the array before using it to make sure it\'s empty
for (Index = 0; Index < 100; Index++)
            FileContent[index][0] = 0;
// Open the playerfile for reading
PFile = fopen(file, io_read);
// Read up to 100 lines from the file (no player-account should have more than this)
for (Index = 0; Index < 100; Index++)
{
   // Read a line from the file
   fread(PFile, LineFromFile);
   // Strip any newline characters from the LineFromFile
   StripNewLine(LineFromFile);
   // Check if this line holds data
   if (strlen(LineFromFile) > 0)
      // Store this line into the array
      format(FileContent[index], 100, LineFromFile);
   else // If the read line doesn\'t contain any more data (empty string), the end of the file has been reached
       break;
}
        // Close the file
fclose(PFile);
 
// Now the file has been read and stored into the array, now scan the array to search for the matching HouseID and/or BusinessID
// Loop through the entire array
for (Index = 0; Index < 100; Index++)
{
   // Build the string to search for the HouseID
   format(SearchString, 100, \"House %i\", HouseID);
   // Check if this line holds the string we\'re looking for
   if (strcmp(FileContent[index], SearchString, false) == 0)
       // Clear the array-index
       FileContent[index][0] = 0;
   // Build the string to search for the BusinessID
   format(SearchString, 100, \"Business %i\", BusID);
   // Check if this line holds the string we\'re looking for
   if (strcmp(FileContent[index], SearchString, false) == 0)
       // Clear the array-index
       FileContent[index][0] = 0;
}
 
// Now all matching HouseID\'s and BusinessID\'s should be removed from the account, now re-save the playerfile
        // Open the playerfile for writing
PFile = fopen(file, io_write);
// Loop through the entire array
for (Index = 0; Index < 100; Index++)
{
   // Check if there is data in this array-slot
   if (FileContent[index][0] != 0)
   {
       // Construct the line for saving
      format(LineFromFile, 100, \"%s\\r\\n\", FileContent[index]);
        // And save it to the file
      fwrite(PFile, LineFromFile);
   }
}
        // Close the file
fclose(PFile);
}
}

Oldalak: [1]
SimplePortal 2.3.7 © 2008-2024, SimplePortal