Why skin not changing
#1

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);
}
Reply
#2

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);
}
Reply
#3

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);
Reply
#4

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)