F5 and clickable TDs -
SDraw - 09.03.2013
So there is a simple bug.
If you move your mouse to clickable TD and then hold F5, TD will be selected anyway wherever your mouse is and you can click on it even it was hidden by code.
I found out it and, hopefully, made some checks to prevent this.
For all, who has clickable TDs in gamemode, write some checks or server will do unexpected things (or crash).
Re: F5 and clickable TDs -
MP2 - 09.03.2013
I can't reproduce this, as I'm not exactly sure what you mean. Can you give step-by-step instructions?
Re: F5 and clickable TDs -
SDraw - 09.03.2013
Quote:
Originally Posted by MP2
I can't reproduce this, as I'm not exactly sure what you mean. Can you give step-by-step instructions?
|
Ok.
1. Create code with clickable TD and send client message when player clicks on it and then hide this TD (but don't cancel TD selection).
2. Move mouse pointer to clickable TD.
3. Hold F5.
4. Click LMB. TD will disappear.
5. Click LMB again. You will see client message that shouldn't be sent.
6. Optional: move mouse to another position (but hold F5 still), click LMB, and you will see client message again.
Re: F5 and clickable TDs -
Vince - 09.03.2013
Does F5 have a special function that I'm not aware of? I don't think many players are running around holding F5 all the time ...
Re: F5 and clickable TDs -
Pottus - 09.03.2013
It appears to lock the currently selected TD then you can move the mouse anywhere and click to activate the TD it doesn't seem to really be much of an issue though.
Re: F5 and clickable TDs -
SDraw - 10.03.2013
Quote:
Originally Posted by [uL]Pottus
It appears to lock the currently selected TD then you can move the mouse anywhere and click to activate the TD it doesn't seem to really be much of an issue though.
|
And if you hide this TD by code it still can be selected but this shouldn't be.
Re: F5 and clickable TDs -
Tamer - 10.03.2013
You can simply fix this by setting textdrawcontrollable or whatever it was to 0 on player update,it would use onplayerupdate and maybe it can use abit cpu.
Edit:
this function
https://sampwiki.blast.hk/wiki/TextDrawSetSelectable
Re: F5 and clickable TDs -
SDraw - 10.03.2013
Quote:
Originally Posted by Tamer T
|
UPD: That won't help. Still can be selected.
Re: F5 and clickable TDs -
SDraw - 10.03.2013
So, I don't see any person who tried to check this bug...
Ok, I made a video. Maybe now you will believe...
[ame]http://www.youtube.com/watch?v=cc_YLf8pFQc[/ame]
Script code:
PHP код:
#define FILTERSCRIPT
#include <a_samp>
new Text:Textdraw0;
public OnFilterScriptInit()
{
Textdraw0 = TextDrawCreate(313.000000, 166.250015, "Clickable TD");
TextDrawLetterSize(Textdraw0, 1.031500, 3.618333);
TextDrawTextSize(Textdraw0, 30.500000, 298.083007);
TextDrawAlignment(Textdraw0, 2);
TextDrawColor(Textdraw0, -1);
TextDrawUseBox(Textdraw0, true);
TextDrawBoxColor(Textdraw0, 0);
TextDrawSetShadow(Textdraw0, 0);
TextDrawSetOutline(Textdraw0, 1);
TextDrawBackgroundColor(Textdraw0, 51);
TextDrawFont(Textdraw0, 2);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetSelectable(Textdraw0, true);
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(!strcmp(cmdtext,"/choose",true))
{
TextDrawShowForPlayer(playerid,Textdraw0);
SelectTextDraw(playerid,0x73B1EDFF);
return 1;
}
return 0;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(clickedid == Textdraw0)
{
TextDrawHideForPlayer(playerid,Textdraw0);
SendClientMessage(playerid,-1,"Textdraw0 was selected and hidden.");
return 1;
}
return 1;
}
And how you can see, client sends data about TD clicking when it's hidden...
Re: F5 and clickable TDs -
SDraw - 26.03.2013
Well, I broke some servers with that bug...Anyone?
Re: F5 and clickable TDs -
Basssiiie - 26.03.2013
Interesting... I don't have time to check it and I don't have any selectable textdraws in my server, but I'll keep this in my head for when I will use them.
Thanks for the report. Maybe this will be fixed somewhere in the future.
Until the fix, servers should really look into this stuff and try to avoid it.
Re: F5 and clickable TDs -
dannyk0ed - 27.03.2013
Quote:
Originally Posted by SDraw
Well, I broke some servers with that bug...Anyone?
|
Interesting.... because our server had the same problem 1 week ago.
Re: F5 and clickable TDs -
SDraw - 27.03.2013
Quote:
Originally Posted by dannyk0ed
Interesting.... because our server had the same problem 1 week ago.
|
Naaah, they were Russian servers....
Re: F5 and clickable TDs -
DiGiTaL_AnGeL - 27.03.2013
How can you broke a server abusing of this bug? All the players online will have the same problem if you do it once?
Re: F5 and clickable TDs -
SDraw - 27.03.2013
Quote:
Originally Posted by DiGiTaL_AnGeL
How can you broke a server abusing of this bug? All the players online will have the same problem if you do it once?
|
As I think on servers that I broke code was so stupid that servers gone to recursion
Re: F5 and clickable TDs -
dannyk0ed - 27.03.2013
Quote:
Originally Posted by SDraw
Naaah, they were Russian servers....
|
Ah. Okay.
Re: F5 and clickable TDs -
leong124 - 27.03.2013
Quote:
Originally Posted by Basssiiie
Interesting... I don't have time to check it and I don't have any selectable textdraws in my server, but I'll keep this in my head for when I will use them.
Thanks for the report. Maybe this will be fixed somewhere in the future. Until the fix, servers should really look into this stuff and try to avoid it.
|
This should really be fixed, because server can't detect people pressing F5 so it's impossible to be fixed with any script.
Yeah, clicking a disappeared textdraw can mess up some GUI systems. Some argue that players don't press F5 very frequently, but it's not the problem. The problem is griefers will always use any possible bugs like this to mess your server up, so it should be fixed.
Btw, I can't accept people breaking any server with bugs purposely, no matter who owns the server. If you have one, you'll know the feeling, and simply say, people can always do the same thing (or more "funny" things) to you. So behave yourself.
Re: F5 and clickable TDs -
Basssiiie - 28.03.2013
Quote:
Originally Posted by leong124
This should really be fixed, because server can't detect people pressing F5 so it's impossible to be fixed with any script.
Yeah, clicking a disappeared textdraw can mess up some GUI systems. Some argue that players don't press F5 very frequently, but it's not the problem. The problem is griefers will always use any possible bugs like this to mess your server up, so it should be fixed.
|
If the script is supposed to hide the textdraw after you press it, then you can add an extra variable and check for the player after it has been pressed once. The bug here is that OnPlayerClickTextDraw gets spammed when pressing while in F5 mode. In some servers this can cause problems, because you expect the textdraw to hide after the first OnPlayerClickTextDraw, while it doesn't.
Quote:
Originally Posted by leong124
Btw, I can't accept people breaking any server with bugs purposely, no matter who owns the server. If you have one, you'll know the feeling, and simply say, people can always do the same thing (or more "funny" things) to you. So behave yourself.
|
To be honest: it's bad yes, but if he didn't do it, you probably hadn't responded to this thread either? Anyway, the world is a difficult place. Sometimes rules have to be broken before people realize that this has to be prevented. It's just how the world works, sadly enough.
Re: F5 and clickable TDs -
leong124 - 30.03.2013
Quote:
Originally Posted by Basssiiie
If the script is supposed to hide the textdraw after you press it, then you can add an extra variable and check for the player after it has been pressed once. The bug here is that OnPlayerClickTextDraw gets spammed when pressing while in F5 mode. In some servers this can cause problems, because you expect the textdraw to hide after the first OnPlayerClickTextDraw, while it doesn't.
|
It's then fixable with scripts and it will not be fixed officially. If people can spam the callback, use GetTickCount and ban them or don't do anything if they frequently click the same TD. Yet another fix for fixes.inc.
Quote:
Originally Posted by Basssiiie
To be honest: it's bad yes, but if he didn't do it, you probably hadn't responded to this thread either? Anyway, the world is a difficult place. Sometimes rules have to be broken before people realize that this has to be prevented. It's just how the world works, sadly enough.
|
True, but even the world is evil, it doesn't mean you have to be. Yes, only after people using some new kind of cheats in my server, I can develop new anti-cheat. However, does that mean if you have a cheat, you have to mess up a server? If you have a DoS software, does that mean you must DoS someone? Probably not.
What I suggest is to tell the others after knowing some bugs that can mess up servers.
For me, even if I really hate some servers, I'll never attack them in these ways. Words are much stronger. Sorry I'm too serious for this lol.