Need help with a Skin bug
#1

Hello, Well I'm experiencing a bug when I change someone skin with a cmd when he get killed and respawn he's getting his old skin but everyone else can see the new skin so in other words, Only him can not see the right skin but his previous one... At disconnect and reconnect it's back to normal and he can see it correctly. Any idea what could cause this?
Reply
#2

Show your code
Reply
#3

Just set the skin under OnPlayerspawn.
Reply
#4

showcode plss
Reply
#5

Quote:
Originally Posted by HellSphinX
Посмотреть сообщение
Just set the skin under OnPlayerspawn.
But you still can use a fuction within OnPlayerDeath, if i'm correct? like saving the skin OnPlayerDeath callback, or am i wrong?
Reply
#6

Quote:
Originally Posted by HarlemSAMP
Посмотреть сообщение
But you still can use a fuction within OnPlayerDeath, if i'm correct? like saving the skin OnPlayerDeath callback, or am i wrong?
Yes, this could be a way of getting around it; save the skin into a per-player global variable OnPlayerDeath then set the skin under OnPlayerSpawn using SetPlayerSkin and that global variable, something like this:

pawn Код:
new skinID[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    skinID[playerid] = -1;
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    // Do your checks here then set the skinID variable
    // Example:
    skinID[playerid] = 0; // CJ skin
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(skinID[playerid] != -1)
    {
        SetPlayerSkin(playerid, skinID[playerid]);
        skinID[playerid] = -1; // resetting it for another use
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by HellSphinX
Посмотреть сообщение
Yes, this could be a way of getting around it; save the skin into a per-player global variable OnPlayerDeath then set the skin under OnPlayerSpawn using SetPlayerSkin and that global variable, something like this:

pawn Код:
new skinID[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    skinID[playerid] = -1;
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    // Do your checks here then set the skinID variable
    // Example:
    skinID[playerid] = 0; // CJ skin
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(skinID[playerid] != -1)
    {
        SetPlayerSkin(playerid, skinID[playerid]);
        skinID[playerid] = -1; // resetting it for another use
    }
    return 1;
}
Not my thread but thanks HellSphinX you made me learn something new wich i knew but i wasn't sure +rep
Reply
#8

Finaly I fixed it using onplayerdeath save skin and onplayerspawn setskin saved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)