Making Checkpoint automatically
#5

PHP код:
COMMAND:createbiz(playeridparams[])
{
    
// If a player hasn't logged in properly, he cannot use this command
    
if (INT_IsPlayerLoggedIn(playerid) == 0) return 0;
    
// If the player has an insufficient admin-level (he needs level 5 or RCON admin), exit the command
    // returning "SERVER: Unknown command" to the player
    
if (INT_CheckPlayerAdminLevel(playerid5) == 0) return 0;
    
// Setup local variables
    
new HPriceMaxLevelbizID;
    
// Check if the player isn't inside a vehicle (the admin-player must be on foot to use this command)
    
if (GetPlayerVehicleSeat(playerid) == -1)
    {
        if (
sscanf(params"ii"HPriceMaxLevel)) SendClientMessage(playerid0xFFFFFFFF"{FF0000}Usage: \"/createbiz <price> <maxlevel (1-10)>\"");
        else
        {
            
// Check if the player entered a proper maxlevel
            
if ((MaxLevel >= 1) && (MaxLevel <= 10))
            {
                
// Find the first free bizID
                
for (bizID 1;bizID MAX_BIZESbizID++)
                    if (!
IsValidDynamicPickup(AbizData[bizID][PickupID])) // Check if an empty biz-index has been found (PickupID is 0)
                        
break; // Stop searching, the first free bizID has been found now
                // Check if the biz-limit hasn't been reached yet
                // This would seem to double-check the pickup-id, but in case there was no free bizslot found (bizID points
                // to the last index, the last index would hold a biz, so be sure to not overwrite it
                
if (!IsValidDynamicPickup(AbizData[bizID][PickupID]))
                {
                    
// Setup some local variables
                    
new Float:xFloat:yFloat:zMsg[128];
                    
// Get the player's position
                    
GetPlayerPos(playeridxyz);
                    
// Set some default data
                    
AbizData[bizID][Owned] = false;
                    
AbizData[bizID][Owner] = 0;
                    
AbizData[bizID][bizX] = x;
                    
AbizData[bizID][bizY] = y;
                    
AbizData[bizID][bizZ] = z;
                    
AbizData[bizID][bizLevel] = 1;
                    
AbizData[bizID][bizMaxLevel] = MaxLevel;
                    
AbizData[bizID][bizPrice] = HPrice;
                    
AbizData[bizID][bizOpened] = false;
                    
                    
                    
// Add the pickup and 3DText at the location of the biz-entrance (where the player is standing when he creates the biz)
                    
biz_UpdateEntrance(bizID);
                    
// Save the biz
                    
bizFile_Save(bizID);
                    
// Inform the player that he created a new biz
                    
format(Msg128"{00FF00}You've succesfully created a biz with ID: {FFFF00}%i"bizID);
                    
SendClientMessage(playerid0xFFFFFFFFMsg);
                }
                else
                    
SendClientMessage(playerid0xFFFFFFFF"{FF0000}The maximum amount of bizhas been reached");
            }
            else
                
SendClientMessage(playerid0xFFFFFFFF"{FF0000}You have to use a max-level from 1 to 10");
        }
    }
    else
        
SendClientMessage(playerid0xFFFFFFFF"{FF0000}You must be on foot to create a biz");
    
// Let the server know that this was a valid command
    
return 1;

Reply


Messages In This Thread
Making Checkpoint automatically - by Arxalan - 25.01.2015, 07:33
Re: Making Checkpoint automatically - by TFreemen - 25.01.2015, 07:45
Re: Making Checkpoint automatically - by Arxalan - 25.01.2015, 08:32
Re: Making Checkpoint automatically - by nezo2001 - 25.01.2015, 08:37
Re: Making Checkpoint automatically - by Arxalan - 25.01.2015, 09:02

Forum Jump:


Users browsing this thread: 1 Guest(s)