SA-MP Forums Archive
Why skin not changing - 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: Why skin not changing (/showthread.php?tid=634632)



Why skin not changing - akib - 23.05.2017

Hi,

I have a login register system. When player login it change player skin as system. But when register it not saving :/

Register Player Code:
Код:
forward OnPlayerRegister(playerid);
public OnPlayerRegister(playerid)
{
	// retrieves the ID generated for an AUTO_INCREMENT column by the sent query
	Player[playerid][ID] = cache_insert_id();

	ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Registration", "Account successfully registered, you have been automatically logged in.", "Okay", "");

	Player[playerid][IsLoggedIn] = true;

	Player[playerid][X_Pos] = DEFAULT_POS_X;
	Player[playerid][Y_Pos] = DEFAULT_POS_Y;
	Player[playerid][Z_Pos] = DEFAULT_POS_Z;
	Player[playerid][A_Pos] = DEFAULT_POS_A;
	SetTimer("spawn", 1000, false);
	return 1;
}
Spawn Code:
Код:
forward spawn(playerid);
public spawn(playerid)
{
	SetPlayerSkin(playerid,299);
	SetSpawnInfo(playerid, NO_TEAM, 0, Player[playerid][X_Pos], Player[playerid][Y_Pos], Player[playerid][Z_Pos], Player[playerid][A_Pos], 0, 0, 0, 0, 0, 0);
	SpawnPlayer(playerid);
	SetPlayerSkin(playerid,299);
}



Re: Why skin not changing - Antenastyle - 23.05.2017

Have you tried this:
Код:
forward spawn(playerid);
public spawn(playerid)
{
	SetSpawnInfo(playerid, NO_TEAM, 299, Player[playerid][X_Pos], Player[playerid][Y_Pos], Player[playerid][Z_Pos], Player[playerid][A_Pos], 0, 0, 0, 0, 0, 0);
	SpawnPlayer(playerid);
}



Re: Why skin not changing - Farzam - 23.05.2017

You are using a global timer which doesn't set anyone's Spawn info or skin because you didn't give the function the playerid.

Use
Код:
SetTimerEx("spawn",1000, false, "i", playerid);
instead of the global timer.

Код:
SetTimer("spawn", 1000, false);



Re: Why skin not changing - akib - 23.05.2017

Quote:
Originally Posted by Farzam
Посмотреть сообщение
You are using a global timer which doesn't set anyone's Spawn info or skin because you didn't give the function the playerid.

Use
Код:
SetTimerEx("spawn",1000, false, "i", playerid);
instead of the global timer.

Код:
SetTimer("spawn", 1000, false);
Thanks