SA-MP Forums Archive
GetPlayerSkin Only returns 0 - 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: GetPlayerSkin Only returns 0 (/showthread.php?tid=599380)



[Fixed] GetPlayerSkin Only returns 0 [+Solution] - [DK]Dark_Knight - 25.01.2016

Hey guys,

Problem
- When using GetPlayerSkin under OnPlayerRequestSpawn it will only return 0.

Reason
- I was using the fixes include, which has a fix for GetPlayerSkin I read through the script and found that it is hooked into the original GetPlayerSkin but fixes doesn't set the skin variable that it returns until the player spawns.

Solution
1: Turn off the GetPlayerSkin in fixes
2: Set up an OnPlayerRequestSpawn in fixes
3: Don't use the fixes include


Original Message
Код:
Quick post, will add more info tomorrow (heading out)

I'm trying to use "GetPlayerSkin(playerid)" under "OnPlayerRequestSpawn(playerid)"
but it only returns 0;

I have tried commenting out almost everything but "printf("asdasd %i", GetPlayerSkin(playerid));" (Which is located under OnPlayerRequestSpawn)  and not only commented out in there, but in OnPlayerConnect, and almost the rest of the script (without it erroring).


I tried only adding one skin with skinID 100.  Still nothing.  
It shows in console asdasd 0. even though i spawned with the skin 100...
But when I create a single script by itself it works.

Код:
#include <a_samp>

main(){}

public OnPlayerRequestSpawn(playerid)
{
	printf("asdasd %i", GetPlayerSkin(playerid));
	return 1;
}


public OnGameModeInit()
{

	AddPlayerClass(265, 1958.3783, 1343.1572, 15.3746, 270.1425,0,0,0,0,-1,-1);

	return 1;
}
Works great. spawned with skin 265 and the printout sent asdasd 265.

Got me stumped.
What could be causing this? Plugins? Includes?

EDIT: I've narrowed it down to one of my includes. Will find out what one is causing it tomorrow and then investigate that include file. then post results.

WILL EDIT POST WITH MORE INFO TOMORROW!



Re: GetPlayerSkin Only returns 0 - Amunra - 25.01.2016

PHP код:
new Skinid GetPlayerSkin(playerid);
public 
OnPlayerRequestSpawn(playerid)
{
    
printf("asdasd %i"Skinid);
    return 
1;

Correct me if i wrong !


Re: GetPlayerSkin Only returns 0 - [DK]Dark_Knight - 26.01.2016

Quote:
Originally Posted by Amunra
Посмотреть сообщение
PHP код:
new Skinid GetPlayerSkin(playerid);
public 
OnPlayerRequestSpawn(playerid)
{
    
printf("asdasd %i"Skinid);
    return 
1;

Correct me if i wrong !
That would never work.

Fixed my problem, see first post for solution and reason behind problem.