local or global variable in a timer/Using enum as integer
#1

Please, If you don't know what are you talking about don't reply, Or at-least try it before posting

First question, where does the local variables get saved and the global one, I already know the local get saved on the "heap/stack" which I think is the "memory" or "Ram", but what about the global ?

an example
pawn Code:
new Float:vehiclehealth;//this
forward VehicleTimer();
public VehicleTimer()
{
    new Float:vehiclehealth;//or this
    GetVehicleHealth(randomvehicleid, vehiclehealth);
}
from my perspective, the timer makes a new variable every second, and sets it to zero, then pass the health to it, so the global would be better, but I'm not sure

Second question: I've been trying to use an enum for sorting stuff, like dialog ids, without having to track them manually, but it gave me an error while using it inside another enum, like this
pawn Code:
enum
{
    BLABLA1 = 0,
    BLABLA2,
    MAX_BLABLAS
}
/*
#define BLABLA1         0
#define BLABLA2         1
#define MAX_BLABLAS     2
*/

enum blabla
{
    PlayerText:bbla[MAX_BLABLAS],
}

new Bla[MAX_PLAYERS][blabla];

public OnPlayerConnect(playerid)
{
    PlayerTextDrawShow(playerid, Bla[playerid][bbla][BLABLA1]);//warning 213: tag mismatch
    return 1;
}
When I use a define it works, but when I use an enum it doesn't, should this enum be like an integer, all it does is replacing "BLABLA1" to a number ?

thanks for your feedback
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)