Problem with SetSpawnInfo
#1

I've been wondering why when I spawn this happens to me.

There is obviously a problem with setspawninfo. I've also encountered this problem when I've been spawning without a skin. So I've been setting a timer to set the skin after the player has spawned.

If i'm doing something wrong, please tell me. I think what I've done is correct so far.

The only problem I was getting was my character flying UP once they've spawned from logging out in an interior. I've also found out that it's almost all the time, regardless of being inside an interior. They usually fall down and that has then lead me to have no idea why my character is flying upwards and would like you ask you what is causing it.

I have searched the samp forums to the ground and still found absolutely no way to cure this.

This is the code for my login..
PHP Code:
SetSpawnInfo(extraid0playerInfo[extraid][pModel], playerInfo[extraid][pPos][0], playerInfo[extraid][pPos][1], playerInfo[extraid][pPos][2], 1.0, -1, -1, -1, -1, -1, -1);
SetCameraBehindPlayer(extraid);
SetPlayerInterior(extraidplayerInfo[extraid][pInterior]);
SetPlayerVirtualWorld(extraidplayerInfo[extraid][pVirtualWorld]);
SetPlayerSkin(extraidplayerInfo[extraid][pModel]);
SpawnPlayer(extraid);
SetTimerEx("SkinDelay"1000false"d"extraid); 
Reply
#2

happened with me
use SetPlayerHealth(playerid,0); it will work trust me.
Reply
#3

Should I set a timer to set the health back like I have done with the Skin?
Reply
#4

no make a variable like OnPlayerDeath If spawn = 0 Deaths ++ this will be better
Reply
#5

Okay so this is what I have done:

Login Script:
PHP Code:
SetSpawnInfo(extraid0playerInfo[extraid][pModel], playerInfo[extraid][pPos][0], playerInfo[extraid][pPos][1], playerInfo[extraid][pPos][2], 1.0, -1, -1, -1, -1, -1, -1);
SetCameraBehindPlayer(extraid);
SetPlayerInterior(extraidplayerInfo[extraid][pInterior]);
SetPlayerVirtualWorld(extraidplayerInfo[extraid][pVirtualWorld]);
SetPlayerSkin(extraidplayerInfo[extraid][pModel]);
SetPlayerHealth(extraid,0);
loginspawn[extraid]++;
SpawnPlayer(extraid);
SetTimerEx("SkinDelay"1000false"d"extraid); 
OnPlayerDeath
PHP Code:
if(loginspawn[playerid] == 1)
{
    
loginspawn[playerid] = 0;
    
SetPlayerHealth(playeridplayerInfo[playerid][pHealth]);
    
SetPlayerArmour(playeridplayerInfo[playerid][pArmour]);

Still having problems with the spawn.. It's killing me every time now. I've been debugging in the console and it's setting me in the correct positions also at the correct height. So at least something is working correctly.
Reply
#6

ok so at the top write
pawn Code:
new login;
pawn Code:
login = 1;
SetSpawnInfo(extraid, 0, playerInfo[extraid][pModel], playerInfo[extraid][pPos][0], playerInfo[extraid][pPos][1], playerInfo[extraid][pPos][2], 1.0, -1, -1, -1, -1, -1, -1);
SetCameraBehindPlayer(extraid);
SetPlayerInterior(extraid, playerInfo[extraid][pInterior]);
SetPlayerVirtualWorld(extraid, playerInfo[extraid][pVirtualWorld]);
SetPlayerSkin(extraid, playerInfo[extraid][pModel]);
SetPlayerHealth(extraid,0);
login==1;
SpawnPlayer(extraid);
SetTimerEx("SkinDelay", 1000, false, "d", extraid);
pawn Code:
//underOnPlayerDeath
if(login == 0)
{
Deaths [playerid] ++; //or any other u use
}
pawn Code:
//underOnPlayerspawn
login = 0;
Reply
#7

I get the idea of how it works now, thankyou for your time. I'll adapt the script differently to work in the way I've scripted my gamemode.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)