18.12.2015, 19:09
Buenas, cuando un usuario se registra y se desconecta guardo los datos en la base de datos bien, pero cuando vuelves a ingresar al juego al colocar tu contraseсa haces spawn por San Fierro en el mar, con skin de CJ y los datos del jugador en la base de datos queda en 0, asн tengo cuando entras al servidor nuevamente.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { case DIALOG_INGRESO: { if(response) { new query[520]; mysql_format(MySQL,query,sizeof(query),"SELECT * FROM `cuentas` WHERE `Nombre`='%s' AND `Password`='%s'",NombreJugador(playerid),inputtext); mysql_pquery(MySQL, query, "IngresoJugador","d", playerid); } else { Kick(playerid); } } } return 1; } forward IngresoJugador(playerid); public IngresoJugador(playerid) { if(cache_get_row_count() == 0) { ShowPlayerDialog(playerid, DIALOG_INGRESO, DIALOG_STYLE_INPUT, "Ingreso", "ЎError!\n\nLa contraseсa no es correcta.", "Continuar", "Cancelar"); } else { Informacion[playerid][pNivel] = cache_get_row_int(0, 4, MySQL); Informacion[playerid][pSkin] = cache_get_row_int(0, 5, MySQL); Informacion[playerid][pPosX] = cache_get_row_float(0, 6, MySQL); Informacion[playerid][pPosY] = cache_get_row_float(0, 7, MySQL); Informacion[playerid][pPosZ] = cache_get_row_float(0, 8, MySQL); Informacion[playerid][pSexo] = cache_get_row_int(0, 9, MySQL); Informacion[playerid][pVida] = cache_get_row_float(0, 10, MySQL); Informacion[playerid][pChaleco] = cache_get_row_float(0, 11, MySQL); Informacion[playerid][pFaccion] = cache_get_row_int(0, 12, MySQL); Informacion[playerid][pRango] = cache_get_row_int(0, 13, MySQL); Informacion[playerid][pTrabajo] = cache_get_row_int(0, 14, MySQL); Informacion[playerid][pDinero] = cache_get_row_int(0, 15, MySQL); Informacion[playerid][pInterior] = cache_get_row_int(0, 16, MySQL); Informacion[playerid][pVirtualWord] = cache_get_row_int(0, 17, MySQL); Informacion[playerid][pEdad] = cache_get_row_int(0, 18, MySQL); Informacion[playerid][pRaza] = cache_get_row_int(0, 19, MySQL); Informacion[playerid][pColorOjos] = cache_get_row_int(0, 20, MySQL); Informacion[playerid][pColorCabello] = cache_get_row_int(0, 21, MySQL); Informacion[playerid][pRegistrado] = cache_get_row_int(0, 22, MySQL); Informacion[playerid][pAngle] = cache_get_row_int(0, 23, MySQL); SetPVarInt(playerid, "PuedeIngresar", 1); IngresarJugador(playerid); } return 1; } forward IngresarJugador(playerid); public IngresarJugador(playerid) { SetSpawnInfo(playerid, 0, Informacion[playerid][pSkin], Informacion[playerid][pPosX],Informacion[playerid][pPosY],Informacion[playerid][pPosZ], Informacion[playerid][pAngle], 0,0,0,0,0,0); SpawnPlayer(playerid); SetPlayerHealth(playerid,Informacion[playerid][pVida]); SetPlayerArmour(playerid,Informacion[playerid][pChaleco]); GivePlayerMoney(playerid,Informacion[playerid][pDinero]); SetPlayerVirtualWorld(playerid,Informacion[playerid][pVirtualWord]); SetPlayerInterior(playerid,Informacion[playerid][pInterior]); SetPlayerSkin(playerid,Informacion[playerid][pSkin]); SetPlayerScore(playerid, Informacion[playerid][pNivel]); return 1; } public OnPlayerSpawn(playerid) { TextDrawShowForPlayer(playerid, Textdraw38); if(GetPVarInt(playerid, "PuedeIngresar") == 0) { Kick(playerid); } return 1; }