native Button:CreateButtonForPlayer(playerid, text[], Float:x, Float:y, Float:width = 72.0, Float:height = 23.0);
native ShowButtonForPlayer(playerid, Button:btnid);
native DestroyButton(Button:btnid);
native DestroyButtonForPlayer(playerid, Button:btnid);
native HideButtonForPlayer(playerid, Button:btnid);
native SetButtonTextForPlayer(playerid, Button:btnid, text[]);
native ChangeButtonColorsForPlayer(playerid, Button:btnid, strokeCol, buttonCol, textCol);
native IsValidButton(Button:btnid)l
native UpdateButtonForPlayer(playerid, Button:btnid);
forward OnPlayerClickButton(playerid, Button:btnid);
//============================ Added in v1.1 ================================//
native GetButtonPos(Button:btnid, &Float:x, &Float:y);
native GetButtonSize(Button:btnid, &Float:width, &Float:height);
native GetButtonColors(Button:btnid, &strokeCol, &buttonCol, &textCol);
native GetButtonText(Button:btnid);
stock Button:CreateButtonForPlayer(playerid, text[200], Float:x, Float:y, Float:width = 72.0, Float:height = 23.0)
{
/*
Will create a button for the specified player will the specified params and the default colors (black, red, white... you can change them later).
playerid -> The player to create the button for.
text[] -> The string with the text of the button.
Float:x -> The x coordinate of the button.
Float:y -> The y coordinate of the button.
Float:width -> The width of the button.
Float:height -> The height of the button.
Returns the ID of the button created with the "Button:" prefix.
*/
}
stock ShowButtonForPlayer(playerid, Button:btnid)
{
/*
Will show the specified button for the specified.
playerid -> The player to show the button to.
Button:btnid -> The button to show to the player.
Returns 1 on success and 0 on failure.
*/
}
stock DestroyButton(Button:btnid)
{
/*
Will destroy the specified button for everyone.
Button:btnid -> The button to destroy.
Returns 1 on success and 0 on failure.
*/
}
stock DestroyButtonForPlayer(playerid, Button:btnid)
{
/*
Will destroy the specified button for the specified player.
playerid -> The player to destroy the button for.
Button:btnid -> The button to destroy.
Returns 1 on success and 0 on failure.
*/
}
stock HideButtonForPlayer(playerid, Button:btnid)
{
/*
Will hide the specified button for the specified player.
playerid -> The player to hide the button for.
Button:btnid -> The button to hide.
Returns 1 on success and 0 on failure.
*/
}
stock SetButtonTextForPlayer(playerid, Button:btnid, text[])
{
/*
Will change the specified button's text for the specified player.
playerid -> The player of whose button's text you want to change.
Button:btnid -> The button whose text you want to change.
text[] -> the string that contais the new text of the button.
Returns 1 on success and 0 on failure.
*/
}
stock ChangeButtonColorsForPlayer(playerid, Button:btnid, strokeCol, buttonCol, textCol)
{
/*
Will change the specified button's color for the specified player (Supports transparency too).
playerid -> The player whose button's color you want to change.
Button:btnid -> The button whose colors you want to change.
strokeCol -> The color of the line around the BUTTON (Black by default).
buttonCol -> The color of the inner part of the button (Red by default).
textCol -> The color of the text's button (White by default).
Returns 1 on success and 0 on failure.
*/
}
stock IsValidButton(Button:btnid)
{
/*
Checks if the specified button is created or not.
Button:btnid -> The button to check for.
Returns true if is valid and false if it's not.
*/
}
stock UpdateButtonForPlayer(playerid, Button:btnid)
{
/*
Update the specified button with the changes made (must be used after each colors change that has been made).
playerid -> The player to update the button for.
Button:btnid -> The button to change the colors to.
Returns 1 on success and 0 on failure.
*/
}
public OnPlayerClickButton(playerid, Button:btnid)
{
/*
Will be called everytime a player click on a button (Created with CreateButtonForPlayer).
playerid -> The player that has clicked on the button.
Button:btnid -> the button that has been clicked.
*/
}
//============================ Added in v1.1 ================================//
stock GetButtonPos(Button:btnid, &Float:x, &Float:y)
{
/*
Gets the position of the specified button.
Button:btnid -> The id of the button to get the position of.
&Float:x -> The Float variable to store the X position of the button.
&Float:y -> The Float variable to store the Y position of the button.
Returns 1 on success and 0 on failure.
*/
}
stock GetButtonSize(Button:btnid, &Float:width, &Float:height)
{
/*
Gets the position of the specified button.
Button:btnid -> The id of the button to get the position of.
&Float:width -> The Float variable to store the width of the button.
&Float:height -> The Float variable to store the height of the button.
Returns 1 on success and 0 on failure.
*/
}
stock GetButtonColors(Button:btnid, &strokeCol, &buttonCol, &textCol)
{
/*
Gets the position of the specified button.
Button:btnid -> The id of the button to get the position of.
&strokeCol -> The variable to store the button's stroke color.
&buttonCol -> The variable to store the button's inner color.
&textCol -> The variable to store the button's text color.
Returns 1 on success and 0 on failure.
*/
}
stock GetButtonText(Button:btnid)
{
/*
Gets the position of the specified button.
Button:btnid -> The id of the button to get the position of.
Returns The text String of the Button on Success and 0 on Failure.
*/
}
#include <buttons>
public OnPlayerClickButton(playerid, Button:i)
{
return 1;
}
V1.0: Initial Release V1.1: -Added GetButtonpos Function -Added GetButtonSize Function -Added GetButtonColors Function -Added GetButtonText Function -Hooked OnPlayerClickTextdraw so you don't need to add anything else on your code beside OnPlayerClickButton -Makes usage of Global Textdraws instead of Player TDs (to avoid bugs with the Hooked function) -Small bug fixes with DestroyButton and DestroyButtonForPlayer
Hook the callback instead of telling people to put it on the callback.
|
(I tried using y_hooks but it didn't work) |
warning 200: symbol "_ALS_OnPlayerClickPlayerTextDra" is truncated to 31 characters
/*
+++++++++++++++++++++++ | Cahgnge Log | +++++++++++++++++++++++
+ +
+ *V1.0 Initial Release +
+ =========================================================== +
+ *V1.1 Added GetButtonpos +
+ *V1.1 Added GetButtonSize +
+ *V1.1 Added GetButtonColors +
+ *V1.1 Added GetButtonText +
+ *V1.1 Hooked OnPlayerClickTextdraw +
+ (You will no longer need to add anything on your script) +
+ *V1.1 Makes usage of Global Textdraws instead of Player TDs +
+ *V1.1 Small bug fixes +
+ =========================================================== +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
I knew someone would have make such an include, it's so obvious. Which is, very useful! Good job, SpiritEvil.
|
Are the Button Clickable Btw its a Awesome Include i Will surely Use it If the Button's Are Clickable
|
Originally Posted by MP2
Dialog is a bit pointless, surely 'don't save' and 'cancel' have the same result? Bad example.
Nice FS though, well done. |
Originally Posted by justsomeguy
Wow, I thought it would be like Sothclaws one! I was wrong, nice made anyway!
|
Originally Posted by costel_nistor96
Looks nice, sir. ;P
|
Originally Posted by Juninho_Oakley
Good Job.
|