Player classes not showing
#1

Hello

I was making a class selection for my GM.
I normally don't use AddPlayerClass and just use SetPlayerSkin and Pos under OnPlayerRequestClass, however since I were getting bugs I decided to change to AddPlayerClass...

So I added this to OnGameModeInit:

pawn Код:
AddPlayerClass(5, -3074.7300,2987.9231,3.1354, 130.3651, 0, 0, 0, 0, 0, 0);
However no skin is shown when logging in to the server.
But when I die, and then go back to class selection (via f4) I do see the skin...

Any help?
Thanks in advance
Reply
#2

I don't like to bump, but this problem is very annoying...
And I can't seem to find a solution for it, there must be someone who has had this problem too?
Reply
#3

you should make:
pawn Код:
SetPlayerPos(playerid, x,y,z);
    SetPlayerFacingAngle(playerid,a);
    SetPlayerCameraPos(playerid, x,y,z);
    SetPlayerCameraLookAt(playerid, x,y,z);
under on playerrequestclass
Reply
#4

Under OnPlayerRequestClass, is there some kind of timer or something that automatically makes the person spawn? Try and remove that if so, and it should work perfectly.
Reply
#5

Quote:
Originally Posted by AnonScripter
Посмотреть сообщение
you should make:
pawn Код:
SetPlayerPos(playerid, x,y,z);
    SetPlayerFacingAngle(playerid,a);
    SetPlayerCameraPos(playerid, x,y,z);
    SetPlayerCameraLookAt(playerid, x,y,z);
under on playerrequestclass
That would mean going back to where I came from...

@Danish:
There was a timer, which I removed. But the problem remains :/

Here's the full callback:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    new file[64],PlayerName[25];
    GetPlayerName(playerid,PlayerName,sizeof PlayerName);
    format(file,sizeof file,"Admin/%s.ini",PlayerName);
    if(!fexist(file) && PInfo[playerid][Logged] == 0)
    {
        Register(playerid);
    }
    if(fexist(file) && PInfo[playerid][Logged] == 0)
    {
        Login(playerid);
    }

    return 1;
}
pawn Код:
stock Login(playerid)
{
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Welcome back to the server! \nEnter your password:", "Login", "");
    return 1;
}

stock Register(playerid)
{
    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Enter your password:", "Register", "");
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_REGISTER)
    {
        if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,COLOR_WHITE,"You are already logged in!");//Checking if the player is logged in, if he is, it won't allow him to re-register
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Password invalid, Enter your password:", "Register", "");

        new file[64],PlayerName[24];//Creating a variable to store the file path, and a variable to store the players name.
        GetPlayerName(playerid,PlayerName,sizeof PlayerName);
        format(file,sizeof file,"Admin/%s.ini",PlayerName);
        if(fexist(file)) return SendClientMessage(playerid,COLOR_WHITE,"Somehow you're already registered!");
        INI_Open(file);
        INI_WriteString("Password",inputtext);
        INI_WriteInt("Level",PInfo[playerid][Level]);
        INI_Save();
        INI_Close();
        SendClientMessage(playerid,COLOR_GREEN,"Registered");
        GameTextForPlayer(playerid, "~g~Thank you for registering, enjoy your stay",4000,0);
       
        InterpolateCameraPos(playerid,-3100.8394,2964.5935,10.7787,-3087.0117,2977.9360,8.0252, 2000, CAMERA_MOVE);
        InterpolateCameraLookAt(playerid,-3068.4573,2987.2256,2.2427 + 3, -3074.7300,2987.9231,3.1354 + 3, 2000, CAMERA_MOVE);
       
        PInfo[playerid][Logged] = 1;
       
        TextDrawShowForPlayer(playerid, TD_INFO[playerid]);
        ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
        MovePlayerObject(playerid, ClassGate, -3090.1604004,2971.1838379,11.7469883 + 10, 5);
        CreateExplosion(-3087.0117,2977.9360,8.0252, 1, 20.0);
        PlayerPlaySound(playerid, 1185, -3087.0117,2977.9360,8.0252);
    }
   
    if(dialogid == DIALOG_LOGIN)
    {
        if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,COLOR_WHITE,"You are already logged in!");//Checking if the player is logged in, if he is, it won't allow him to login
        new password[23],password2[23];//Creating a variable to store the password, and another one to store the password from the user's file.
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Password invalid, Enter your password:", "Login", "");

        InterpolateCameraPos(playerid,-3100.8394,2964.5935,10.7787,-3085.6050,2978.3179,8.0414, 2000, CAMERA_MOVE);
        InterpolateCameraLookAt(playerid,-3068.4573,2987.2256,2.2427 + 3, -3074.7300,2987.9231,3.1354 + 3, 2000, CAMERA_MOVE);

        new file[64],PlayerName[24];//Creating a variable to store the file path, and a variable to store the players name.
        GetPlayerName(playerid,PlayerName,sizeof PlayerName);
        format(file,sizeof file,"Admin/%s.ini",PlayerName);
        if(!fexist(file)) return SendClientMessage(playerid,COLOR_WHITE,"Please use /register");//Checking if the player is not registered, again....
        INI_Open(file);//Opening the file with SII include
        INI_ReadString(password2,"Password");
        if(strcmp(password,password2) != 0) return SendClientMessage(playerid,COLOR_WHITE,"Wrong password!"),INI_Close();//Checking if he inputted the correct password, if not, retrieve him a message and closing the file;
        PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file.
        PInfo[playerid][Score] = INI_ReadInt("Score");
        PInfo[playerid][Money] = INI_ReadInt("Money");
        PInfo[playerid][Kills] = INI_ReadInt("Kills");
        PInfo[playerid][Skin] = INI_ReadInt("Skin");
        PInfo[playerid][Rep] = INI_ReadInt("Reps");
        PInfo[playerid][Deaths] = INI_ReadInt("Deaths");
        PInfo[playerid][VortexPB] = INI_ReadFloat("VortexPB");
        GivePlayerMoney(playerid, INI_ReadInt("Money"));
        SetPlayerScore(playerid, PInfo[playerid][Score]);
        //SetPlayerSkin(playerid, PInfo[playerid][Skin]);
        SetPlayerColor(playerid, INI_ReadInt("Color"));
        INI_Close();
       
        new stats[128];
       
        format(stats,sizeof stats,"Score: %i | Money: %i | Kills %i | Deaths %i | Admin level %i | Reputation %i", PInfo[playerid][Score], PInfo[playerid][Money], PInfo[playerid][Kills], PInfo[playerid][Deaths], PInfo[playerid][Level], PInfo[playerid][Rep]);
        SendClientMessage(playerid,COLOR_GREEN,"You have been successfully logged in!");
        SendClientMessage(playerid,COLOR_GREEN,"Your stats progress will be automatically saved from now on!");
        SendClientMessage(playerid,COLOR_ADMIN_BLUE,"Current stats:");
        SendClientMessage(playerid,COLOR_ADMIN_BLUE,stats);
        PInfo[playerid][Logged] = 1;
       
        TextDrawShowForPlayer(playerid, TD_INFO[playerid]);
        ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
        MovePlayerObject(playerid, ClassGate, -3090.1604004,2971.1838379,11.7469883 + 10, 5);
        CreateExplosion(-3087.0117,2977.9360,8.0252, 1, 20.0);
        PlayerPlaySound(playerid, 1185, -3087.0117,2977.9360,8.0252);
    }
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(PInfo[playerid][Logged] == 0)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "Login or register first");
        return 0;
    }
    return 1;
}
That's all the stuff that happens when requesting the class...
Reply
#6

Actually, move these:
pawn Код:
new file[64],PlayerName[25];
    GetPlayerName(playerid,PlayerName,sizeof PlayerName);
    format(file,sizeof file,"Admin/%s.ini",PlayerName);
    if(!fexist(file) && PInfo[playerid][Logged] == 0)
    {
        Register(playerid);
    }
    if(fexist(file) && PInfo[playerid][Logged] == 0)
    {
        Login(playerid);
    }
in OnPlayerConnect and add:
pawn Код:
// Change the coordinates
SetPlayerPos(playerid, x,y,z);
    SetPlayerFacingAngle(playerid,a);
    SetPlayerCameraPos(playerid, x,y,z);
    SetPlayerCameraLookAt(playerid, x,y,z);
in OnPlayerRequestClass like AnonScripter said.

With the code you had, the class selection was empty.
Reply
#7

But moving the dialog makes the dialog appear when the player connects, and not at the class selection.
Anyways nvm, I guess I'll go back to the old way of doing it
Reply
#8

Quote:
Originally Posted by knackworst
Посмотреть сообщение
But moving the dialog makes the dialog appear when the player connects, and not at the class selection.
Anyways nvm, I guess I'll go back to the old way of doing it
Set the position/camera first and check whether they're registered or not after setting up the class selection.
Reply
#9

Ok, but in the meantime I also set the position when the player responds to the dialog, since the player isn't visable yet when the dialog is called
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)