Not spawning with players Skin ID
#1

I have a problem with the skins, it doesnt seem to be spawning the player correctly with the Skin ID below.

Do I HAVE to create entries for all the different classes in the file before hand? Or can I just select them as I have below?

I don't have any entries at all using AddPlayerClass

Код:
stock LoadStats(playerid)
{
    new pName[24],Query[80];
    GetPlayerName(playerid,pName,24);
    format(Query,sizeof(Query), "SELECT * FROM `Users` WHERE `Username` = '%s';", pName);
    mysql_query(Query);
    mysql_store_result();
    mysql_fetch_row_format(Query, "|");
    sscanf(Query, "e<p<|>s[24]s[23]ddddfffdddd>", PInfo[playerid]);
    mysql_free_result();
    GivePlayerMoney(playerid,PInfo[playerid][Money]);
    SetSpawnInfo(playerid, 0, PInfo[playerid][SkinID], PInfo[playerid][PosX], PInfo[playerid][PosY], PInfo[playerid][PosZ], 10, 0,0,0,0,0,0);
    SpawnPlayer(playerid);
    SetPlayerScore(playerid, PInfo[playerid][Level]);
    SetPlayerSkin(playerid, PInfo[playerid][SkinID]);
    return 1;
}
Reply
#2

Why do you have SetSpawnInfo, and then SetPlayerSkin? SetSpawnInfo is enough.
Reply
#3

pawn Код:
stock LoadStats(playerid)
{
    new pName[24],Query[80];
    GetPlayerName(playerid,pName,24);
    format(Query,sizeof(Query), "SELECT * FROM `Users` WHERE `Username` = '%s';", pName);
    mysql_query(Query);
    mysql_store_result();
    mysql_fetch_row_format(Query, "|");
    sscanf(Query, "e<p<|>s[24]s[23]ddddfffdddd>", PInfo[playerid]);
    mysql_free_result();
    GivePlayerMoney(playerid,PInfo[playerid][Money]);
    SetSpawnInfo(playerid, 0, PInfo[playerid][SkinID], PInfo[playerid][PosX], PInfo[playerid][PosY], PInfo[playerid][PosZ], 10, 0,0,0,0,0,0);
    SpawnPlayer(playerid);
    SetPlayerScore(playerid, PInfo[playerid][Level]);
    return 1;
}
Try this.
Reply
#4

Quote:
Originally Posted by Windows32
Посмотреть сообщение
pawn Код:
stock LoadStats(playerid)
{
    new pName[24],Query[80];
    GetPlayerName(playerid,pName,24);
    format(Query,sizeof(Query), "SELECT * FROM `Users` WHERE `Username` = '%s';", pName);
    mysql_query(Query);
    mysql_store_result();
    mysql_fetch_row_format(Query, "|");
    sscanf(Query, "e<p<|>s[24]s[23]ddddfffdddd>", PInfo[playerid]);
    mysql_free_result();
    GivePlayerMoney(playerid,PInfo[playerid][Money]);
    SetSpawnInfo(playerid, 0, PInfo[playerid][SkinID], PInfo[playerid][PosX], PInfo[playerid][PosY], PInfo[playerid][PosZ], 10, 0,0,0,0,0,0);
    SpawnPlayer(playerid);
    SetPlayerScore(playerid, PInfo[playerid][Level]);
    return 1;
}
Try this.
What did you do except taking out the SetPlayerSkin? Lol?

EDIT: BTW Simon, when posting PAWN code it is better to use [PAWN][//Pawn](Remove one of the /).
Reply
#5

I have tried it with just the SetSpawnInfo but it doesnt work, it keeps spawning with some other skin id.

Do I need the AddPlayerClass stuff in OnGameModeInit? I have added values 1-31, 178 and 230 but unsure if they are actually needed.

It's picking up the Skin ID correctly, I know this as I made a cmd and it returns correctly.
Reply
#6

No, it's just saving the wrong ID, or not loading it into the enum correctly. I'm not experienced with MySql much so can't help you.

(I use y_ini for everything)
Reply
#7

JhnzRep I have stored the Skin ID as 178 in the database, I even tried 230 (the homeless guy) but it still insists on spawning as another skin.

Should I have all the classes in OnGameModeInit or not bother?

This is what it looks like at the moment

pawn Код:
public OnGameModeInit()
{
    mysql_connect(mysql_host,mysql_user,mysql_database,mysql_password);
    mysql_debug(1);
    SetGameModeText("UK-RP v1.00 (June 09");
    ShowPlayerMarkers(0);
    ShowNameTags(1);

    AddPlayerClass(1,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(2,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(3,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(4,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(5,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(6,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(7,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(8,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(9,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(10,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(11,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(12,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(13,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(14,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(15,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(16,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(17,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(18,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(19,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(20,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(21,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(22,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(23,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(24,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(25,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(26,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(27,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(28,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(29,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(30,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(31,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(178,0,0,0,0,0,0,0,0,0,0);
    AddPlayerClass(230,0,0,0,0,0,0,0,0,0,0);

    return 1;
}
Reply
#8

What you need to do is, GetPlayerSkin(playerid), when you are disconnecting and store it into your database. I don't know how to do this, as I do not use MySql, sorry.
Reply
#9

Try adding SetPlayerSkin via player spawn and check if player is registered if not then set a random skin or what ever you want.
Reply
#10

It appears to be something to do with those AddPlayerClass in the OnGameModeInit

It keeps spawning me with Skin ID 1

And I've tried doing the GetPlayerSkin(playerid) and it keeps changing my SkinID to 1 in the database.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)