SA-MP Forums Archive
x,y,z - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: x,y,z (/showthread.php?tid=381396)



x,y,z - SumX - 29.09.2012

Hello! What's wrong here? I insert the right interior,the right x,y,z ,but it is not saving correctly.

Код:
CMD:createbiz(playerid, params[])
{
    if ( GetPVarInt( playerid, "AdminLevel" ) < 3)
	    return SendClientMessage( playerid, -1, "You are not allowed to use this command!");

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

    if(price < 10000) return SendClientMessage(playerid, COLOR_DGREY, "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.
    inte = 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][bInt] = inte;
    BusinessInfo[id][bExitX] = Xi;
    BusinessInfo[id][bExitY] = Yi;
    BusinessInfo[id][bExitZ] = Zi;

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

    BusinessInfo[id][bInsideInt] = inti;
    BusinessInfo[id][bWorld] = world;
    BusinessInfo[id][bInsideWorld] = id;
    
    BusinessInfo[id][bFee] = 5000;

    format(string, sizeof(string), "%s",bizname);
    strmid(BusinessInfo[id][bName], string, 0, strlen(string), 255);
    
    strmid(BusinessInfo[id][bOwner], "For Sale", 0, strlen("For Sale"), 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, Xi, Yi, Zi, BusinessInfo[id][bInsideWorld]);//Creates a pickup at your location
    BusinessInfo[id][bMapIcon] = CreateDynamicMapIcon(BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ], 36, -1, world, inte, -1, 50.0);
	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", "ForSale");
    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", Xi);
    INI_WriteFloat(File,"bExitY", Yi);
    INI_WriteFloat(File,"bExitZ", Zi);
    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_WriteInt(File,"bMapIcon", BusinessInfo[id][bMapIcon]);
    INI_WriteInt(File,"bFee", BusinessInfo[id][bFee]);
    INI_WriteString(File,"bName", BusinessInfo[id][bName]);
    INI_Close(File);
    new businesslabeltext[250];
	format(businesslabeltext, sizeof(businesslabeltext),"Name: {F6F6F6}%s\n{00BC00}This business is {F6F6F6}for sale!\n{00BC00}Price: {F6F6F6}%i\n{00BC00}BizID: {F6F6F6}%i ", BusinessInfo[id][bName], BusinessInfo[id][bPrice], id);
	BusinessLabel[id] = CreateDynamic3DTextLabel(businesslabeltext, COLOUR_GREEN, BusinessInfo[id][bEntranceX], BusinessInfo[id][bEntranceY], BusinessInfo[id][bEntranceZ] + 0.8, TEXTLABEL_DISTANCE, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, TEXTLABEL_TESTLOS, -1, 0, -1, TEXTLABEL_DISTANCE);
    return 1;
}
Код:
[data]
bOwned = 0
bPrice = 100000
bOwner = ForSale
bType = 0
bLocked = 1
bMoney = 0
bEntranceX = 2021.671997
bEntranceY = 1016.466735
bEntranceZ = 10.820312
bEntranceA = 16.270095
bExitX = 0.000000
bExitY = 0.000000
bExitZ = 0.000000
bExitA = 0.000000
bInt = 0
bWorld = 0
bInsideInt = 68
bInsideWorld = 2
bMapIcon = 544
bFee = 5000
bName = 4DragonsCasino



Re: x,y,z - xMCx - 29.09.2012

pawn Код:
INI_WriteFloat(File,"bExitX", Xi);
INI_WriteFloat(File,"bExitY", Yi);
INI_WriteFloat(File,"bExitZ", Zi);
change this to
pawn Код:
INI_WriteFloat(File,"bExitX", Xi,BusinessInfo[id][bExitX]);
INI_WriteFloat(File,"bExitY", Yi,BusinessInfo[id][bExitY]);
INI_WriteFloat(File,"bExitZ", Zi,BusinessInfo[id][bExitZ]);
im not sure , try it


Re: x,y,z - SumX - 29.09.2012

check INI_WriteFloat params!
anyone?