SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 27/03/2020, 08:55 PM   #1
MrCesar
Huge Clucker
 
MrCesar's Avatar
 
Join Date: Sep 2016
Location: Russia
Posts: 290
Reputation: 1
Default Is it possible to set a timer before loading the gamemode?

Hello guys, I am working on a registration system, and I am setting the players camera to a specific angle, and when I log in sometimes it doesn't show me the camera but drop me to the spawn place instead, I guess it has something to do with loading and streaming times as it just doesn't load on the first time but after you relog it works fine (no gmxing)..

Any ideas what may cause that and how to prevent that?
Any help will be much appreciated! Thanks alot
MrCesar is offline   Reply With Quote
Old 27/03/2020, 11:53 PM   #2
TokicMajstor
Huge Clucker
 
TokicMajstor's Avatar
 
Join Date: Oct 2018
Location: Bosnia And Herzegovina
Posts: 213
Reputation: 10
Default Re: Is it possible to set a timer before loading the gamemode?

I think that your player is instantly redirected from OnPlayerConnected to OnPlayerRequestClass, since there is no any code at that callback (I suppose) it spawns the player, so you should put some checkings at OnPlayerRequestClass or return 0 there.

Also is player camera set at OnPlayerConnect or?
__________________

My work:
-MapTD - GTA SA Map on a TextDraw

https://forum.sa-mp.com/showthread.php?t=671806
TokicMajstor is offline   Reply With Quote
Old 28/03/2020, 04:07 AM   #3
khRamin78
Huge Clucker
 
khRamin78's Avatar
 
Join Date: Jun 2015
Location: IRI/LA
Posts: 321
Reputation: 30
Default Re: Is it possible to set a timer before loading the gamemode?

You need a timer in OnPlayerConnect I think your anim lib loading takes too long!
khRamin78 is offline   Reply With Quote
Old 28/03/2020, 07:38 AM   #4
MrCesar
Huge Clucker
 
MrCesar's Avatar
 
Join Date: Sep 2016
Location: Russia
Posts: 290
Reputation: 1
Default Re: Is it possible to set a timer before loading the gamemode?

Hey guys, thanks for the responses! Solved it out, I had this on my OnPlayerRequestClass:
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
    if(PlayerInfo[playerid][LoggedIn] == false)
    {
        SetSpawnInfo(playerid, 0, 0, 563.3157, 3315.2559, 0, 269.15, 0, 0, 0, 0, 0, 0);
        TogglePlayerSpectating(playerid, true);
        TogglePlayerSpectating(playerid, false);
        SetPlayerCamera(playerid);
        return 1;
    }
    SetSpawnInfo(playerid, 0, 1, 2098.5088,1159.1156,11.6484, 65.2418, 0, 0, 0, 0, 0, 0 );
    SpawnPlayer(playerid);
    return 0;
}


And I had this on the SetPlayerCamera function I created:

pawn Code:
function:SetPlayerCamera(playerid)
{
    new  campos = random(2);

    switch(campos)
    {
        case 0:
        {
            SetPlayerPos(playerid, 2448.1470, -1653.5150, 46.0304);
            SetPlayerVirtualWorld(playerid, 1337);
            TogglePlayerControllable(playerid, false);
            SetPlayerCameraPos(playerid, 2448.1470, -1653.5150, 42.0304);
            SetPlayerCameraLookAt(playerid, 2449.0830, -1653.8802, 41.3304);
        }
        case 1:
        {
            /*SetPlayerPos(playerid, 414.2790, -2058.9209, 20.0965);
            SetPlayerVirtualWorld(playerid, 1337);
            TogglePlayerControllable(playerid, false);
            SetPlayerCameraPos(playerid, 414.2790, -2058.9209, 22.0965);
            SetPlayerCameraLookAt(playerid, 413.9620, -2057.9668, 22.0015);*/

        }
    }
    return 1;
}

As you see I had the second view case all commented out, which left it as a blank, I was using that to make some fixed to the first view and not be redirected to the second, and forgot to uncomment.

So what was happening is that from SetPlayerCamera on OnPlayerRequest it went to that function and every time it was on the correct view I was seeing everything correctly but after relogging it went to the blank view and probably that's why it spawned me in the first place.

Hope this helps out some people
MrCesar is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gamemode not loading... iSkate Scripting Help 4 22/12/2013 09:04 PM
Gamemode Not Loading JamieVic Scripting Help 5 08/04/2013 08:25 AM
Gamemode not loading Chris6996 Server Support 3 22/08/2012 09:13 AM
not loading gamemode[+rep] thefatshizms Server Support 25 14/03/2012 04:48 PM
Gamemode not loading yoan103 Help Archive 9 08/03/2011 06:22 PM


All times are GMT. The time now is 10:25 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.