[HELP]SA-MP bug or my fault with SetSpawnInfo?
#1

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!
Reply
#2

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.
Reply
#3

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)