Player Skin isnt working
#1

After a sucessful login, the script should set the player skin as PlayerInfo[playerid][pSkin], but i have no idea why, it isnt working. It works fine after registering, but not after the login. I've already tried to set the skin at OnPlayerSpawn, and it also isnt working. The problem isnt in the PlayerInfo[playerid][pSkin] because i created a command /skin and it works.
pawn Код:
//WORKS
//after the register
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],-185.4632,941.8038,15.6317,358, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);

// and the cmd, so the problem isnt [pSkin]
CMD:skin(playerid,params[])
{
    SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
    return 1;
}


//DOESNT WORK
//after the login
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ], PlayerInfo[playerid][LastA], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); // already tried without this, and changed its position
// SPAWN
public OnPlayerSpawn(playerid)
{
    SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
    return 1;
}
Reply
#2

where did you changed it's var : PlayerInfo[playerid][pSkin]
i mean you should get player skin to set on it where did you set?
Reply
#3

Ewww... Let me change your /skin command
pawn Код:
CMD:skin(playerid,params[])
{
    pInfo[playerid][pSkin] = GetPlayerSkin(playerid);
    GameTextForPlayer(playerid,"~r~Skin Saved!",3000,5);
    return 1;
}
Explaination: Now, if you execute the command /skin, it'll save your current skin to pInfo[playerid][pSkin].
If you want the same skin to be used after relogging and stuffs, go to your OnPlayerDisconnect and add
pawn Код:
INI_WriteInt(File,"Skin",pInfo[playerid][pSkin]);
and load it when he connects.
Reply
#4

Quote:
Originally Posted by amirab
Посмотреть сообщение
where did you changed it's var : PlayerInfo[playerid][pSkin]
i mean you should get player skin to set on it where did you set?
I dont know if i understand your question, but the skin is set as 299 when the player registers, and then it is saved when the player logs out. When he logs in again, the script loads his skin, but somewhy it isnt working.

Quote:
Originally Posted by biker122
Посмотреть сообщение
Ewww... Let me change your /skin command
pawn Код:
CMD:skin(playerid,params[])
{
    pInfo[playerid][pSkin] = GetPlayerSkin(playerid);
    GameTextForPlayer(playerid,"~r~Skin Saved!",3000,5);
    return 1;
}
Explaination: Now, if you execute the command /skin, it'll save your current skin to pInfo[playerid][pSkin].
If you want the same skin to be used after relogging and stuffs, go to your OnPlayerDisconnect and add
pawn Код:
INI_WriteInt(File,"Skin",pInfo[playerid][pSkin]);
and load it when he connects.
Thats not what i want. My /skin command isnt wrong, i just made it to test the PlayerInfo[playerid][pSkin], it was made to set the skin, not to save it.

When the player logs out there is already there is already a function for saving its data, including the skin
pawn Код:
// Saving it
INI_WriteInt(playerFile,"Skin",PlayerInfo[playerid][pSkin]);
// Loading it
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
as i said before, the problem isnt on loading or saving the skin, it is on setting it after login.
Reply
#5

I have no idea what is happening. Sometimes it works, it sets my skin, other times, it doesnt.

I made another command, to check pSkin and the skin i'm using atm.
pawn Код:
CMD:myskin2(playerid,params[])
{
    new string[40];
    format(string,20,"1- %d 2- %d",GetPlayerSkin(playerid),PlayerInfo[playerid][pSkin]);
    SendClientMessage(playerid,COLOR_WHITE,string);
    return 1;
}
CMD:myskin(playerid,params[])
{
    SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
    return 1;
}
This is the weird part. When i log in, my skin doesnt load, so i get cj skin. Then i use /myskin2, to see my current skin and the skin set in PlayerInfo[playerid][pSkin]. It tells me that my current skin is "824193135" and doesnt return any value to PlayerInfo[playerid][pSkin]. So i use /myskin, and nothing more, and the code sets my skin to what it should be (skin number 2, in my case), then i use /myskin2 once again, and it tells me my current skin is 2, and pSkin is also 2. There is a bug with PlayerInfo[playerid][pSkin], i just cant find where.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)