Posts: 698
Threads: 107
Joined: Mar 2010
Reputation:
0
Hello guys.
How can i make my own public function?
Hope someone can help me. Thank you.
Max_Coldheart
Unregistered
Forward "name"(parameters)
Posts: 1,506
Threads: 69
Joined: Feb 2008
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
Posts: 85
Threads: 14
Joined: Oct 2010
Reputation:
0
More explaination?
Perfect Example of Mike Garber... Read and Learn that.
Posts: 918
Threads: 125
Joined: Nov 2010
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
}
Posts: 698
Threads: 107
Joined: Mar 2010
Reputation:
0
Thank you very much everyone.