OnPlayerRequestClass problem
#1

hello,

I have a problem with the function "OnPlayerRequestClass".

I want to spawn the player without request a class.

I have tried it with the "SpawnPlayer(playerid);" but it didnґt work. I cant login!

Look at my script pls:

Public OnPlayerRequestClass(playerid, claasid)
{
SpawnPlayer(playerid);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(gPlayerLogged[playerid] == 0 && !IsPlayerNPC(playerid))
{
//here is a login script. if i pull it to OnPlayerRequestClass it will work! but I want it have here xD
}
}
Reply
#2

Use [.pawn] [./pawn] or [.code] [./code] but don't use " . " lol...
Reply
#3

Try something at OnPlayerRequestSpawn, it gets called when the player tries to spawn, not when he selects a skin ^^
Reply
#4

My Problem is:

I wanna connect and than the server say "Connect to Homeversion..." but no Dialog and no Spawn

pawn Код:
public OnPlayerRequestSpawn(playerid)//neu
{
    if(gPlayerLogged[playerid] == 0 && !IsPlayerNPC(playerid))
    {
        new sendername[MAX_PLAYER_NAME];
        new string[MAX_PLAYER_NAME];
        new rand = random(sizeof(ConnectSpawns));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "%s.ini", sendername);
        new File: hFile = fopen(string, io_read);
        FreezePlayer(playerid, 0);
        PlayerPlaySound(playerid, 1097, 0.0, 0.0, 0.0);
        if(gPlayerLogged[playerid] == 0)
        {
            if (hFile)
            {
                gPlayerAccount[playerid] = 1;
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Dein Name ist bei uns regestriert. \nDu kannst dich anmelden, indem du unten dein Passwort eingibst","Login","Quit");
            }
            else
            {
                gPlayerAccount[playerid] = 0;
                ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Regestrierung","Du bist hier noch nicht regestriert.\nBitte gebe unten dein Passwort ein um dich zu regestrieren.\n\n AnschlieЯend musst du dich mit deinem Passwort anmelden.","Register","Quit");
            }
        }
        sn = TextDrawCreate(215.0, 35.0,"Rl-Gamernetzwerk");
        TextDrawFont(sn , 0);
        TextDrawLetterSize(sn ,1.0,3.1);
        TextDrawSetShadow(sn ,1);
        TextDrawColor(sn ,0xFF0000B7);
        //
        st = TextDrawCreate(140.5, 60.0,"Willkommen auf dem Server der Zukunft");
        TextDrawFont(st , 1);
        TextDrawLetterSize(st ,0.5,2.1);
        TextDrawSetShadow(st ,3);
        TextDrawBackgroundColor(st,0xFF0000B7);
        TextDrawColor(st ,0xFFFFFFFF);//WeiЯ
        TextDrawShowForPlayer(playerid, sn);
        TextDrawShowForPlayer(playerid, st);
        SetPlayerCameraPos(playerid, ConnectSpawns[rand][0],ConnectSpawns[rand][1],ConnectSpawns[rand][2]);
        SetPlayerCameraLookAt(playerid, ConnectSpawns[rand][3],ConnectSpawns[rand][4],ConnectSpawns[rand][5]);
        SetPlayerPos(playerid, ConnectSpawns[rand][6],ConnectSpawns[rand][7],ConnectSpawns[rand][8]);
    }
    return 1;
}
why I want Spawn with out class selection?

i use the xstreamer and if the CameraPos will be changed i dident see any onjects in the function OnPlayerRequestClass
Reply
#5

Nobody can help me?
Reply
#6

Make a "fake class function" if you will.

For example:

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
     SetTimerEx("SpawnPlayerEx", 250, 0, "i", playerid);
     return 1;
}

forward SpawnPlayerEx(playerid);
public SpawnPlayerEx(playerid)
{
     SpawnPlayer(playerid);

     // rest of code here
     return 1;
}
You can use PVars to make sure the player doesn't go through authentication twice, for example a logged in status PVar.
Reply
#7

Thank you but i didnt see the objects from the xobject streamer!? And OnPlayerRequestClaas is allready on so i can select next previos or Spawn
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)