Skin Keeps Changing To CJ??
#1

Got quite a strange bug on my hands the players skin will set then quickly change to CJ upon spawning unless the player typed their password in incorrectly before logging in... I'm totally stumped here is the relevant code can anyone see any issues?

Login:
Код:
case dialogThreadLogin:
		{
			if(!response)
            {
                Kick(playerid);
            }
			if(response)
			{
				new query[256], EncryptedPass[130];
				
				WP_Hash(EncryptedPass, sizeof(EncryptedPass), inputtext);
				format(query, sizeof(query), "SELECT * FROM players WHERE pName = '%s' AND pPassword = '%s'", GetName(playerid), EncryptedPass);
				mysql_query(query);
				mysql_store_result();
				if(mysql_num_rows() > 0)
				{
					SendClientMessage(playerid, -1, "Logging in");
					LoginPlayer(playerid);
				}
				else
				{
					SendClientMessage(playerid, -1, "Incorrect Password!");
					ShowPlayerDialog(playerid, dialogThreadLogin, DIALOG_STYLE_INPUT, "Login", "Please login with the password you made", "Login", "Cancel");
				}
			}
		}
LoginPlayer():
Код:
stock LoginPlayer(playerid)
{
	new Float: Heal, Float: Arm,query[500], string[200];
	format(query, sizeof(query), "SELECT * FROM players WHERE pName = '%s'", GetName(playerid));
	mysql_query(query);
	mysql_store_result();
	while(mysql_fetch_row_format(query,"|"))
	{
		mysql_fetch_field_row(string, "pid"); Player[playerid][pID] = strval(string);
		mysql_fetch_field_row(Player[playerid][pName], "pName");
		mysql_fetch_field_row(Player[playerid][pPassword], "pPassword");
		mysql_fetch_field_row(string, "pAdminLevel"); Player[playerid][pAdminLevel] = strval(string);
		mysql_fetch_field_row(string, "pPlayerPos"); sscanf(string, "fff", Player[playerid][pPosition][0], Player[playerid][pPosition][1], Player[playerid][pPosition][2]);
		mysql_fetch_field_row(string, "pSkin"); Player[playerid][pSkin] = strval(string);
		mysql_fetch_field_row(string, "pMoney"); Player[playerid][pMoney] = strval(string);
		mysql_fetch_field_row(string, "pSavings"); Player[playerid][pSavings] = strval(string);
		mysql_fetch_field_row(string, "pPayCheck"); Player[playerid][pPayCheck] = strval(string);
		mysql_fetch_field_row(string, "pBank"); Player[playerid][pBank] = strval(string);
		mysql_fetch_field_row(string, "pBusiness"); Player[playerid][pBusiness] = strval(string);
		mysql_fetch_field_row(string, "pHealth"); Heal = floatstr(string);
		floatround(Heal, floatround_round);
		mysql_fetch_field_row(string, "pArmour"); Arm = floatstr(string);
		floatround(Arm, floatround_round);
		Player[playerid][pHealth] = Heal;
		Player[playerid][pArmour] = Arm;
		mysql_fetch_field_row(string, "pVip"); Player[playerid][pvStatus] = strval(string);
		mysql_fetch_field_row(string, "pMuted"); Player[playerid][pMuted] = strval(string);
		mysql_fetch_field_row(string, "pWarnings"); Player[playerid][pWarnings] = strval(string);
		mysql_fetch_field_row(string, "pWarningReasons"); sscanf(string, "p<|>s[126]s[126]s[126]", Player[playerid][pWarningReason1], Player[playerid][pWarningReason2], Player[playerid][pWarningReason3]);
		mysql_fetch_field_row(string, "pMins"); Player[playerid][pMins] = strval(string);
		mysql_fetch_field_row(string, "pHours"); Player[playerid][pHours] = strval(string);
		mysql_fetch_field_row(string, "pHouse"); Player[playerid][pHouse] = strval(string);
	}
	mysql_free_result();

	
	SetSpawnInfo(playerid, 0, Player[playerid][pSkin], Player[playerid][pPosition][0], Player[playerid][pPosition][1], Player[playerid][pPosition][2], 90, 0, 0, 0, 0, 0, 0);
	SetPlayerPos(playerid, Player[playerid][pPosition][0], Player[playerid][pPosition][1], Player[playerid][pPosition][2]);
	SetCameraBehindPlayer(playerid);
	SetPlayerHealth(playerid, Player[playerid][pHealth]);
	SetPlayerArmour(playerid, Player[playerid][pArmour]);
	SetPlayerInterior(playerid, 0);
	SetPlayerVirtualWorld(playerid, 0);
	GivePlayerMoney(playerid, Player[playerid][pMoney]);
	loadplayercars(playerid);
	SpawnPlayer(playerid);
	printf("%d",Player[playerid][pSkin]);
}
I know the skin is infact setting to the correct skin first as I have outputted Player[playerid][pSkin] and also you can see the correct on the player just as they spawn in a split second before it turns to CJ.

Many thanks in advance.
Markus
Reply
#2

Bump also tried putting a
SetPlayerSkin in after player spawns still CJ
Reply
#3

SetSpawnInfo. Take a closer look.
Reply
#4

Quote:
Originally Posted by Threshold
Посмотреть сообщение
SetSpawnInfo. Take a closer look.
Yes what about it?
Код:
(playerid, team, skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
Thats the parameters shown on the wiki which fits with mine?
Reply
#5

Wait, what does the console print 'pSkin' as?
Reply
#6

It prints out the correct ID as saved in the database in this case 245
Reply
#7

Replace this
PHP код:
        SpawnPlayer(playerid); 
Into this:
PHP код:
        SpawnPlayer(playerid);
        
SetPlayerSkin(playerid277); 
Sorry for double post
Reply
#8

Replace this
PHP код:
        SpawnPlayer(playerid); 
Into this:
PHP код:
        SpawnPlayer(playerid);
        
SetPlayerSkin(playeridpSkin); 
EDIT: Posted too fast
Reply
#9

Quote:
Originally Posted by kelvinis
Посмотреть сообщение
Replace this
PHP код:
        SpawnPlayer(playerid); 
Into this:
PHP код:
        SpawnPlayer(playerid);
        
SetPlayerSkin(playeridpSkin); 
EDIT: Posted too fast
Still stays as CJ unless you input your password incorrectly first time, truly stumped by this bug
Reply
#10

Quote:
Originally Posted by Markus_Whiteus
Посмотреть сообщение
Still stays as CJ unless you input your password incorrectly first time, truly stumped by this bug
Код:
public OnPlayerSpawn(playerid)
{
SetPlayerSkin( playerid, pSkin );
return 1;
}
or add SetPlayerSkin( playerid, pSkin ); this in onplayerspawn
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)