1 terreno e criado 2 nгo
#1

Hello, I have been engaged in the beginning of a system, it basically consists of creating lands, so the error that is giving and the next it creates the first land and in the second already buga ...

Код:
#define MAX_TERRENOS 100

#define TXT_TerraForSale "{ffff00}Terreno a Venda\n{ffff00}Preзo: {00ff00}%d"

enum Terreno_Array
{
	Float:exterior_x,
	Float:exterior_y,
	Float:exterior_z,
	Float:exterior_a,
	Float:Interior_x,
	Float:Interior_y,
	Float:Interior_z,
	Float:Interior_a,
	PrecoTERRENO,
	ForSale,
	Pickup,
	Text3D:Label
};

new TerrenoInfo[MAX_TERRENOS][Terreno_Array];

CMD:ct(playerid, params[])
{
    new string[256], SaveString[256];
    if(IsPlayerAdmin(playerid))
    {
        new TerrenoID = RetornarProximoTerrenoID();
        
        format(SaveString,sizeof(SaveString),"/Terrenos/%d.dini.save",TerrenoID);

		if(!dini_Exists(SaveString))
        {
            new StringPrice;
            if(sscanf(params, "i",StringPrice))
            {
                SendClientMessage(playerid,-1,"Uso: /criar_terreno (preзo)");
            }
            else
            {
            
            new TerrenoDono[MAX_PLAYER_NAME];
            format(TerrenoDono, MAX_PLAYER_NAME, "Nгo");
            TerrenoInfo[TerrenoID][PrecoTERRENO] = StringPrice;
            GetPlayerPos(playerid, TerrenoInfo[TerrenoID][exterior_x], TerrenoInfo[TerrenoID][exterior_y], TerrenoInfo[TerrenoID][exterior_z]);
            GetPlayerFacingAngle(playerid, TerrenoInfo[TerrenoID][exterior_a]);
            TerrenoInfo[TerrenoID][ForSale] = 1;
            TerrenoInfo[TerrenoID][Interior_x] = 1643.6659;
            TerrenoInfo[TerrenoID][Interior_y] = -1517.0594;
            TerrenoInfo[TerrenoID][Interior_z] = 13.5688;
            TerrenoInfo[TerrenoID][Interior_a] = 0.0000;
            TerrenoInfo[TerrenoID][Pickup] = CreatePickup(1318, 1, TerrenoInfo[TerrenoID][exterior_x], TerrenoInfo[TerrenoID][exterior_y], TerrenoInfo[TerrenoID][exterior_z]);

            format(string,sizeof(string),TXT_TerraForSale, TerrenoInfo[TerrenoID][PrecoTERRENO]);

			TerrenoInfo[TerrenoID][Label] = Create3DTextLabel(string, -1, TerrenoInfo[TerrenoID][exterior_x], TerrenoInfo[TerrenoID][exterior_y], TerrenoInfo[TerrenoID][exterior_z]+0.8, 10.0, 0, 0);

            //Salvando a TERRENO
            dini_Create(SaveString);
            dini_Set(SaveString, "\nOwner", TerrenoDono);
            dini_FloatSet(SaveString,"Ext:X", TerrenoInfo[TerrenoID][exterior_x]);
            dini_FloatSet(SaveString,"Ext:Y", TerrenoInfo[TerrenoID][exterior_y]);
            dini_FloatSet(SaveString,"Ext:Z", TerrenoInfo[TerrenoID][exterior_z]);
            dini_FloatSet(SaveString,"Ext:A", TerrenoInfo[TerrenoID][exterior_a]);
            dini_FloatSet(SaveString,"Int:X", TerrenoInfo[TerrenoID][Interior_x]);
            dini_FloatSet(SaveString,"Int:Y", TerrenoInfo[TerrenoID][Interior_y]);
            dini_FloatSet(SaveString,"Int:Z", TerrenoInfo[TerrenoID][Interior_z]);
            dini_FloatSet(SaveString,"Int:A", TerrenoInfo[TerrenoID][Interior_a]);
            dini_IntSet(SaveString, "ForSale", TerrenoInfo[TerrenoID][ForSale]);
            dini_IntSet(SaveString, "Preco", TerrenoInfo[TerrenoID][PrecoTERRENO]);
						
            SendClientMessage(playerid,-1,"o terreno foi criada com sucesso");

            }
        }
    }
    return 1;
}

stock RetornarProximoTerrenoID()
{
    new Terras[80];
 	for(new t = 0; t <= MAX_TERRENOS; t++)
	{
		format(Terras, sizeof(Terras), "/Terrenos/%d.dini.save", t);
		if(!dini_Exists(Terras)) return t;
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)