Slow response time on textdraw click
#1

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(playeridText:clickedid)
{
    if(
clickedid == Spawner_Textdraw1)
    {
        
SetPlayerCameraLookAt(playerid2061.863037, -1241.96875096.0643311);
        
SetPlayerCameraPos(playerid2065.282714, -1243.96313499.118499);
        
SetSpawnInfo(playeridNO_TEAMpData[playerid][pSkin], 1975.8727, -1196.034925.856592.4579000000);
        
glenpark true;
        
idlewood false;
        
market false;
        
pigpen false;
        
rodeo false;
    }
    if(
clickedid == Spawner_Textdraw2)
    {
        
SetPlayerCameraLookAt(playerid2112.351318, -1741.65710429.2608291);
        
SetPlayerCameraPos(playerid2116.203369, -1744.53881830.623826);
        
SetSpawnInfo(playeridNO_TEAMpData[playerid][pSkin], 2074.6162, -1698.049013.5547272.0087000000);
        
glenpark false;
        
idlewood true;
        
market false;
        
pigpen false;
        
rodeo false;
    }
    if(
clickedid == Spawner_Textdraw3)
    {
        
SetPlayerCameraLookAt(playerid1098.410278, -1379.53674351.2939751);
        
SetPlayerCameraPos(playerid1096.113891, -1375.49829153.142616);
        
SetSpawnInfo(playeridNO_TEAMpData[playerid][pSkin], 1129.0845, -1490.356122.76900.4082000000);
        
glenpark false;
        
idlewood false;
        
market true;
        
pigpen false;
        
rodeo false;
    }
    if(
clickedid == Spawner_Textdraw4)
    {
        
SetPlayerCameraLookAt(playerid2436.882568, -1271.51696741.2135771);
        
SetPlayerCameraPos(playerid2439.441894, -1275.72375442.080848);
        
SetSpawnInfo(playeridNO_TEAMpData[playerid][pSkin], 2412.8335, -1244.569923.8125179.8994000000);
        
glenpark false;
        
idlewood false;
        
market false;
        
pigpen true;
        
rodeo false;
    }
    if(
clickedid == Spawner_Textdraw5)
    {
        
SetPlayerCameraLookAt(playerid460.348541, -1562.99426257.6913751);
        
SetPlayerCameraPos(playerid464.638671, -1564.50830059.765613);
        
SetSpawnInfo(playeridNO_TEAMpData[playerid][pSkin], 408.6932, -1543.632032.2734225.0360000000);
        
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.
Reply
#2

Bump I guess
Reply
#3

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
Reply
#4

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.
Reply
#5

Oh I understand I have similar thing on my server and it is same I don't know why
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)