SA-MP Forums Archive
[HELP]SA-MP bug or my fault with SetSpawnInfo? - 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: [HELP]SA-MP bug or my fault with SetSpawnInfo? (/showthread.php?tid=346705)



[HELP]SA-MP bug or my fault with SetSpawnInfo? - [DOG]irinel1996 - 29.05.2012

Hi guys!
I have a little problem with SetSpawnInfo, here we go:
1є. I have a Dialog for login in OnPlayerConnect, if the password is OK it calls a function which loads the data throught SQLite, and set it in variables.
Example:
pawn Код:
LoadUserData(playerid)
{
     //queries... etc etc
    if(db_num_rows(Result))
    {
        new field[20];
        //other data...
        db_get_field_assoc(Result, "skin", field, 20);
        p_Info[playerid][pSkin] = strval(field);
        //Variable to know if he is registered and passed the tutorial.
        db_get_field_assoc(Result, "tuto", field, 20);
        p_Info[playerid][pTuto] = strval(field);
       
        //Well, and here I have this:
        if(p_Info[playerid][pTuto] >= 1)
        {
                //Set skin and spawn position.
               SetSpawnInfo(playerid,0,   p_Info[playerid][pSkin],
                                       p_Info[playerid][pPosX],
                                       p_Info[playerid][pPosY],
                                       p_Info[playerid][pPosZ],
                                       0.0,0,0,0,0,0,0);
            SpawnPlayer(playerid); //And I spawn him.
         } else {
              //Register part...
        }
    }
    return 1;
}
Well, the Dialog is in OnPlayerConnect and if it responses and the password is correct I call the function to log him. But when he spawns always has the skin 0. =/
By the way, I think OnPlayerSpawn isn't called and after death neither. :O

Thank you!


Re: [HELP]SA-MP bug or my fault with SetSpawnInfo? - mati233 - 29.05.2012

That's weird, I have a similar system and works just fine for me, but if you're sure the p_Info[playerid][pSkin] has the correct skin id, try to use setplayerskin onplayerspawn.


Re : [HELP]SA-MP bug or my fault with SetSpawnInfo? - [DOG]irinel1996 - 29.05.2012

Forget that, fixed by myself.
And OnPlayerSpawn is still no called, but the skin works now.
Have an idea to fix the 2nd problem.
Thank you anyway!