SA-MP Forums Archive
OnPlayerRequestClass problem. (Rep+) - 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: OnPlayerRequestClass problem. (Rep+) (/showthread.php?tid=304077)



OnPlayerRequestClass problem. (Rep+) - GangsTa_ - 16.12.2011

Here's my OnPlayerRequestClass:

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SendClientMessage(playerid, COLOR_LIGHTRED, "{ffffff}•• {00ffff}Welcome to {000000}Sa{ff0000}n {ff9900}And{cccc00}re{00cc00}as {00ffff}R{00cccc}P{0000ff}G. {ffffff}••");
    SetPlayerInterior(playerid,0);
    SetPlayerFacingAngle(playerid, 266.9181);
    SetPlayerCameraPos(playerid,-1856.5886,875.8010,198.8736); //join camera
    SetPlayerCameraLookAt(playerid,-1856.5886,875.8010,198.8736);
    TogglePlayerControllable(playerid, 0);
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    if(strcmp(pName,fOwner,false,strlen(pName)) == 0) return PlayerJob[playerid] = 1;
    if(strcmp(pName,fZam[0],false,strlen(pName)) == 0) return PlayerJob[playerid] = 2;
    if(strcmp(pName,fZam[1],false,strlen(pName)) == 0) return PlayerJob[playerid] = 2;
    for(new i=0; i<10; i++)
    {
        if(strcmp(pName,fDriver[i],false,strlen(pName)) == 0) return PlayerJob[playerid] = 3;
        if(strcmp(pName,fCombainer[i],false,strlen(pName)) == 0) return PlayerJob[playerid] = 4;
    }
    print("0"); //
    if (RegistrationStep[playerid] == 0 && gPlayerLogged[playerid] != 1)
    {
        print("1"); //
        new bac[500];
        new name[MAX_PLAYER_NAME];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        GetPlayerName(playerid, playername, sizeof(playername));
        format(bac, sizeof(bac), "%s.ini", playername);
        print("2"); //
        if(gPlayerAccount[playerid] != 0)
        {
            print("3"); //
            format(bac, sizeof(bac),"{666666}______________________________________\n\n  Welcome to SA:RPG{666666}\n       This account is registered\n\nLogin: %s\nEnter password below:\n______________________________________", name);
            ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Login",bac,"Login","Cancel");
            print("4"); //
            return 1;
        }
        else
        {
            gPlayerAccount[playerid] = 0;
            format(bac, sizeof(bac),"{666666}______________________________________\n\n  Welcome to SA:RPG{666666}\n       Register a new character\n\nLogin: %s{666666}\nEnter password below:\n______________________________________", name);
            ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"Register",bac,"Done","Cancel");
            return 1;
        }
    }
    print("5"); //
    return 1;
}
Why when I join the server the dialog doesn't appear? The message "Welcome to San Andreas: RPG" appears. Why it doesn't print anything? No print at all, I tried to debug it.

NOTE: This happened when I updated to 0.3d R2.


Re: OnPlayerRequestClass problem. (Rep+) - Johnson_boy - 16.12.2011

It doesn't show when you connect, but when you browse the skins it shows it, or?


Re: OnPlayerRequestClass problem. (Rep+) - GangsTa_ - 16.12.2011

It's a RP gamemode, the dialog should pop up after connect, so this happens OnPlayerRequestClass of course.


Re: OnPlayerRequestClass problem. (Rep+) - Vince - 16.12.2011

Your excessive use of the keyword 'return' messes up everything! Once the script reaches a return, it doesn't process that callback any further.


Re: OnPlayerRequestClass problem. (Rep+) - GangsTa_ - 16.12.2011

Oh, thanks for telling, I'll try that tomorrow, now I'm off.