Slow response time on textdraw click -
polygxn - 13.02.2019
My last topic was about that I got 3-4 seconds delay when I clicked on the "Login" textdraw but now its a different case. So the problem is when I click (for example) the Glen Park textdraw I get 1-2 seconds delay before the function executes (so, before the camera pos and look angle changes). Since my english is really bad here is my code, maybe its more clear with it:
Variables:
PHP код:
new bool:glenpark;
new bool:idlewood;
new bool:market;
new bool:pigpen;
new bool:rodeo;
Select where I want to spawn:
PHP код:
hook OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(clickedid == Spawner_Textdraw1)
{
SetPlayerCameraLookAt(playerid, 2061.863037, -1241.968750, 96.064331, 1);
SetPlayerCameraPos(playerid, 2065.282714, -1243.963134, 99.118499);
SetSpawnInfo(playerid, NO_TEAM, pData[playerid][pSkin], 1975.8727, -1196.0349, 25.8565, 92.4579, 0, 0, 0, 0, 0, 0);
glenpark = true;
idlewood = false;
market = false;
pigpen = false;
rodeo = false;
}
if(clickedid == Spawner_Textdraw2)
{
SetPlayerCameraLookAt(playerid, 2112.351318, -1741.657104, 29.260829, 1);
SetPlayerCameraPos(playerid, 2116.203369, -1744.538818, 30.623826);
SetSpawnInfo(playerid, NO_TEAM, pData[playerid][pSkin], 2074.6162, -1698.0490, 13.5547, 272.0087, 0, 0, 0, 0, 0, 0);
glenpark = false;
idlewood = true;
market = false;
pigpen = false;
rodeo = false;
}
if(clickedid == Spawner_Textdraw3)
{
SetPlayerCameraLookAt(playerid, 1098.410278, -1379.536743, 51.293975, 1);
SetPlayerCameraPos(playerid, 1096.113891, -1375.498291, 53.142616);
SetSpawnInfo(playerid, NO_TEAM, pData[playerid][pSkin], 1129.0845, -1490.3561, 22.7690, 0.4082, 0, 0, 0, 0, 0, 0);
glenpark = false;
idlewood = false;
market = true;
pigpen = false;
rodeo = false;
}
if(clickedid == Spawner_Textdraw4)
{
SetPlayerCameraLookAt(playerid, 2436.882568, -1271.516967, 41.213577, 1);
SetPlayerCameraPos(playerid, 2439.441894, -1275.723754, 42.080848);
SetSpawnInfo(playerid, NO_TEAM, pData[playerid][pSkin], 2412.8335, -1244.5699, 23.8125, 179.8994, 0, 0, 0, 0, 0, 0);
glenpark = false;
idlewood = false;
market = false;
pigpen = true;
rodeo = false;
}
if(clickedid == Spawner_Textdraw5)
{
SetPlayerCameraLookAt(playerid, 460.348541, -1562.994262, 57.691375, 1);
SetPlayerCameraPos(playerid, 464.638671, -1564.508300, 59.765613);
SetSpawnInfo(playerid, NO_TEAM, pData[playerid][pSkin], 408.6932, -1543.6320, 32.2734, 225.0360, 0, 0, 0, 0, 0, 0);
glenpark = false;
idlewood = false;
market = false;
pigpen = false;
rodeo = true;
}
}
When I click this button (spawn) my character spawns at the selected location:
PHP код:
if(clickedid == Spawner_Textdraw6)
{
if(glenpark == true || idlewood == true || market == true || pigpen == true || rodeo == true)
{
DSpawner_Textdraw(playerid);
CancelSelectTextDraw(playerid);
OnPlayerReady(playerid);
}
}
I just want to make it clear, and Im pretty sure there is an easier way to do these type of stuff so...this is why I post this. Maybe you guys can help me with that.
Re: Slow response time on textdraw click -
polygxn - 15.02.2019
Bump I guess
Re: Slow response time on textdraw click -
TokicMajstor - 15.02.2019
I took it should be public OnPlayerClickTextdraw not hook
But since it is set player camera function it needs itself some time not 5 secs but about 1 or 2
Re: Slow response time on textdraw click -
polygxn - 15.02.2019
Well, its not about the camera while moving. I know the camera need like 2-3 secs between changing the view angle and such, its about when the camera STARTS moving. So I click the textdraw and after that I got a 3 sec delay before the position changing. Sorry for the messy sentences, my english is pretty weird.
Oh and yeah, the hook thing has nothing to do with the delay Im pretty sure. Im just doing my whole gamemode the "modular programming" way, this is why I need to hook functions.
Re: Slow response time on textdraw click -
TokicMajstor - 15.02.2019
Oh I understand I have similar thing on my server and it is same I don't know why