Fast question
#1

Hello guys.
How can i make my own public function?

Hope someone can help me. Thank you.
Reply
#2

Forward "name"(parameters)
Reply
#3

Quick example;
pawn Код:
forward Function();
public Function()
{
    // Do something
    return 1;
}

// Execute with;
Function();

// --- With parameter
forward ParFunction(playerid,Float:Health);
public ParFunction(playerid,Health)
{
    // For example, set players health
    SetPlayerHealth(playerid,Health);
    return 1;
}

// Execute with;
ParFunction(playerid,100); // Set the players health to 100
Reply
#4

Thank you. Still open for more explaination
Reply
#5

More explaination?
Perfect Example of Mike Garber... Read and Learn that.
Reply
#6

You can make any public function with forward.
like I have made a timer. That timer executes the public.
Timer: SetTimer("BALBALBAL",5000,false);

false means: repeating is negative.

In function BALBALBAL you can put things. Because the timer is overal and not for one player you could do:

forward BALBALBAL(); <---- dont forget the ;.
public BALBALBAL()
{
//stuf
return 1; <------always return 1; in the public
}
Reply
#7

Thank you very much everyone.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)