[Ajuda] Comando /deletarempresa
#1

pawn Код:
COMMAND:deletarempresa(playerid, params[])
{
    // Setup local variables
    new file[100], Msg[128];

    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/deletarempresa", params);

    // 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)
        {
            // Make sure the player isn't inside a vehicle
            if (GetPlayerVehicleID(playerid) == 0)
            {
                // Loop through all player-owned businesses
                for (new BusID = 1; BusID < MAX_BUSINESS; BusID++)
                {
                    // Check if the business exists
                    if (ABusinessData[BusID][PickupID] != 0)
                    {
                        // Check if the business has no owner
                        if (ABusinessData[BusID][Owned] == false)
                        {
                            // Check if the player is in range of the business-pickup
                            if (IsPlayerInRangeOfPoint(playerid, 2.5, ABusinessData[BusID][BusinessX], ABusinessData[BusID][BusinessY], ABusinessData[BusID][BusinessZ]))
                            {
                                // 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 house
                                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

                                // Also let the player know he deleted the business
                                format(Msg, 128, "{00FF00}[MDC] Vocк deletou a empresa ID: {FFFF00}%i", BusID);
                                SendClientMessage(playerid, 0xFFFFFFFF, Msg);

                                // Exit the function
                                return 1;
                            }
                        }
                    }
                }

                // There was no house in range, so let the player know about it
                SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[MDC] Esteja na porta da empresa que deseja deletar.");
            }
            else
                SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[MDC] Vocк nгo pode deletar uma empresa de dentro de um veнculo.");
        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}]
Nгo ta deletando..
Reply
#2

O arquivo?



BusinessFile

Cadк o

format(BusinessFile

?


Talvez seja

BusinessData[BusID][BusinessFile] ali no format(file e nгo BusinessFile
Reply
#3

Quote:
Originally Posted by ipsBruno
Посмотреть сообщение
O arquivo?



BusinessFile

Cadк o

format(BusinessFile

?


Talvez seja

BusinessData[BusID][BusinessFile] ali no format(file e nгo BusinessFile
Eu nao sei por isso. aonde poe ?
Reply
#4

Ver se esse funciona:
PHP код:
COMMAND:delempresa(playeridparams[])
{
    
// Setup local variables
    
new file[100], Msg[128];
    
// 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] >= 4)
        {
            
// Make sure the player isn't inside a vehicle
            
if (GetPlayerVehicleID(playerid) == 0)
            {
                
// Loop through all player-owned businesses
                
for (new BusID 1BusID MAX_BUSINESSBusID++)
                {
                    
// Check if the business exists
                    
if (ABusinessData[BusID][PickupID] != 0)
                    {
                        
// Check if the business has no owner
                        
if (ABusinessData[BusID][Owned] == false)
                        {
                            
// Check if the player is in range of the business-pickup
                            
if (IsPlayerInRangeOfPoint(playerid2.5ABusinessData[BusID][BusinessX], ABusinessData[BusID][BusinessY], ABusinessData[BusID][BusinessZ]))
                            {
                                
// 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 house
                                
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(filesizeof(file), BusinessFileBusID); // Construct the complete filename for this business-file
                                
if (fexist(file)) // Make sure the file exists
                                    
fremove(file); // Delete the file
                                // Also let the player know he deleted the business
                                
format(Msg128"{00FF00}Vocк deletou a empresa ID: {FFFF00}%i"BusID);
                                
SendClientMessage(playerid0xFFFFFFFFMsg);
                                
// Exit the function
                                
return 1;
                            }
                        }
                    }
                }
                
// There was no house in range, so let the player know about it
                
SendClientMessage(playerid0xFFFFFFFF"{FF0000}Esteja na porta da empresa que deseja deletar.");
            }
            else
                
SendClientMessage(playerid0xFFFFFFFF"{FF0000}Vocк nгo pode deletar uma empresa de dentro de um veнculo.");
        }
        else
            return 
0;
    }
    else
        return 
0;
    
// Let the server know that this was a valid command
    
return 1;




Ajudei? +REP, Ajuda eu tambйm ^.^'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)