17.02.2017, 12:27
Buenas he estado aсadiendo administracion a la gm base de kristian pero no se si lo tengo bien y tambien como aсado a la administracion a la data base es decir a la sql
haber aqui os dejare como lo tengo. PD:
Cuando le doy a copilar no me da ningun fallo
El jinfo
en Crear cuenta aqui creo que me falta algo
En ingreso jugador
En guardar jugador
ya no tengo nada mas
Aqui donde tengo el problema con el sq
Asi tengo el sql
lo puse asi y me dio fallos
estuve probando y probando y no doy como es
tambien cambie el INSERT INTO `cuentas` (`ID`, `Nombre`, `Contra`, `Ropa`, `X`, `Y`, `Z`, `Genero`, `Vida`, `Chaleco`, `Muertes`, `Asesinatos`, `Faccion`, `Rango`, `Trabajo`, `Dinero`, `Interior`, `VW`, `Edad`) VALUES y le aсadi el admin y tambien me dio fallos
haber aqui os dejare como lo tengo. PD:
Cuando le doy a copilar no me da ningun fallo
El jinfo
Код:
enum jInfo { Contra[128], Genero, Edad, Ropa, Admin, Float:X, Float:Y, Float:Z, Float:Vida, Float:Chaleco, Muertes, Asesinatos, Faccion, Rango, Trabajo, Dinero, Int, VW, Nivel }
Код:
public CrearCuenta(playerid) { new query[520],aviso[125]; mysql_format(MySQL, query, sizeof(query), "INSERT INTO `cuentas`(`Nombre`, `Contra`, `Ropa`, `X`, `Y`, `Z`, `Genero`, `Vida`, `Admin`, `Dinero`) VALUES ('%s','%s','%i','1484.1082', '-1668.4976', '14.9159','%i','100', '0', '100000')", NombreJugador(playerid), Jugador[playerid][Contra], Jugador[playerid][Ropa], Jugador[playerid][Genero]); mysql_query(MySQL, query); SCM(playerid,VERDECLARO,"ЎFelicitaciones! Registro completo."); SCM(playerid,-1,"Has completado el resgistro, bienvenido a el servidor, disfruta tu estadia."); SCM(playerid,-1, "Has recibido una bonificacion extra en tu cuenta por estar en nuestro comienzo."); format(aviso,sizeof(aviso),"Cuenta creada: %s - Edad: %d - Genero: %d", NombreJugador(playerid), Jugador[playerid][Edad], Jugador[playerid][Genero]); print(aviso); return 1; }
Quote:
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 { Jugador[playerid][Ropa] = cache_get_row_int(0, 3); Jugador[playerid][X] = cache_get_row_float(0, 4); Jugador[playerid][Y] = cache_get_row_float(0, 5); Jugador[playerid][Z] = cache_get_row_float(0, 6); Jugador[playerid][Admin] = cache_get_row_int(0, 13); Jugador[playerid][Genero] = cache_get_row_int(0, 7); Jugador[playerid][Vida] = cache_get_row_float(0, ![]() Jugador[playerid][Chaleco] = cache_get_row_float(0, 9); Jugador[playerid][Muertes] = cache_get_row_int(0, 10); Jugador[playerid][Asesinatos] = cache_get_row_int(0, 11); Jugador[playerid][Faccion] = cache_get_row_int(0, 12); Jugador[playerid][Rango] = cache_get_row_int(0, 13); Jugador[playerid][Trabajo] = cache_get_row_int(0, 14); Jugador[playerid][Dinero] = cache_get_row_int(0, 15); Jugador[playerid][Int] = cache_get_row_int(0, 16); Jugador[playerid][VW] = cache_get_row_int(0, 17); Jugador[playerid][Edad] = cache_get_row_int(0, 1 ![]() SetPVarInt(playerid, "PuedeIngresar", 1); IngresarJugador(playerid); } return 1; } |
Код:
public GuardarJugador(playerid) { new query[520],Float:jX,Float:jY,Float:jZ,Float:hp,Float:chale,pVW,pInt; GetPlayerPos(playerid, jX, jY, jZ); GetPlayerHealth(playerid,hp); GetPlayerArmour(playerid,chale); Jugador[playerid][VW] = GetPlayerVirtualWorld(playerid); Jugador[playerid][Int] = GetPlayerInterior(playerid); pVW = GetPlayerVirtualWorld(playerid); pInt = GetPlayerInterior(playerid); mysql_format(MySQL, query, sizeof(query), "UPDATE `cuentas` SET `Ropa`='%i',`X`='%f',`Y`='%f',ґAdminґ='%i',`Z`='%f',`Genero`='%i',`Vida`='%f',`Chaleco`='%f',`Muertes`='%i',`Asesinatos`='%i' WHERE `Nombre`='%s'", Jugador[playerid][Ropa], jX, jY, jZ, Jugador[playerid][Admin], Jugador[playerid][Genero], hp, chale, Jugador[playerid][Muertes], Jugador[playerid][Asesinatos], NombreJugador(playerid)); mysql_query(MySQL, query); // mysql_format(MySQL, query, sizeof(query), "UPDATE `cuentas` SET `Edad`='%i', `Faccion`='%i', `Rango`='%i', `Trabajo`='%i', `Dinero`='%i', Admin='%i' WHERE `Nombre`='%s'", Jugador[playerid][Edad], Jugador[playerid][Faccion], Jugador[playerid][Rango], Jugador[playerid][Admin], Jugador[playerid][Trabajo], Jugador[playerid][Dinero], NombreJugador(playerid)); mysql_query(MySQL, query); mysql_format(MySQL, query, sizeof(query), "UPDATE `cuentas` SET `VW`='%i', `Interior`='%i' WHERE `Nombre`='%s'", pVW, pInt, NombreJugador(playerid)); mysql_query(MySQL, query); return 1; }
Aqui donde tengo el problema con el sq
Asi tengo el sql
Код:
-- phpMyAdmin SQL Dump -- version 4.3.11 -- http://www.phpmyadmin.netnl67d123aca37ae...7.38131833-- Servidor: 127.0.0.1 -- Tiempo de generaciуn: 02-08-2015 a las 07:48:56 -- Versiуn del servidor: 5.6.24 -- Versiуn de PHP: 5.6.8 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Base de datos: `pcu` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `cuentas` -- CREATE TABLE IF NOT EXISTS `cuentas` ( `ID` int(11) NOT NULL, `Nombre` varchar(24) NOT NULL, `Contra` varchar(120) NOT NULL, `Ropa` int(3) NOT NULL, `X` float NOT NULL, `Y` float NOT NULL, `Z` float NOT NULL, `Genero` int(11) NOT NULL, `Vida` float NOT NULL, `Chaleco` float NOT NULL, `Muertes` int(11) NOT NULL, `Asesinatos` int(11) NOT NULL, `Faccion` int(11) NOT NULL, `Rango` int(11) NOT NULL, `Trabajo` int(11) NOT NULL, `Dinero` int(11) NOT NULL, `Interior` int(11) NOT NULL, `VW` int(11) NOT NULL, `Edad` int(11) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `cuentas` -- INSERT INTO `cuentas` (`ID`, `Nombre`, `Contra`, `Ropa`, `X`, `Y`, `Z`, `Genero`, `Vida`, `Chaleco`, `Muertes`, `Asesinatos`, `Faccion`, `Rango`, `Trabajo`, `Dinero`, `Interior`, `VW`, `Edad`) VALUES (1, 'demo', 'demo', 21, 0, 0, 0, 0, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0), (2, 'Ethan_Weasel', '12345', 46, 632.484, -571.93, 16.336, 0, 100, 0, 0, 0, 0, 0, 0, 100000, 0, 0, 0); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `facciones` -- CREATE TABLE IF NOT EXISTS `facciones` ( `ID` int(11) NOT NULL, `Nombre` varchar(120) NOT NULL, `Rango1` varchar(100) NOT NULL, `Rango2` varchar(100) NOT NULL, `Rango3` varchar(100) NOT NULL, `Rango4` varchar(100) NOT NULL, `Rango5` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `facciones` -- INSERT INTO `facciones` (`ID`, `Nombre`, `Rango1`, `Rango2`, `Rango3`, `Rango4`, `Rango5`) VALUES (1, 'Departamento Policial', 'Cadete', 'Oficial', 'Teniente', 'Coronel', 'General'); -- -- Нndices para tablas volcadas -- -- -- Indices de la tabla `cuentas` -- ALTER TABLE `cuentas` ADD UNIQUE KEY `ID` (`ID`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `cuentas` -- ALTER TABLE `cuentas` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Код:
-- phpMyAdmin SQL Dump -- version 4.3.11 -- http://www.phpmyadmin.netnl67d123aca37ae...7.38131833-- Servidor: 127.0.0.1 -- Tiempo de generaciуn: 02-08-2015 a las 07:48:56 -- Versiуn del servidor: 5.6.24 -- Versiуn de PHP: 5.6.8 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Base de datos: `pcu` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `cuentas` -- CREATE TABLE IF NOT EXISTS `cuentas` ( `ID` int(11) NOT NULL, `Nombre` varchar(24) NOT NULL, `Contra` varchar(120) NOT NULL, `Ropa` int(3) NOT NULL, `X` float NOT NULL, `Y` float NOT NULL, `Z` float NOT NULL, `Genero` int(11) NOT NULL, `Vida` float NOT NULL, `Chaleco` float NOT NULL, `Muertes` int(11) NOT NULL, `Asesinatos` int(11) NOT NULL, `Faccion` int(11) NOT NULL, `Admin` int(11) NOT NULL, `Rango` int(11) NOT NULL, `Trabajo` int(11) NOT NULL, `Dinero` int(11) NOT NULL, `Interior` int(11) NOT NULL, `VW` int(11) NOT NULL, `Edad` int(11) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `cuentas` -- INSERT INTO `cuentas` (`ID`, `Nombre`, `Contra`, `Ropa`, `X`, `Y`, `Z`, `Genero`, `Vida`, `Chaleco`, `Muertes`, `Asesinatos`, `Faccion`, `Rango`, `Trabajo`, `Dinero`, `Interior`, `VW`, `Edad`) VALUES (1, 'demo', 'demo', 21, 0, 0, 0, 0, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0), (2, 'Ethan_Weasel', '12345', 46, 632.484, -571.93, 16.336, 0, 100, 0, 0, 0, 0, 0, 0, 100000, 0, 0, 0); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `facciones` -- CREATE TABLE IF NOT EXISTS `facciones` ( `ID` int(11) NOT NULL, `Nombre` varchar(120) NOT NULL, `Rango1` varchar(100) NOT NULL, `Rango2` varchar(100) NOT NULL, `Rango3` varchar(100) NOT NULL, `Rango4` varchar(100) NOT NULL, `Rango5` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `facciones` -- INSERT INTO `facciones` (`ID`, `Nombre`, `Rango1`, `Rango2`, `Rango3`, `Rango4`, `Rango5`) VALUES (1, 'Departamento Policial', 'Cadete', 'Oficial', 'Teniente', 'Coronel', 'General'); -- -- Нndices para tablas volcadas -- -- -- Indices de la tabla `cuentas` -- ALTER TABLE `cuentas` ADD UNIQUE KEY `ID` (`ID`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `cuentas` -- ALTER TABLE `cuentas` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
tambien cambie el INSERT INTO `cuentas` (`ID`, `Nombre`, `Contra`, `Ropa`, `X`, `Y`, `Z`, `Genero`, `Vida`, `Chaleco`, `Muertes`, `Asesinatos`, `Faccion`, `Rango`, `Trabajo`, `Dinero`, `Interior`, `VW`, `Edad`) VALUES y le aсadi el admin y tambien me dio fallos
Код:
-- version 4.3.11 -- http://www.phpmyadmin.net -- -- Servidor: 127.0.0.1 -- Tiempo de generaciуn: 02-08-2015 a las 07:48:56 -- Versiуn del servidor: 5.6.24 -- Versiуn de PHP: 5.6.8 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Base de datos: `pcu` -- -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `cuentas` -- CREATE TABLE IF NOT EXISTS `cuentas` ( `ID` int(11) NOT NULL, `Nombre` varchar(24) NOT NULL, `Contra` varchar(120) NOT NULL, `Ropa` int(3) NOT NULL, `X` float NOT NULL, `Y` float NOT NULL, `Z` float NOT NULL, `Genero` int(11) NOT NULL, `Vida` float NOT NULL, `Chaleco` float NOT NULL, `Muertes` int(11) NOT NULL, `Asesinatos` int(11) NOT NULL, `Faccion` int(11) NOT NULL, `Admin` int(11) NOT NULL, `Rango` int(11) NOT NULL, `Trabajo` int(11) NOT NULL, `Dinero` int(11) NOT NULL, `Interior` int(11) NOT NULL, `VW` int(11) NOT NULL, `Edad` int(11) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `cuentas` -- INSERT INTO `cuentas` (`ID`, `Nombre`, `Contra`, `Ropa`, `X`, `Y`, `Z`, `Genero`, `Vida`, `Admin`, `Chaleco`, `Muertes`, `Asesinatos`, `Faccion`, `Rango`, `Trabajo`, `Dinero`, `Interior`, `VW`, `Edad`) VALUES (1, 'demo', 'demo', 21, 0, 0, 0, 0, 100, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0), (2, 'Ethan_Weasel', '12345', 46, 632.484, -571.93, 16.336, 0, 100, 0, 0, 0, 0, 0, 0, 100000, 0, 0, 0); -- -------------------------------------------------------- -- -- Estructura de tabla para la tabla `facciones` -- CREATE TABLE IF NOT EXISTS `facciones` ( `ID` int(11) NOT NULL, `Nombre` varchar(120) NOT NULL, `Rango1` varchar(100) NOT NULL, `Rango2` varchar(100) NOT NULL, `Rango3` varchar(100) NOT NULL, `Rango4` varchar(100) NOT NULL, `Rango5` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Volcado de datos para la tabla `facciones` -- INSERT INTO `facciones` (`ID`, `Nombre`, `Rango1`, `Rango2`, `Rango3`, `Rango4`, `Rango5`) VALUES (1, 'Departamento Policial', 'Cadete', 'Oficial', 'Teniente', 'Coronel', 'General'); -- -- Нndices para tablas volcadas -- -- -- Indices de la tabla `cuentas` -- ALTER TABLE `cuentas` ADD UNIQUE KEY `ID` (`ID`); -- -- AUTO_INCREMENT de las tablas volcadas -- -- -- AUTO_INCREMENT de la tabla `cuentas` -- ALTER TABLE `cuentas` MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;