SA-MP Forums Archive
Calculating login being less than 5 minutes? - 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: Calculating login being less than 5 minutes? (/showthread.php?tid=608654)



Calculating login being less than 5 minutes? - Dokins - 03.06.2016

pawn Код:
new calc = LastLogin[playerid] - 300;
            if(LastLogin[playerid] > calc)
            {
                switch(UsingSpawn[playerid])
                {
                    case 0:
                    {
                        SetSpawnInfo(playerid, 0, skin,810.7388,-1339.9355,13.5384,46.7076 + 0.3, 0,0,0,0,0,0);
                        SpawnPlayer(playerid);
                        SetCameraBehindPlayer(playerid);
                    }
                    case 1:
                    {
                        SetSpawnInfo(playerid, 0, skin,SpawnX[Faction[playerid]], SpawnY[Faction[playerid]], SpawnZ[Faction[playerid]],90, 0,0,0,0,0,0);
                        SpawnPlayer(playerid);
                        SetCameraBehindPlayer(playerid);
                    }
                    case 2:
                    {
                        for(new hs = 1; hs < MAX_HOUSES; hs++)
                        {
                            if(HouseOwner[hs] == PlayerSQLID[playerid])
                            {
                                SetSpawnInfo(playerid, 0, skin, HouseEntX[hs], HouseEntY[hs], HouseEntZ[hs], 90, 0,0,0,0,0,0);
                                SpawnPlayer(playerid);
                                SetCameraBehindPlayer(playerid);
                                break;
                            }
                        }
                    }
                }
            }
            if(LastLogin[playerid] < calc)
            {
                SetPlayerVirtualWorld(playerid, LastVW[playerid]);
                SetPlayerInterior(playerid, LastInt[playerid]);
                SetSpawnInfo(playerid, 0, skin, LastX[playerid], LastY[playerid], LastZ[playerid],0, 0,0,0,0,0,0);
                SpawnPlayer(playerid);
                SetCameraBehindPlayer(playerid);
            }
For some reason it always returns them to the default spawn.

Could someone kindly point out what I'm doing wrong.
LastLogin is definitely saving correctly.

Thanks.


Re: Calculating login being less than 5 minutes? - ilijap - 03.06.2016

new calc = LastLogin[playerid] + 300;

xD


Re: Calculating login being less than 5 minutes? - blanic - 03.06.2016

lastLogin[playerid] + 0;


Re: Calculating login being less than 5 minutes? - PrO.GameR - 03.06.2016

Simply because thats always true !
LastLogin[playerid] > LastLogin[playerid] - 300
You forgot to use gettime() to get current time.