Business Command help
#1

How can i make this Createbiz command where i can just create it by using The type And the interior is placed itself withot getting cordinates

CMD:
Код:
CMD:createbiz(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_GREY, "You aren't authorized to use this command!");//Checks if player is a RCON admin..Change this with your admin system.

    new price, level, id, int, world, string[128], Float:Xi, Float:Yi, Float:Zi, inti;//All the new defines we will need.
    if(sscanf(params, "dddfff", price, level, inti, Xi, Yi, Zi)) return SendClientMessage(playerid, COLOR_GREY, "CMD: /createbiz [price] [type] [interior] [X] [Y] [Z]");//d stands for integer, f stands for float.

    if(level < 0 || level > 4) return SendClientMessage(playerid, COLOR_GREY, "CMD: Type cannot go below 0, or above 10.");//

    if(price < 10000) return SendClientMessage(playerid, COLOR_GREY, "CMD: Price cannot go below $10,000.");// Check if the price is below 1000, if it is it will return a message saying it.

    for(new h = 1;h < sizeof(BusinessInfo);h++)//Loops through all the businesses
    {
        if(BusinessInfo[h][bPrice] == 0)//Checks if the price of a business is 0.
        {
            id = h;
            break;//It stops looping if it is.
        }
    }
    new Float:X,Float:Y,Float:Z,Float:A;//More new defines.
    GetPlayerPos(playerid, X, Y, Z);//Gets your player position, and saves it into floats.
    GetPlayerFacingAngle(playerid, A);//Gets your facing angle, and saves it into a float.
    int = GetPlayerInterior(playerid);//Gets your interior, and saves it into a integer.
    world = GetPlayerVirtualWorld(playerid);//Gets your Virtual World, and saves it into a integer
    BusinessInfo[id][bInsideInt] = inti;
    BusinessInfo[id][bExitX] = Xi;
    BusinessInfo[id][bExitY] = Yi;
    BusinessInfo[id][bExitZ] = Zi;

    BusinessInfo[id][bOwned] = 0;
    BusinessInfo[id][bPrice] = price;
    BusinessInfo[id][bType] = level;
    BusinessInfo[id][bEntranceX] = X;
    BusinessInfo[id][bEntranceY] = Y;
    BusinessInfo[id][bEntranceZ] = Z;
    BusinessInfo[id][bEntranceA] = A;
    BusinessInfo[id][bLocked] = 1;

    BusinessInfo[id][bInt] =int;
    BusinessInfo[id][bWorld] =world;
    BusinessInfo[id][bInsideWorld] =id;

    format(string, sizeof(string), "None");
    strmid(BusinessInfo[id][bName], string, 0, strlen(string), 255);

    if(BusinessInfo[id][bOutsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bOutsideIcon]);
    if(BusinessInfo[id][bInsideIcon]) DestroyDynamicPickup(BusinessInfo[id][bInsideIcon]);
    BusinessInfo[id][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ], BusinessInfo[id][bWorld]);//Creates a pickup at your location
    BusinessInfo[id][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[id][bExitX], BusinessInfo[id][bExitY], BusinessInfo[id][bExitZ], BusinessInfo[id][bInsideWorld]);//Creates a pickup at your location
    new file4[40];
    format(file4, sizeof(file4), BPATH, id);
    new INI:File = INI_Open(file4);
    INI_SetTag(File,"data");
    INI_WriteInt(File,"bOwned", BusinessInfo[id][bOwned]);
    INI_WriteInt(File,"bPrice", BusinessInfo[id][bPrice]);
    INI_WriteString(File,"bOwner", BusinessInfo[id][bOwner]);
    INI_WriteInt(File,"bType", BusinessInfo[id][bType]);
    INI_WriteInt(File,"bLocked", BusinessInfo[id][bLocked]);
    INI_WriteInt(File,"bMoney", BusinessInfo[id][bMoney]);
    INI_WriteFloat(File,"bEntranceX", BusinessInfo[id][bEntranceX]);
    INI_WriteFloat(File,"bEntranceY", BusinessInfo[id][bEntranceY]);
    INI_WriteFloat(File,"bEntranceZ", BusinessInfo[id][bEntranceZ]);
    INI_WriteFloat(File,"bEntranceA", BusinessInfo[id][bEntranceA]);
    INI_WriteFloat(File,"bExitX", BusinessInfo[id][bExitX]);
    INI_WriteFloat(File,"bExitY", BusinessInfo[id][bExitY]);
    INI_WriteFloat(File,"bExitZ", BusinessInfo[id][bExitZ]);
    INI_WriteFloat(File,"bExitA", BusinessInfo[id][bExitA]);
    INI_WriteInt(File,"bInt", BusinessInfo[id][bInt]);
    INI_WriteInt(File,"bWorld", BusinessInfo[id][bWorld]);
    INI_WriteInt(File,"bInsideInt", BusinessInfo[id][bInsideInt]);
    INI_WriteInt(File,"bInsideWorld", BusinessInfo[id][bInsideWorld]);
    INI_WriteString(File,"bName", BusinessInfo[id][bName]);
    INI_Close(File);
    return 1;
}
I also have the type code
Код:
stock BusinessType(b)// creates a stock.
{
    new string[30];
    switch(BusinessInfo[b][bType])//You should know what switch is.
    {
        case 4: string = "24/7";
        case 3: string = "Club";
        case 2: string = "Bar";
        case 1: string = "Clothes Shop";
    }
    return string;
}
Reply
#2

It makes no sense to me that you specify an ID you should have a loop to find an open slot to get the ID for the array.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)