SA-MP Forums Archive
OnPlayerSpawn is not responding. - 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: OnPlayerSpawn is not responding. (/showthread.php?tid=378589)



OnPlayerSpawn is not responding. - No Fear - 18.09.2012

Hello, i'm having an issue with OnPlayerSpawn, the problem is that this function is not responding, it wont work, i deleted the code in it and added a simple print("Hi"); and nothing, the same issue happens. any ideas?


Re: OnPlayerSpawn is not responding. - blank. - 18.09.2012

Not responding as in not called when a player spawns?
Would help if you showed us your code.


Re: OnPlayerSpawn is not responding. - No Fear - 18.09.2012

When the player enters the right password. It needs to spawn him, but nothing happens. I told you the code is empty, i added only print line and nothing, it wont show up.


Re : OnPlayerSpawn is not responding. - will-56 - 18.09.2012

Try SpawnPlayer(playerid) when player successfully logged in.


Re: OnPlayerSpawn is not responding. - blank. - 18.09.2012

Use SetSpawnInfo on OnPlayerConnect


Re: Re : OnPlayerSpawn is not responding. - No Fear - 18.09.2012

Both of these are not working.


Re: OnPlayerSpawn is not responding. - blank. - 18.09.2012

Show us your code please.


Re: OnPlayerSpawn is not responding. - No Fear - 18.09.2012

pawn Код:
public OnPlayerSpawn( playerid )
{
    print( "Hi" );
    return true;
}
Hi is not being printed.


Re: OnPlayerSpawn is not responding. - blank. - 18.09.2012

You said the player doesn't spawn, can you show us the other relevant code bits?


Re: OnPlayerSpawn is not responding. - No Fear - 18.09.2012

Woh, you still dont get it, I 'M TELLING YOU THIS, THE PUBLIC IS NOT WORKING, IT WONT PRINT, IT WONT DO ANYTHING. if you really want
pawn Код:
if( IsPlayerNPC( playerid ) )
    {

        new
            npcname[ MAX_PLAYER_NAME ]
        ;

            GetPlayerName( playerid, npcname, sizeof( npcname ) );

            if( !strcmp(npcname, "Juste", true ) )
            {
                SetPlayerSkin   ( playerid, 211 );
                SetPlayerColor  ( playerid, KILL_COLOR );
            }

            if( !strcmp(npcname, "Audrius", true ) )
            {
                SetPlayerSkin   ( playerid, 60 );
                SetPlayerColor  ( playerid, KILL_COLOR );
            }
        return true;
    }


    // :Rodome, Naikiname Tekstus
    TextDrawShowForPlayer   ( playerid, Engine );
    TextDrawShowForPlayer   ( playerid, Powered );
    SetPlayerColor          ( playerid, KILL_COLOR );
    SetTimerEx              ( "AMX_ServerCount",1000*60,false,"%d",playerid );

    if( newguy[ playerid ] )
    {

        new
            rand = random( sizeof( RandomSpawn ) )
        ;

        SetPlayerPos( playerid,
                                RandomSpawn[ rand ][ 0 ],
                                RandomSpawn[ rand ][ 1 ],
                                RandomSpawn[ rand ][ 2 ]);


        newguy          [ playerid ] = false;
       
        ShowPlayerDialog    ( playerid,900, 1, "Бveskite tikrа Savo {09AB0C}El.Paрtа{FFFFFF}", "Бveskite:", "Tжsti", "" );

        for                 ( new i = 0; i < 20; i++ ) SendClientMessage( playerid, -1,"" );

        SendClientMessage   ( playerid, COLOR_GREEN, "Бveskite savo tikrа {09AB0C}elektroninб paрtа{FFFFFF}" );
        SendClientMessage   ( playerid, COLOR_GREEN, "Б jб gausite beveik visа informacijа" );
        SendClientMessage   ( playerid, COLOR_GREEN, "Pirkimш raktus, sаskaitos susigraюinimа, svarbiа informcijа" );
        SendClientMessage   ( playerid, -1, "Бvedus {D1111E}netinkamа{FFFFFF} {09AB0C}elektroninб paрtа{FFFFFF}, prarandate galimybж naudotis" );
        SendClientMessage   ( playerid, COLOR_ORANGE, "Didюiuma sistemos privilegijш" );
        SendClientMessage   ( playerid, -1, "Apie savo {D1111E}sаskaitos{FFFFFF} valdymа galite suюinoti {FF8C00}(/saskaita){FFFFFF}" );
    }

    if( OperationStatus[ playerid ] )
    {
        TextDrawHideForPlayer   ( playerid, ConnectBox );
        if( PVar[ playerid ][ pLastX ] != 0.0 && PVar[ playerid ][ pLastY ] != 0 )
        {

           
            new
                msg     [ 180 ],
                Query   [ 150 ],
                Date    [ 50 ],
                fetch   [ 50 ],
                Hour,
                Minute,
                Second,
                Day,
                Month,
                Year,
                aJailVar,
                aJailT
            ;

            format              ( Query,150,"SELECT * FROM `jail` WHERE `JName` = '%s' LIMIT 1",pName( playerid ) );
            mysql_query         ( Query );
            mysql_store_result  ( );
            mysql_fetch_row     ( Query );

            mysql_fetch_field_row   ( fetch,"aJail" );
            sscanf                  ( fetch, "i", aJailVar );
            AdminJail               [ playerid ] = aJailVar;

            mysql_fetch_field_row   ( fetch,"aJailtime" );
            sscanf                  ( fetch, "i", aJailT );
            AdminJailTime           [ playerid ] = aJailT;

            if( AdminJailTime[ playerid ] > 1 ) // :BETA
            {

                format                  ( msg, sizeof( msg ), "Jыs esate vis dar бkalintas {8612F9}%i{FFFFFF} sekundлmis. {E19D0A}NGG.LT{FFFFFF}", AdminJailTime[ playerid ] );
                SendClientMessage       ( playerid, -1, msg );

                TextDrawShowForPlayer   ( playerid, ConnectBox );
            }else{

            // :Serverio Timeriai, Galimas Leakas!
            if( TVar[ playerid ][ tPhone ] )
            {
                 SetTimerEx( "AMX_BatteryCount",1000*60,false,"%d",playerid );
            }else{}

            SetPlayerPos( playerid,
                                    PVar[ playerid ][ pLastX ],
                                    PVar[ playerid ][ pLastY ],
                                    PVar[ playerid ][ pLastZ ] );

            SetPlayerInterior   ( playerid, PVar[ playerid ][ pInt ] );
            SetPlayerSkin       ( playerid, PVar[ playerid ][ pSkin ] );

            getdate ( Year, Month, Day );
            gettime ( Hour, Minute, Second );
            format  ( Date, 50 , "%d-%02d-%02d %02d:%02d:%02d",Year,Month,Day,Hour,Minute,Second );

            format( msg, sizeof msg, "Sveiki Sugrбюe Б Serverб {D80000} %s {FFFFFF}\
                                    \nApie Юaidimo Naujienas Galite Suюinoti Suvede\
                                    \n{FF8C00}                  (/naujienos){FFFFFF}"
, pName( playerid ) );

            ShowPlayerDialog        ( playerid,90, DIALOG_STYLE_MSGBOX,"Serveris", msg, "Uюdaryti", "" );

            format              ( Query,150,"SELECT * FROM `security` WHERE `SName` = '%s' LIMIT 1",pName( playerid ) );
            mysql_query         ( Query );
            mysql_store_result  ( );
            mysql_fetch_row     ( Query );

            new
                GetDate [ 50 ],
                IP      [ 17 ],
                Mut,
                Invite
            ;

            mysql_fetch_field_row   ( GetDate, "CDate" );
            mysql_fetch_field_row   ( IP, "IP" );

            mysql_fetch_field_row   ( fetch,"Muted" );
            sscanf                  ( fetch,"i",Mut );
            MutedSeconds            [ playerid ] = Mut;

            mysql_fetch_field_row   ( fetch,"Invite" );
            sscanf                  ( fetch,"i",Invite );
            Invited                 [ playerid ] = Invite;


            format                  ( msg,150,"{FF4500}Рi Sаskaita paskutinб kartа buvo Aktyvi{FFFFFF}: {FF8C00}%s{FFFFFF} iр {008000}%s IP{FFFFFF}",GetDate, IP );
            SendClientMessage       ( playerid,-1,msg );

            format                  ( Query, sizeof( Query ), "UPDATE `security` SET `CDate` = '%s', `IP` = '%s'  WHERE `SName` = '%s'", Date, GetPlayerIpEx( playerid ), pName( playerid ) );
            mysql_query             ( Query );

            OperationStatus         [ playerid ] = false;
            TextDrawShowForPlayer   ( playerid, ServerBuild );
        }}}