Fire Spawn System
#1

Hey guys i keep getting a waring on this system. It is made to spawn 1 of 3 fires from a list. I keep getting a warning code and it doesn't work any help?
Код:
C:\Users\HCC\Desktop\Linux-Server\gamemodes\vx-rp.pwn(17530) : warning 203: symbol is never used: "RandomFireSpawn"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
pawn Код:
new FireTimer[MAX_PLAYERS];
forward FireTimer(playerid)
public FireTimer()
{
    if(IsPlayerConnected(playerid))
    {
        CreateObject(18691, RandomFireSpawn[0], RandomFireSpawn[1], RandomFireSpawn[2],0, 0, 0, 0);
        SetPlayerMapIcon(playerid, 19, RandomFireSpawn[0],RandomFireSpawn[1],RandomFireSpawn[2], 55, COLOR_WHITE, 0);
            if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] != 3)
                {
                SendClientMessage(playerid, COLOR_GREEN, "Dispatch: A Fire Has Been Located Please Respond We Have Set A Icon.");
                }
    }
    return 1;
}

//Now, for the health.
new FireHPTimer[MAX_PLAYERS];
forward HealthFire(playerid)
public HealthFire(playerid);
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid,5.0,RandomFireSpawn[0],RandomFireSpawn[1],RandomFireSpawn[2]))
        {
            FireHPTimer[playerid] = SetTimerEx("FireHealthTime", 25000, false, "i", playerid);//Set for 25 seconds.
        }
    }
    return 1;
}
forward FireHealthTime(playerid)
public FireHealthTime(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:health;
        GetPlayerHealth(playerid, health);
        SetPlayerHealth(playerid, health-25.0);//In 25 seconds, if not treated he will loose 25 HP
    }
    return 1;
}
}
OnGameModeInit
pawn Код:
SetTimer("FireTimer", 10000, true);
New
pawn Код:
new RandomFireSpawn[0] = {

    {1190.1833 ,-1328.3470 ,13.5680},
    //{ X, Y, Z },
    //{ X, Y, Z },
    };//This is of the X, Y, Z of fire spawns.
Reply
#2

pawn Код:
new Float:RandomFireSpawn[][] =
{
{-1289.0140, 2467.1531, 87.3671, 24.7645},
{-1310.2850, 2513.6919, 87.0474, 134.5772},
{-1318.5570, 2524.3293, 87.4575, 332.7508},
{-1308.0326, 2549.6951, 90.3281, 145.3758}
};
Of course change the coordinates, I just used those as examples. Those will spawn you in the desert if you wish to know what they spawn you too.

Hope I helped, don't forget to rep me.
Reply
#3

Didn't Fix it :/
Reply
#4

Quote:
Originally Posted by Robert_Crawford
Посмотреть сообщение
Hey guys i keep getting a waring on this system. It is made to spawn 1 of 3 fires from a list. I keep getting a warning code and it doesn't work any help?
[code]
New
pawn Код:
new RandomFireSpawn[0] = {

    {1190.1833 ,-1328.3470 ,13.5680},
    //{ X, Y, Z },
    //{ X, Y, Z },
    };//This is of the X, Y, Z of fire spawns.
Try removing the comma(,) at the last X,Y,Z on the enum..
Reply
#5

No can do. That returns errors.
Reply
#6

Код:
new Float: RandomFireSpawn[][] = {
    {1190.1833 ,-1328.3470 ,13.5680}
    //{ X, Y, Z },
    //{ X, Y, Z },
};
That should be fine.

Edit: But you have to replace RandomFireSpawn[] ect with RandomFireSpawn[0][0], RandomFireSpawn[0][1] ect.
Reply
#7

As you can see i redid the code i am still returning that warning and the code does not function.
pawn Код:
//----------------------
new Float:RandomFireSpawn[4][3] =
{
    {-1289.0140, 2467.1531, 87.3671, 24.7645},
    {-1310.2850, 2513.6919, 87.0474, 134.5772},
    {-1318.5570, 2524.3293, 87.4575, 332.7508},
    {-1308.0326, 2549.6951, 90.3281, 145.3758}
};

//-------------------- This Is Used To Show The Time Is Set Under Game Modeinit
public OnGameModeInit() {
    SetTimer("RandomFireSpawn", 100000, true);
}
return 1;
}
//---------------------
public FireTimer()
{
    if(IsPlayerConnected(playerid))
    {
        RandomFireSpawn(playerid);
        KillTimer(TimerName);
    }
    return 1;
}

public RandomFireSpawn(playerid)
        {
        new rand= random(sizeof(RandomFireSpawn));
        CreateObject(1234, RandomFireSpawn[0], RandomFireSpawn[1], RandomFireSpawn[2],0, 0, 0, 0);
        SetPlayerMapIcon(playerid, 18, RandomFireSpawn[1],RandomFireSpawn[1],RandomFireSpawn[1], 55, COLOR_WHITE, 0);
            if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] != 3)
                {
                SendClientMessage(playerid, COLOR_GREEN, "Dispatch: A Fire Has Been Located Please Respond We Have Set A Icon.");
                }
        }
        return 1;
}
//Now, for the health.
new FireHPTimer[MAX_PLAYERS];
forward HealthFire(playerid)
public HealthFire(playerid);
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid,5.0,RandomFireSpawn[0],RandomFireSpawn[1],RandomFireSpawn[2]))
        {
            FireHPTimer[playerid] = SetTimerEx("FireHealthTime", 25000, false, "i", playerid);//Set for 25 seconds.
        }
    }
    return 1;
}
forward FireHealthTime(playerid)
public FireHealthTime(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:health;
        GetPlayerHealth(playerid, health);
        SetPlayerHealth(playerid, health-25.0);//In 25 seconds, if not treated he will loose 25 HP
    }
    return 1;
}
Reply
#8

24 Hours Bump
Reply
#9

It gives you a Warning because you need to use RandomFireSpawn.

It's not really a problem, it's just distracting you from the script.

If you use RandomFireSpawn as

Quote:

rand = random(sizeof(RandomFireSpawn));
CreateObject(objectid, RandomFireSpawn[rand][0], RandomFireSpawn[rand][1], RandomFireSpawn[rand][2], 0.0,0.0, 0.0);

Then it will work.
Reply
#10

Also:
Код:
new Float:RandomFireSpawn[4][3]
You don't need to give numbers, if you let them empty, Pawn will count the size of the array himself. This works fine:
Код:
new Float:RandomFireSpawn[][]
I guess you do some searching on how arrays work, because it looks like you don't understand them properly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)