SetTimerEx..."i"
#1

Hello.

I have been thinking this many times, and seeing both used alot:
SetTimerEx("mmm", 6000, false,"i", playerid);
SetTimerEx("mmm", 6000, false,"d", playerid);

I want to know, what are the difference between those two and what are they used for.
I hope that I dont get answers, where you have just copy pasted the lines from wiki: "(Inserts an integer.) & (Inserts an integer (whole) number).

I really need an better explanation, because I have no idea what those both mean right now, and I really want to know.
I hope that you read my message before sending links to WIKI!

Regards,
Assyria
Reply
#2

There is no difference.
Reply
#3

New guestion to make things clearer for me.

Sometimes I have seen used for timers that they return the public and sometimes not.
Why to use return, and sometimes not in that?
Example:
Код:
public Test(playerid)
{
  SendClientMessage(playerid,COLOR_RED,"test");
  return 1;
}
public Test2(playerid)
{
  SendClientMessage(playerid,COLOR_RED,"test2");
}
Reply
#4

This is the simplest way returning can be explained and people usually use returning this way.
A function, when It's called, always returns, lets say, a status code to the main program, so the main program knows what's currently going on.
pawn Код:
main()
{
    new number = GetRandomNumber();
    printf("Our random number is %d", number);
   
    if (IsSunOutside()) OR (IsSunOutside() == 1) OR (IsSunOutside() == true)
    {
        printf("It's also sunny");
    }
}

GetRandomNumber()
{
    new rand = random(5); //a random number from 0 to 4
    return rand; //returning the random number to the main program, so it can use it in the printf
}

IsSunOutside()
{
    if (time > 08:00 && time < 20:00) return 1; //returning either 1 or 0 to the main program, so it knows if its sunny or not
    else return 0;
}
Note that 'unconventional' functions also return values. For example, SetPlayerHealth return 1, if it successfully set the players health, else it returns 0.
pawn Код:
if (SetPlayerHealth(playerid, health))
{
  //player is connected and the health is set
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)