Help Setting A Player Class before class selection
#1

okay let me explain what I'm trying to do.
I want at the class selection screen to set the default to that last used by the user.

example

I log in and select class 4 then log out.
when i log in again, at the class selection screen I want the class that shows first to be
that of which the user last used.


I already have a log in system and it working saving/loading the classid. eg: 4
I don't need you to code me a hole script just point me in the right direction.
I just basically need help with where/how to setup this class preview at the class selection screen.
iv looked around and just cant seam to get where this would go and how i set it up.
I'm guessing it will be something with the Player Variables but am not sure.

in your example you can use the pClassID for the var holding the current classID
and I will adjust to my code.

thanks for any help you can provide.
Reply
#2

iv tried the

pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
    SetPVarInt(playerid, "classID",PlayerInfo[playerid][pClass]);
   
        SetPlayerInterior(playerid,14);
    SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
    SetPlayerFacingAngle(playerid, 270.0);
    SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
    SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
    return 1;
}
but it just shows class 0 at the selection screen.
Reply
#3

okay after 2 days of reading I understand a bit more,
please forgive me for im completely new to PAWN and SAMP
and I may be doing it completely wrong


this is my onrequestclass function.
what I have done is create a field in my aplayerinfo array
that gets set to 0 when i user connects.
I check this in the onrequestclass callback and if its true I try to force the class
selection to that last used by this user.



pawn Code:
// This callback gets called when the player is selecting a class (but hasn't clicked "Spawn" yet)
public OnPlayerRequestClass(playerid, classid)
{

    //check for first class request (when player is logging in)
    if(aPlayerInfo[playerid][pFirstClassRequest]==1)
    {
        //reset first request to 0 so it dont keep looping.
        aPlayerInfo[playerid][pFirstClassRequest] = 0;
        //reforce the class selection screen with the last used classid
        OnPlayerRequestClass(playerid, aPlayerInfo[playerid][pClassID]);
        return 1;
    }

    SetPlayerInterior(playerid,14);
    SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
    SetPlayerFacingAngle(playerid, 270.0);
    SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
    SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);

    // Display a short message to inform the player about the class he's about to choose
    switch (classid)
    {
        case 0 .. 17: // Thugs
        {
            GameTextForPlayer(playerid, TXT_Thug, 3000, 4);
            strcpy(aPlayerInfo[playerid][pClass], TXT_Thug,30);
        }
        case 18 .. 28: // PoPo
        {
            GameTextForPlayer(playerid, TXT_PoPo, 3000, 4);
            strcpy(aPlayerInfo[playerid][pClass], TXT_PoPo,30);
        }
    }
    //save player class
    aPlayerInfo[playerid][pClassID] =classid;
    return 1;
}
problem is it just dont work
it always starts with classid = 0

any ideas? This is pretty important in my Lan Gamemode.
Reply
#4

Bump . I take it this is just not possible?
Does anyone know?
Reply
#5

Thank you

I already use ysi so ill check it out
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)