Need help with a Skin bug - 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: Need help with a Skin bug (
/showthread.php?tid=365771)
Need help with a Skin bug -
andrew2695 - 04.08.2012
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?
Re: Need help with a Skin bug -
[MM]RoXoR[FS] - 04.08.2012
Show your code
Re: Need help with a Skin bug -
[KHK]Khalid - 04.08.2012
Just set the skin under OnPlayerspawn.
Re: Need help with a Skin bug -
Devilxz97 - 04.08.2012
showcode plss
Respuesta: Re: Need help with a Skin bug -
HarlemSAMP - 04.08.2012
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?
Re: Respuesta: Re: Need help with a Skin bug -
[KHK]Khalid - 04.08.2012
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;
}
Respuesta: Re: Respuesta: Re: Need help with a Skin bug -
HarlemSAMP - 04.08.2012
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
Re : Need help with a Skin bug -
andrew2695 - 04.08.2012
Finaly I fixed it using onplayerdeath save skin and onplayerspawn setskin saved.