21.03.2016, 22:04
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:
LoginPlayer():
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
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"); } } }
Код:
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]); }
Many thanks in advance.
Markus