Single-Player Info Boxes -
Kevln - 29.10.2015
Single-Player Info Boxes
Description
Single-player info boxes brings the informational boxes from single-player to San Andreas Multiplayer with the ability to change the box' color, text to display and time to be shown (until the box disappears).
Functions
- ShowInfoBox(playerid, box_color, shown_for, text[]);
playerid - The player to display the textdraw for.
box_color - The color of the box.
shown_for - The time that the info box will be shown for (in seconds).
text[] - Text to display within the box.
Screenshots
Download
https://github.com/KevinMarapao/Sing...yer-Info-Boxes
Re: Single-Player Info Boxes -
N0FeaR - 29.10.2015
Awesome work i love it!
Re: Single-Player Info Boxes -
DemME - 29.10.2015
Awesome man! I've been looking for this quite a while!
Re: Single-Player Info Boxes -
Alex Magaсa - 29.10.2015
This is simple but good job!
Re: Single-Player Info Boxes -
N0FeaR - 29.10.2015
Mabye u can help me i using this, trying to get the box black but this not work ----> 0x00000000
PHP код:
ShowInfoBox(playerid, 0x00000000, 5, "~r~Server Rules: ~w~You can find the Rules list on Forum.rebound-rp.com > Server Information > Server Rules.!");
Re: Single-Player Info Boxes -
DemME - 29.10.2015
How to do the black box to be on low opacity?
Re: Single-Player Info Boxes -
Gammix - 29.10.2015
0x
RRGGBBAA
AA is your opacity.
@N0FeaR: You are setting the opacity to 00, so it wont be visible. Try 0x000000FF.
@kevIn: You do kill the timer but where do you check if its existing or not.
Refrence:
http://forum.sa-mp.com/showpost.php?...4&postcount=11
Re: Single-Player Info Boxes -
DemME - 29.10.2015
Quote:
Originally Posted by Gammix
0xRRGGBBAA
AA is your opacity.
@N0FeaR: You are setting the opacity to 00, so it wont be visible. Try 0x000000FF.
|
Getting error after comiling the pawno when I try to test it -
error 025: function heading differs from prototype
under OnPlayerConnect
Re: Single-Player Info Boxes -
Gammix - 29.10.2015
Quote:
Originally Posted by DemME
Getting error after comiling the pawno when I try to test it -
error 025: function heading differs from prototype
under OnPlayerConnect
|
Did you put RR/GG/BB while adding color? RR, GG, BB are just to give an example/sense to my statement. These are actually integer / hex values.
For example:
Here RR = FF(opaque), GG = 0, BB =0, AA = FF(opaque). This is a red color with 255 opacity.
Re: Single-Player Info Boxes -
DemME - 29.10.2015
Quote:
Originally Posted by Gammix
Did you put RR/GG/BB while adding color? RR, GG, BB are just to give an example. These are actually integer / hex values.
For example:
Here RR = FF(opaque), GG = 0, BB =0, AA = FF(opaque). This is a red color with 255 opacity.
|
the color is fine I assume, I've tried to contact it with format, which means I wanna put it in the house system. -
PHP код:
format(string, sizeof(string), "Owned house\nAddress: %s", HouseData[houseid][houseAddress]);
ShowInfoBox(houseid, 0xFF0000FF, 10, string);
Tried to do some kind of it, but it's not working. and it gives me the error that I gave above
Edit: Doesn't matter where I try to put it, or just use a cmd with a random text, it still gives me that error..
Re: Single-Player Info Boxes -
N0FeaR - 29.10.2015
Quote:
Originally Posted by Gammix
|
Works, thanks!
Re: Single-Player Info Boxes -
Kevln - 29.10.2015
Quote:
Originally Posted by Gammix
|
Quote:
Originally Posted by Wiki
Timer IDs are never used twice. You can use KillTimer() on a timer ID and it won't matter if it's running or not.
|
There is no need to add an extra unnecessary condition. That "KillTimer()" is only there to kill the current running timer (if the public function that hides the textdraw hasn't been called yet and a new "ShowInfo()" function has been executed) so that the textdraw won't be hidden earlier than it is suppose to be shown for.
@DemME:
pawn Код:
format(string, sizeof(string), "Owned house\nAddress: %s", HouseData[houseid][houseAddress]);
ShowInfoBox(playerid, 0xFF0000FF, 10, string);
Re: Single-Player Info Boxes -
Gammix - 29.10.2015
Quote:
You can use KillTimer() on a timer ID and it won't matter if it's running or not.
|
Completely clarify your mistake.
If you create 2 variables for timers:
Now you set variable "timer1" on a timer, but don't for the second.
Now you try to kill "timer2" even if you haven't set it (according to you it doesn't matter)
Your timer1 will be killed in this case, because both have "0" as their default value, and timer1 is set to 0 as well as a first index for a timer. Same is happening in your script.
Re: Single-Player Info Boxes -
ATGOggy - 29.10.2015
Nice job, man. Simple, but awesome.
Re: Single-Player Info Boxes -
Kevln - 29.10.2015
Quote:
Originally Posted by Gammix
Completely clarify your mistake.
If you create 2 variables for timers:
Now you set variable "timer1" on a timer, but don't for the second.
Now you try to kill "timer2" even if you haven't set it (according to you it doesn't matter)
Your timer1 will be killed in this case, because both have "0" as their default value, and timer1 is set to 0 as well as a first index for a timer. Same is happening in your script.
|
Timer IDs start at 1 and despite the fact that timer IDs are never used again, there is absolutely no need to initialize a variable beforehand to validate whether a timer is running or not.
Your message is logical, but it's just another wrong theory (timer IDs start at 1, the wiki is wrong as far as I am aware of).
Re: Single-Player Info Boxes -
DemME - 29.10.2015
The include everytime keeps to give me an error under "OnPlayerConnect"
Quote:
error 025: function heading differs from prototype
|
Everytime I try to include the inc, it gives me that error ^
Anyway, maybe thats something inside the include itself.
Re: Single-Player Info Boxes -
Kevln - 29.10.2015
Quote:
Originally Posted by DemME
The include everytime keeps to give me an error under "OnPlayerConnect"
Everytime I try to include the inc, it gives me that error ^
Anyway, maybe thats something inside the include itself.
|
The hooking method has been updated (addressing that problem and another one as well), please re-download the include. I'm sorry for any inconveniences, and thanks guys!
Re: Single-Player Info Boxes -
Gammix - 30.10.2015
Lets say we use you function
Now the timer id stored is 1. Just after the timer ends, we execute a custom timer:
pawn Код:
SetTimer("very_important_timer", ...);
Its id is 1 as well, but just after execution, we use your function again (note the custom timer is still alive):
Your include kills "very_important_timer" timer, because as i previously mentioned, you don't have a check, or you don't reset the variable to "0" when the timers are no more running.
Re: Single-Player Info Boxes -
Kevln - 30.10.2015
Quote:
Originally Posted by Gammix
Lets say we use you function
Now the timer id stored is 1. Just after the timer ends, we execute a custom timer:
pawn Код:
SetTimer("very_important_timer", ...);
Its id is 1 as well, but just after execution, we use your function again (note the custom timer is still alive):
Your include kills "very_important_timer" timer, because as i previously mentioned, you don't have a check, or you don't reset the variable to "0" when the timers are no more running.
|
Timer. IDs. Are. Never. Used. Twice.
We execute a timer, its ID will be 1. We execute another timer, its ID will be 2. We execute another timer, its ID will be 3. We execute another timer, its ID will be 4. We execute another timer, its ID will be 5. We execute another timer, its ID will be 6. We execute another timer, its ID will be 7. We execute another timer, its ID will be 8. We execute another timer, its ID will be 9. We execute another timer, its ID will be 10. Etc, etc, etc.
Re: Single-Player Info Boxes -
Gammix - 30.10.2015
Quote:
Now the timer id stored is 1. Just after the timer ends, we execute a custom timer:
|
"Just after the timer ends", meaningful ?