SA-MP Forums Archive
BUG: GMX (Connect -> Request Class) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: BUG: GMX (Connect -> Request Class) (/showthread.php?tid=329536)



BUG: GMX (Connect -> Request Class) - Kar - 29.03.2012

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


Re: BUG: GMX (Connect -> Request Class) - Mandrakke - 29.03.2012

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


Re: BUG: GMX (Connect -> Request Class) - MP2 - 29.03.2012

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


Re: BUG: GMX (Connect -> Request Class) - Dripac - 29.03.2012

Please let us disable these buttons !!

DisableRequestClassButtons(); for OnGameModeInit


Re: BUG: GMX (Connect -> Request Class) - MP2 - 29.03.2012

Easily disabled with SpawnPlayer().


AW: Re: BUG: GMX (Connect -> Request Class) - Dripac - 29.03.2012

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


Re: BUG: GMX (Connect -> Request Class) - MP2 - 29.03.2012

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


Re: AW: Re: BUG: GMX (Connect -> Request Class) - T0pAz - 29.03.2012

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.


Re: BUG: GMX (Connect -> Request Class) - leong124 - 29.03.2012

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.


Re: BUG: GMX (Connect -> Request Class) - iPLEOMAX - 31.03.2012

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.