SA-MP Forums Archive
OnPlayerRequestClass shows no skins even while AddPlayerClass is used. - 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: OnPlayerRequestClass shows no skins even while AddPlayerClass is used. (/showthread.php?tid=657624)



OnPlayerRequestClass shows no skins, likely due to a variable not being assigned. - Aerotactics - 12.08.2018

So long story short, I updated a script, and now OnPlayerRequestClass doesn't work. ADDPLAYERCLASS IS WORKING. I recall having a similar issue in an RP script, but it was due to stats not saving. This is a MySQL script, and stats seem to be saving. Any advice?

EDIT: Stats ARE saving. The only thing not working is OnPlayerRequestClass.

EDIT 2: AddPlayerClass is added using a loop. the 3rd item in each section here is the Skin ID (See images):

EDIT 3: OK, this is strange behavior. I have a SetPlayerCameraPos at 459.339813, 2244.680419, 37.988002
However, the camera actually gets put at some old coordinates which were overwritten with these. WHY?! The old coordinates are not even in the script!

Код:
new const gTeam[][E_TEAM] =
{
	{
		"United Kingdom",
		0x5BC178FF, // Green
		124,
		{1112.5555,1893.9420,10.8203},
		{1067.1792,1874.2611,10.8203},
		{1056.7815,1959.6592,10.8203},
		{1016.9058, 1838.6093, 1134.1102, 2043.6521}
	},
	{
		"United States",
		0x4FB4F2FF, // Blue
		287,
		{-184.5609, 2756.9797, 62.6875},
		{-267.8232, 2671.0178, 62.6759},
		{-177.7588, 2691.3469, 62.6875},
		{-353.515625, 2574.21875, -113.28125, 2796.875}
	},
	{
		"Africa",
		0xFF6600FF,
		142,
		{-826.6808, 1447.5480, 14.0498},
		{-749.4841, 1596.6335, 27.1172},
		{-732.7656, 1546.1833, 38.9930},
		{-875.8406, 1389.667, -607.2495, 1623.225}
	},
	{
		"Australia",
		0x7D3093FF, // Purple
		248,
		{-1483.5421, 2645.1912, 58.7281},
		{-1472.9514, 2531.4434, 55.8359},
		{-1529.2646, 2584.8423, 55.8359},
		{-1640.625, 2501.953125, -1359.375, 2748.046875}
	},
	{
		"Russia",
		0x40E0D0FF, // Torquoise
		285,
		{-42.0783, 1154.6727, 19.7103},
		{-99.1854, 1086.7211, 19.7422},
		{-122.2590, 1165.3926, 19.7422},
		{-309.375, 1024.21875, 103.125, 1211.71875}
	}
};



Re: OnPlayerRequestClass shows no skins even while AddPlayerClass is used. - Aerotactics - 13.08.2018

Bump


Re: OnPlayerRequestClass shows no skins even while AddPlayerClass is used. - jlalt - 13.08.2018

Show the codes under
OnPlayerRequestClass callback?


Re: OnPlayerRequestClass shows no skins even while AddPlayerClass is used. - NoahF - 13.08.2018

Quote:
Originally Posted by jlalt
Посмотреть сообщение
Show the codes under
OnPlayerRequestClass callback?
I'm a developer of this script also, here is the OnPlayerRequestClass codes:
Код:
public OnPlayerRequestClass(playerid, classid)
{
	if(0 <= classid <= sizeof gTeam - 1)
	{
	    switch(classid)
	    {
	        case 0:
	        {
    			SetPlayerPos(playerid, 1092.692504, 1941.954956, 1.420313);
				SetPlayerCameraPos(playerid, 1092.692504, 1941.954956, 11.420313);
				SetPlayerCameraLookAt(playerid, 1040.901489, 1864.324218, 9.987780);
			}
	        case 1:
	        {
				SetPlayerPos(playerid, -231.188598, 2603.409179, 53.558605);
				SetPlayerCameraPos(playerid, -231.188598, 2603.409179, 63.558605);
				SetPlayerCameraLookAt(playerid, 175.056259, 2705.400634, 74.640449);
			}
			case 2:
	        {
				SetPlayerPos(playerid, -733.832153, 1550.123046, 31.302440);
				SetPlayerCameraPos(playerid, -733.832153, 1550.123046, 41.302440);
				SetPlayerCameraLookAt(playerid, -807.990234, 1573.501464, 27.960933);
			}
			case 3:
	        {
				SetPlayerPos(playerid, -1484.213134, 2575.567138, 47.835937);
				SetPlayerCameraPos(playerid, -1484.213134, 2575.567138, 57.835937);
				SetPlayerCameraLookAt(playerid, -1516.132812, 2520.624267, 56.091800);
			}
			case 4:
	        {
				SetPlayerPos(playerid, -180.885559, 1011.030151, 10.378807);
				SetPlayerCameraPos(playerid, -180.885559, 1011.030151, 20.378807);
				SetPlayerCameraLookAt(playerid, -208.458114, 1128.558105, 19.578804);
			}
			default:
	        {
				SetPlayerPos(playerid, 1092.692504, 1941.954956, 1.420313);
				SetPlayerCameraPos(playerid, 1092.692504, 1941.954956, 11.420313);
				SetPlayerCameraLookAt(playerid, 1040.901489, 1864.324218, 9.987780);
			}
		}
		SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
		SetPlayerSkin(playerid, gTeam[classid][TeamSkin]);
		new str[15];
		format(str, sizeof str, "%s", gTeam[classid][TeamName]);
		PlayerTextDrawSetString(playerid, TeamTD[playerid], str);
		PlayerTextDrawColor(playerid, TeamTD[playerid], gTeam[classid][TeamColor]);
		PlayerTextDrawShow(playerid, TeamTD[playerid]);
		SetPlayerTeam(playerid, classid);
		SetPlayerColor(playerid, gTeam[classid][TeamColor]);
		pTeam{playerid} = NO_TEAM;
		if(Dialog_Opened(playerid)) return Dialog_Close(playerid);
	}
	return 1;
}



Re: OnPlayerRequestClass shows no skins even while AddPlayerClass is used. - JasonRiggs - 13.08.2018

Alright, So, If you think that you have made the camera pos and camera look at well (must be logical) then the only problem that may happen is that there would be another code overwriting this one.. about the skin thing, can you explain more?


Re: OnPlayerRequestClass shows no skins even while AddPlayerClass is used. - NoahF - 13.08.2018

This bug is so abnormal, when you go in-game, I get the team names, but it doesn't do the SetCameraPos or any of those functions, and when I spawn, the skin is CJ, and it spawns me at coordinates 0,0,0. I've tried everything to fix it.


Re: OnPlayerRequestClass shows no skins even while AddPlayerClass is used. - Sew_Sumi - 13.08.2018

I think it'll come back to not using the classes correctly. Like the camera bug that someone had when they died in a car a month or 2 back.

I have been subbed from when the thread was made, as it was interesting that when I seen it initially, that I thought about that class/callback issue from the other thread. (It may even be 4-5 months back now, maybe more. But it was when they died in a vehicle, they'd end up with odd scenario for the camera after that. After that thread got posted, another thread came up 2 months later which was almost the same situation, but a slightly different symptom.)


Re: OnPlayerRequestClass shows no skins even while AddPlayerClass is used. - NoahF - 13.08.2018

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
I think it'll come back to not using the classes correctly. Like the camera bug that someone had when they died in a car a month or 2 back.

I have been subbed from when the thread was made, as it was interesting that when I seen it initially, that I thought about that class/callback issue from the other thread. (It may even be 4-5 months back now, maybe more. But it was when they died in a vehicle, they'd end up with odd scenario for the camera after that. After that thread got posted, another thread came up 2 months later which was almost the same situation, but a slightly different symptom.)
Can you post a link to that thread? At this point, anything will help. Thank you


Re: OnPlayerRequestClass shows no skins even while AddPlayerClass is used. - Sew_Sumi - 14.08.2018

https://sampforum.blast.hk/showthread.php?tid=649247

https://sampforum.blast.hk/showthread.php?tid=649822

Even though these are both to do with camera issues, it's to do with the initial 'state' of the gamemode setup I think.