This code is screwing dialogs up
#1

For some reason, this code is making all the registration-related dialogs appear at the same time as each other when a new player registers. When I remove this code, this problem does not happen. I am attempting to learn PAWN by editing Emmet_'s SC-RP script. This code is my attempt at a logout system (which lets you switch your character) and it works fine, however for some reason it messes up registration dialogs.

PHP код:
CMD:logout(playerid,params[])
{
    new 
str[128], query[128];
    
    
PlayerData[playerid][pLogout] = 1;
    
    if(
PlayerData[playerid][pLoopAnim])
    {
        
PlayerData[playerid][pLoopAnim] = 0;
    }
    
CancelDrivingTest(playerid);
    
format(strsizeof(str), "%s has logged out."ReturnName(playerid0));
    
SendAdminAlert(COLOR_GREYstr);
    
SendNearbyMessage(playerid30.0COLOR_GREY"%s has logged out."ReturnName(playerid0));
    
SQL_SaveCharacter(playerid);
    
PlayerCar_Unload(playerid);
    
PlayerData[playerid][pLogged] = 0;
    
SetPlayerName(playeridPlayerData[playerid][pUsername]);
    
SetPlayerCameraPos(playerid2053.0479, -190.924630.0708);
    
SetPlayerCameraLookAt(playerid2053.6860, -190.154030.0559);
    
    
format(querysizeof(query), "SELECT * FROM `characters` WHERE `Username` = '%s' LIMIT 3"PlayerData[playerid][pUsername]);
    
mysql_function_query(g_iHandlequerytrue"OnQueryFinished""dd"playeridTHREAD_CHARACTERS);
    return 
1;
}
forward OnQueryFinished(extraidthreadid);
public 
OnQueryFinished(extraidthreadid)
{
    if (!
IsPlayerConnected(extraid))
        return 
0;
    static
        
rows,
        
fields;
        
    switch (
threadid)
    {
        case 
THREAD_CHARACTERS:
        {
            
cache_get_data(rowsfieldsg_iHandle);
            for (new 
0rows++) {
                
cache_get_field_content(i"Character"PlayerCharacters[extraid][i], g_iHandle);
            }
            if(
PlayerData[extraid][pLogout] == 0)
            {
                
SendServerMessage(extraid"You have authenticated into your account successfully.");
                
ShowCharacterMenu(extraid);
            }
            else if(
PlayerData[extraid][pLogout] == 1)
            {
                
SendServerMessage(extraid"You have logged out.");
                
ShowCharacterMenu(extraid);
            }
        }
// ... more threads
    
}
    return 
1;
}
ShowCharacterMenu(playerid)
{
    new 
str[32];
    if (
PlayerData[playerid][pCharacter] != 0)
    {
        
PlayerData[playerid][pCharacter] = 0;
        for (new 
08++) {
              
PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][i]);
        }
        for (new 
7181++) {
              
PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][i]);
        }
    }
    for (new 
08++)
    {
        if (
3) {
            
format(strsizeof(str), "%s", (!PlayerCharacters[playerid][i][0]) ? ("Empty Slot") : (PlayerCharacters[playerid][i]));
            
PlayerTextDrawSetString(playeridPlayerData[playerid][pTextdraws][5], str);
        }
        
PlayerTextDrawHide(playeridPlayerData[playerid][pTextdraws][i]);
        
PlayerTextDrawShow(playeridPlayerData[playerid][pTextdraws][i]);
    }
    
SelectTextDraw(playerid, -1);

At first, I thought the textdraws were screwing up because I was using ShowCharacterMenu again, so I duplicated ShowCharacterMenu but renamed it to ShowLogoutMenu, but this didn't fix it.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)