SA-MP Forums Archive
Getting Enum coords - 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: Getting Enum coords (/showthread.php?tid=519668)



Getting Enum coords - SeniorGamer - 15.06.2014

Well basicaly I need of this to tell player message where the giftbox is

Example code:
pawn Код:
new Float:giftboxforplayers[][] =
{
    {-517.3328,1595.5092,-0.5358,19.8932}, //BoneCountry
    {-483.8486,2186.7073,40.0462,359.7931} //TheShermanDan
};
new Giftboxpick;

SetTimer("movegiftbox", 60000, true);

public movegiftbox()
{
    new Random = random(sizeof(Giftboxpick));
    DestroyPickup(Giftboxpick);
    Giftboxpick = CreatePickup(1210,19,Giftboxpick[Random][0], Giftboxpick[Random][1], Giftboxpick[Random][2],0);
}

How can I add so it tells player where did it move? Like if it moves to Sherman den, it will tell all players "The shipment moved to sherman den"


Re: Getting Enum coords - RenovanZ - 15.06.2014

Use a_zones.inc and use GetPlayer2DZone(...)


Re: Getting Enum coords - SeniorGamer - 15.06.2014

Yeah but isnt it possible some other way? Also how do I check where is it? I am doing this thing for firt time


Re: Getting Enum coords - Konstantinos - 15.06.2014

pawn Код:
enum E_giftboxforplayers
{
    gb_location[25],
    Float: gb_coords[4]
};

new giftboxforplayers[][E_giftboxforplayers] =
{
    {"Bone County", {-517.3328, 1595.5092, -0.5358, 19.8932}},
    {"Sherman Dam", {-483.8486, 2186.7073, 40.0462, 359.7931}}
};

public movegiftbox()
{
    DestroyPickup(Giftboxpick);
    new Random = random(sizeof(giftboxforplayers));
    Giftboxpick = CreatePickup(1210,19,giftboxforplayers[Random][gb_coords][0],giftboxforplayers[Random][gb_coords][1],giftboxforplayers[Random][gb_coords][2],0);
    // use "giftboxforplayers[Random][gb_location]" for the location's name
}



Re: Getting Enum coords - Laure - 15.06.2014

Use the given include and create zone defines like this
pawn Код:
static const Gift[][GIFT_ZONE] = {
    //  NAME                            AREA (Xmin,Ymin,Zmin,Xmax,Ymax,Zmax)
    {"The Big Ear",                 {-410.00,1403.30,-3.00,-137.90,1681.20,200.00}}
};
Create a enum for GIFT_ZONE, the GetPlayer2DZone.

EDIT: lil late.


Re: Getting Enum coords - RenovanZ - 15.06.2014

Try this:
pawn Код:
new Float:giftboxforplayers[][] =
{
    {-517.3328,1595.5092,-0.5358,19.8932, "Bone County"}, //BoneCountry
    {-483.8486,2186.7073,40.0462,359.7931, "Sherman Dam"} //TheShermanDan
};
new Giftboxpick;

SetTimer("movegiftbox", 60000, true);

public movegiftbox()
{
    new Random = random(sizeof(Giftboxpick));
    DestroyPickup(Giftboxpick);
    Giftboxpick = CreatePickup(1210,19,Giftboxpick[Random][0], Giftboxpick[Random][1], Giftboxpick[Random][2],0);
    new string[128];
    format(string, sizeof(string), "Gifts Box moves to %s.", Giftboxpick[Random][3]);
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        SendClientMessage(i, -1, string);
    }
}



Re: Getting Enum coords - SeniorGamer - 17.06.2014

Quote:
Originally Posted by RenovanZ
Посмотреть сообщение
Try this:
pawn Код:
new Float:giftboxforplayers[][] =
{
    {-517.3328,1595.5092,-0.5358,19.8932, "Bone County"}, //BoneCountry
    {-483.8486,2186.7073,40.0462,359.7931, "Sherman Dam"} //TheShermanDan
};
new Giftboxpick;

SetTimer("movegiftbox", 60000, true);

public movegiftbox()
{
    new Random = random(sizeof(Giftboxpick));
    DestroyPickup(Giftboxpick);
    Giftboxpick = CreatePickup(1210,19,Giftboxpick[Random][0], Giftboxpick[Random][1], Giftboxpick[Random][2],0);
    new string[128];
    format(string, sizeof(string), "Gifts Box moves to %s.", Giftboxpick[Random][3]);
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        SendClientMessage(i, -1, string);
    }
}
Does work,
Код:
warning 213: tag mismatch
At these lines
Код:
 {-517.3328,1595.5092,-0.5358,19.8932, "Bone County"}, //BoneCountry
    {-483.8486,2186.7073,40.0462,359.7931, "Sherman Dam"} //TheShermanDan



Re: Getting Enum coords - Konstantinos - 17.06.2014

It gives the warning because a string does not have the Float tag. Use an enum for that and in fact I had posted in this thread: http://forum.sa-mp.com/showpost.php?...21&postcount=4


Re: Getting Enum coords - SeniorGamer - 17.06.2014

Hmmm thanks


Re: Getting Enum coords - SeniorGamer - 17.06.2014

Hmmm
How do I actualy format it? :/