BUG: GMX (Connect -> Request Class)
#1

This is a critical bug and can be used to avoid class selection. (if the server was just restarted).

SOMETIMES, when you restart the gamemode, and you return. You will encounter this bug.



OnPlayerRequestClass IS NOT called yet. It will call if you use the arrow buttons.

When you click SPAWN, OnPlayerRequestSpawn will execute, obviously, but no OnPlayerRequestClass is called.

This can bug servers that save 'classid' into a global variable.

A temporary fix I made to my server for this.

pawn Код:
public OnPlayerConnect(playerid)
{
    PlayerInfo[playerid][pCarModel] = Class_Selection_IDS[0][CS_VehicleModelID]; // = 400 (dummy vehicle)
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    classid++;//so theres no 0 (dummy)
    PlayerInfo[playerid][pCarModel] = C_S_IDS[classid][CS_VehicleModelID];//none of these values are equal to the dummy
    SetPlayerCameraPos(playerid, 100.0, 100.0, 100.0);
    SetPlayerCameraLookAt(playerid, 100.0, 98.0, 102.0, CAMERA_MOVE);
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(PlayerInfo[playerid][pCarModel] == Class_Selection_IDS[0][CS_VehicleModelID])//this is changed under OnPlayerRequestClass
    {
        GameTextForPlayer(playerid, "~r~Please Select A Vehicle!", 3000, 3);
        CallLocalFunction("OnPlayerRequestClass", "ii", playerid, 0);//force onplayerrequestclass so your camera code can be executed
        return 0;
    }
    return 1;
}
I have only tested this bug in 0.3e RC5.

Edit: fixed the temp fix
Reply
#2

that is not an new 0.3e bug, also happens in 0.3d.
Reply
#3

This can be fixed by calling OnPlayerRequestClass under OnPlayerConnect on a timer.
Reply
#4

Please let us disable these buttons !!

DisableRequestClassButtons(); for OnGameModeInit
Reply
#5

Easily disabled with SpawnPlayer().
Reply
#6

Quote:
Originally Posted by MP2
Посмотреть сообщение
Easily disabled with SpawnPlayer().
But still, i use my Intro at OnPlayerRequestClass and i want to disable the buttons, i tried with a 50 ms timer like a guy said but it doesn't work
Reply
#7

Try with a 100 MS timer then. I use 123 and it works fine every time.
Reply
#8

Quote:
Originally Posted by Dripac
Посмотреть сообщение
But still, i use my Intro at OnPlayerRequestClass and i want to disable the buttons, i tried with a 50 ms timer like a guy said but it doesn't work
Make your own custom class selection by returning 0 on OnPlayerRequestClass and using SetSpawnInfo and SpawnPlayer after player has logged in or registered.
Reply
#9

Quote:
Originally Posted by MP2
Посмотреть сообщение
This can be fixed by calling OnPlayerRequestClass under OnPlayerConnect on a timer.
OnPlayerRequestClass will be called twice if it suddenly works fine, since you can't know the player joining the server is before or after restarting the gamemode.
Reply
#10

Quote:
Originally Posted by Dripac
Посмотреть сообщение
Please let us disable these buttons !!

DisableRequestClassButtons(); for OnGameModeInit
Just use TogglePlayerSpectating(playerid, true); under OnPlayerConnect.
And set it to false after correct pass/logon entry or something like that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)