Problem with random spawns
#1

Okay so Im making a simple system that will print out where some package spawned.

What it should do? Well it should spawn it at random coords and SCM to all players and tell them where it is.

pawn Код:
new Float:RandomPackageSpawn[][] =
{
    {1517.7394,11.8652,24.1406, "Montgomery Hangar"},
    {2208.4785,-2295.6245,14.4917, "Los Santos Ocean Docks factory"},
    {2793.0776,-2417.6951,13.3594, "Los Santos military docks"}
};

public SpawnMaterialPackage()
{
    new string[128];
    new rand = random(sizeof(RandomPackageSpawn));
    CreatePickup(1242,1,RandomPackageSpawn[rand][0],RandomPackageSpawn[rand][1],RandomPackageSpawn[rand][2],0);
    format(string,sizeof(string),"Package spawned at %s",RandomPackageSpawn[rand][3]);
    SendClientMessageToAll(COLOR_NOTIFICATION,string);
    return true;
}
Problems?

Ive received 3 warnings
pawn Код:
warning 213: tag mismatch
These are the lines that are making a problem.
pawn Код:
{1517.7394,11.8652,24.1406, "Montgomery Hangar"},
    {2208.4785,-2295.6245,14.4917, "Los Santos Ocean Docks factory"},
    {2793.0776,-2417.6951,13.3594, "Los Santos military docks"}
Reply
#2

You're trying to store characters (string) in a float.
Use a float for coordinates, health/armour and such, and use another string for text.
Reply
#3

Yeah but how can I separate them now? I mean the thing is, It needs to display the area where it spawned thats why.
Reply
#4

-------
EDIT: I made a mistake, sorry.
Reply
#5

pawn Код:
enum package
{
    Float:pcX,
    Float:pcY,
    Float:pcZ,
    pcName[35]
};

new RandomPackageSpawn[][package] =
{
    {1517.7394,11.8652,24.1406, "Montgomery Hangar"},
    {2208.4785,-2295.6245,14.4917, "Los Santos Ocean Docks factory"},
    {2793.0776,-2417.6951,13.3594, "Los Santos military docks"}
};

public SpawnMaterialPackage()
{
    new string[128];
    new rand = random(sizeof(RandomPackageSpawn));
    CreatePickup(1242,1,RandomPackageSpawn[rand][pcX],RandomPackageSpawn[rand][pcY],RandomPackageSpawn[rand][pcZ],0);
    format(string,sizeof(string),"Package spawned at %s",RandomPackageSpawn[rand][pcName]);
    SendClientMessageToAll(COLOR_NOTIFICATION,string);
    return true;
}
Reply
#6

Thank you.
@Jeff that one worked! ++rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)