Moving Camera On Login
#1

Hey guys I'm using VX RP 2 and i am attempting to use this tut to make the camera. The codes compiles no errors and doesn't work. I did notice that the dialog and the messages that typically would be under onplayerconnect or requestclass are actually under OnQueryFinish. I tried making the code and this is what i have gotten but it does not work.

pawn Код:
public OnQueryFinish(query[], resultid, extraid, connectionHandle) {
    switch(resultid) {
        case THREAD_TIMESTAMP_CONNECT: {
            mysql_store_result();
           
            if(mysql_num_rows() == 0)
                return SendClientMessage(extraid, COLOR_GENANNOUNCE, "SERVER:"EMBED_WHITE" Welcome to the server!");
               
            GetPlayerName(extraid, szPlayerName, MAX_PLAYER_NAME);

            mysql_fetch_row_format(result);
            format(szMessage, sizeof(szMessage), "SERVER:"EMBED_WHITE" Welcome back %s, your last connection was %s.", szPlayerName, result);
            SendClientMessage(extraid, COLOR_GENANNOUNCE, szMessage);
           
            if(playerVariables[extraid][pGroup] >= 1) {
                format(szMessage, sizeof(szMessage), "(Group) "EMBED_WHITE"%s from your group has just logged in.", szPlayerName);
                SendToGroup(playerVariables[extraid][pGroup], COLOR_GENANNOUNCE, szMessage);

                format(szMessage, sizeof(szMessage), "(Group) MOTD: "EMBED_WHITE"%s", groupVariables[playerVariables[extraid][pGroup]][gGroupMOTD]);
                SendClientMessage(extraid, COLOR_GENANNOUNCE, szMessage);
            }
           
            mysql_free_result();
        }
        case THREAD_LAST_CONNECTIONS: {
            mysql_store_result();
           
            if(mysql_num_rows() < 1)
                return SendClientMessage(extraid, COLOR_GREY, "You haven't connected more than once yet.");

            format(szPointlesslyLarge, sizeof(szPointlesslyLarge), "Last ~5 of your connections:\n");
            while(mysql_fetch_row_format(result)) {
                for(new i = 0; i < strlen(result); i++) if(result[i] == '|') result[i] = ' ';
                format(szPointlesslyLarge, sizeof(szPointlesslyLarge), "%s\n%s", szPointlesslyLarge, result);
            }
           
            ShowPlayerDialog(extraid, 0, DIALOG_STYLE_MSGBOX, "SERVER: Connection log", szPointlesslyLarge, "OK", "");
           
            mysql_free_result();
        }
        case THREAD_CHECK_PLAYER_NAMES: {
            mysql_store_result();

            if(mysql_num_rows() == 0)
                return SendClientMessage(extraid, COLOR_GREY, "There are no recorded name changes for this player.");

            new
                iNCID,
                szOldName[MAX_PLAYER_NAME],
                szTime[20],
                szNewName[MAX_PLAYER_NAME];

            format(szPointlesslyLarge, sizeof(szPointlesslyLarge), "Name changes:\n");
            while(mysql_fetch_row_format(result)) {
                sscanf(result, "p<|>ds[24]s[24]s[20]", iNCID, szOldName, szNewName, szTime);
                format(szPointlesslyLarge, sizeof(szPointlesslyLarge), "%s\n- (%d) Name: %s (changed from %s, %s)", szPointlesslyLarge, iNCID, szNewName, szOldName, szTime);
            }

            ShowPlayerDialog(extraid, 0, DIALOG_STYLE_MSGBOX, "SERVER: Name changes", szPointlesslyLarge, "OK", "");

            mysql_free_result();
        }
        case THREAD_LOAD_ATMS: {
            mysql_store_result();
           
            new
                x;
           
            while(mysql_retrieve_row()) {
                mysql_get_field("atmId", result);
                x = strval(result);
               
                mysql_get_field("atmPosX", result);
                atmVariables[x][fATMPos][0] = floatstr(result);
               
                mysql_get_field("atmPosY", result);
                atmVariables[x][fATMPos][1] = floatstr(result);
               
                mysql_get_field("atmPosZ", result);
                atmVariables[x][fATMPos][2] = floatstr(result) - 0.7;
               
                mysql_get_field("atmPosRotX", result);
                atmVariables[x][fATMPosRot][0] = floatstr(result);

                mysql_get_field("atmPosRotY", result);
                atmVariables[x][fATMPosRot][1] = floatstr(result);

                mysql_get_field("atmPosRotZ", result);
                atmVariables[x][fATMPosRot][2] = floatstr(result);
               
                atmVariables[x][rObjectId] = CreateDynamicObject(2618, atmVariables[x][fATMPos][0], atmVariables[x][fATMPos][1], atmVariables[x][fATMPos][2], atmVariables[x][fATMPosRot][0], atmVariables[x][fATMPosRot][1], atmVariables[x][fATMPosRot][2], -1, -1, -1, 500.0);
                atmVariables[x][rTextLabel] = CreateDynamic3DTextLabel("ATM\n\nWithdraw your cash here!", COLOR_YELLOW, atmVariables[x][fATMPos][0], atmVariables[x][fATMPos][1], atmVariables[x][fATMPos][2], 50.0);
                //CreateDynamicObject(2618, x, y, z, rx, ry, rz, -1, -1, -1, 500.0);
            }
           
            mysql_free_result();
        }
        case THREAD_CHANGE_SPAWN: {
            SendClientMessage(extraid, COLOR_WHITE, "You have successfully changed the newbie spawn and newbie skin.");
            GetPlayerName(extraid, szPlayerName, MAX_PLAYER_NAME);
            format(szMessage, sizeof(szMessage), "AdmWarn: %s has changed the newbie spawn & skin.", szPlayerName);
            submitToAdmins(szMessage, COLOR_HOTORANGE);
        }
        case THREAD_CHECK_ACCOUNT_USERNAME: {
            mysql_store_result();
            if(mysql_num_rows() == 0) {

                if(!IsPlayerConnected(extraid))
                    return mysql_free_result(); // Incase they're disconnected since... Sometimes queries F*"!%$" up.

                new
                    charCounts[5];

                GetPlayerName(extraid, szPlayerName, MAX_PLAYER_NAME);

                for(new n; n < MAX_PLAYER_NAME; n++) {
                    switch(szPlayerName[n]) {
                        case '[', ']', '.', '$', '(', ')', '@', '=': charCounts[1]++;
                        case '_': charCounts[0]++;
                        case '0' .. '9': charCounts[2]++;
                        case 'a' .. 'z': charCounts[3]++;
                        case 'A' .. 'Z': charCounts[4]++;
                    }
                }
                if(charCounts[0] == 0 || charCounts[0] >= 3) {
                    SendClientMessage(extraid, COLOR_GREY, "Your name is not valid. {FFFFFF}Please use an underscore and a first/last name (i.e. Mark_Edwards).");
                    Kick(extraid);
                }
                else if(charCounts[1] >= 1) {
                    SendClientMessage(extraid, COLOR_GREY, "Your name is not valid, as it contains symbols. {FFFFFF}Please use a roleplay name.");
                    Kick(extraid);
                }
                else if(charCounts[2] >= 1) {
                    SendClientMessage(extraid, COLOR_GREY, "Your name is not valid, as it contains numbers. {FFFFFF}Please use a roleplay name.");
                    Kick(extraid);
                }
                else if(charCounts[3] == strlen(szPlayerName) - 1) {
                    SendClientMessage(extraid, COLOR_GREY, "Your name is not valid, as it is lower case. {FFFFFF}Please use a roleplay name (i.e. Dave_Meniketti).");
                    Kick(extraid);
                }
                else if(charCounts[4] == strlen(szPlayerName) - 1) {
                    SendClientMessage(extraid, COLOR_GREY, "Your name is not valid, as it is upper case. {FFFFFF}Please use a roleplay name (i.e. Dave_Meniketti).");
                    Kick(extraid);
                }
                else {
                    SendClientMessage(extraid, COLOR_RED, "SERVER: {FFFFFF}Welcome to "SERVER_NAME".");
                    SendClientMessage(extraid, COLOR_RED, "UCP Message: {FFFFFF}The UCP Does Not Know Your Name In Our Database, Please Register Below.");

                    ShowPlayerDialog(extraid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "UCP: UCP Registration", "Welcome to "SERVER_NAME"\n\nPlease enter your desired password below!", "Continue", "Leave");
                }
            }
            else {
                if(!IsPlayerConnected(extraid))
                    return mysql_free_result();

                SendClientMessage(extraid, COLOR_RED, "SERVER: {FFFFFF}Welcome to "SERVER_NAME".");
                SendClientMessage(extraid, COLOR_RED, "UCP Message: {FFFFFF}The UCP Detects that your account is already on our Database.");

                ShowPlayerDialog(extraid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "User Control Panel:", "Welcome to the "SERVER_NAME" Server.\n\nTo Proceed, Type Your Password Below", "Continue", "Leave");
            }

            mysql_free_result();
        }
pawn Код:
public OnPlayerConnect(playerid) {
    #if defined DEBUG
        printf("[debug] OnPlayerConnect(%d)", playerid);
    #endif

    SetPlayerPos(playerid, spawnX, spawnY, spawnZ); // Set the player at those 3 const spawn values from before.

    if(prc_Moving[playerid] == false) // Check whether the camera is already set.
    {
        prc_Degree[playerid] = 0; // Reseting the variable
        prc_Timer[playerid] = SetTimerEx("MoveCamera", 75, true, "d", playerid); // Setting the timer
        prc_Moving[playerid] = true; // okay, now we're going to activate the moving variable
    }
 /* Los Santos Fire */
    RemoveBuildingForPlayer(playerid, 4026, 1497.7969, -1543.7109, 17.5547, 0.25);
    RemoveBuildingForPlayer(playerid, 4218, 1497.7031, -1546.6172, 43.9922, 0.25);
    RemoveBuildingForPlayer(playerid, 4016, 1497.7969, -1543.7109, 17.5547, 0.25);
   
    SetPlayerColor(playerid, COLOR_WHITE);
    resetPlayerVariables(playerid);

    new
        queryString[72],
        playerIP[32];

    Players++;
    format(webquery, 256, "UPDATE server SET players='%d'", Players);
    mysql_query(webquery);
   
    GetPlayerIp(playerid, playerIP, sizeof(playerIP));

    format(queryString, sizeof(queryString), "SELECT `banID` FROM `bans` WHERE `IPBanned` = '%s'", playerIP);
    mysql_query(queryString, THREAD_CHECK_BANS_LIST, playerid);

    SetPlayerMapIcon(playerid, 10, 595.5443, -1250.3405, 18.2836, 52, 0);
    syncPlayerTime(playerid);
    SetPlayerWeather(playerid, weatherVariables[0]); // Keep it all in sync (weather bugged out sometimes until we fixed it this way).

    // Remove the original mall mesh
    RemoveBuildingForPlayer(playerid, 6130, 1117.5859, -1490.0078, 32.7188, 10.0);

    // This is the mall mesh LOD
    RemoveBuildingForPlayer(playerid, 6255, 1117.5859, -1490.0078, 32.7188, 10.0);

    // There are some trees on the outside of the mall which poke through one of the interiors
    RemoveBuildingForPlayer(playerid, 762, 1175.3594, -1420.1875, 19.8828, 0.25);
    RemoveBuildingForPlayer(playerid, 615, 1166.3516, -1417.6953, 13.9531, 0.25);
    return 1;
}
Reply
#2

Bump Bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)