[Ayuda] Guardado Datos -
Sergio_team - 09.03.2010
BUeno, es un problema que he tenido hace pocos dias, y me retrasa en sacar mi servidor de carreras unico, y bueno, la verdad, no se que pasa, el error es:
- Cuando el jugador es Admin se le buguea la cuenta y no le guarda los datos...
Este es el codigo generico de guardado de datos.
Quote:
public GuardarCuenta(playerid)
{
if(IsPlayerConnected(playerid))
{
MySQLCheck();
new query[MAX_STRING];
format(query, MAX_STRING, "UPDATE jugadoresracing SET ");
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Nivel", PlayerInfo[playerid][pLevel]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Registrado", PlayerInfo[playerid][pReg]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Dinero", PlayerInfo[playerid][pCash]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Puntos", PlayerInfo[playerid][pScore]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Coche1", PlayerInfo[playerid][pPcarkey]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Coche2", PlayerInfo[playerid][pPcarkey2]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Coche3", PlayerInfo[playerid][pPcarkey3]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Coche4", PlayerInfo[playerid][pPcarkey4]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Coche5", PlayerInfo[playerid][pPcarkey5]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CocheAct", PlayerInfo[playerid][CocheSec]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Admn", NivelAdmin[playerid]);
MySQLUpdateFinish(query, PlayerInfo[playerid][pSQLID]);
}
}
|
Y aqui cuando se conecta...
Quote:
new Data[3024];
new Field[64];
new rcnt = 1;
new pName1[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName1,sizeof(pName1));
format(query,sizeof(query),"SELECT * FROM `jugadoresracing` WHERE usuario = '%s' LIMIT 1", pName1);
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(Data);
samp_mysql_strtok(Field, "|", Data);
while (samp_mysql_strtok(Field, "|", "")==1)
{
if (rcnt == 3) PlayerInfo[playerid][pLevel] = strval(Field);
//if (rcnt == 4) NivelAdmin[playerid] = strval(Field);
if (rcnt == 5) PlayerInfo[playerid][pReg] = strval(Field);
if (rcnt == 6) PlayerInfo[playerid][pCash] = strval(Field);
if (rcnt == 7) PlayerInfo[playerid][pScore] = strval(Field);
if (rcnt == PlayerInfo[playerid][pPcarkey] = strval(Field);
if (rcnt == 9) PlayerInfo[playerid][pPcarkey2] = strval(Field);
if (rcnt == 10) PlayerInfo[playerid][pPcarkey3] = strval(Field);
if (rcnt == 11) PlayerInfo[playerid][pPcarkey4] = strval(Field);
if (rcnt == 12) PlayerInfo[playerid][pPcarkey5] = strval(Field);
if (rcnt == 13) PlayerInfo[playerid][CocheSec] = strval(Field);
if (rcnt == 14) NivelAdmin[playerid] = strval(Field);
rcnt++;
}
gPlayerSpawned[playerid] = 1;
SendClientMessage(playerid, COLOR_WHITE, "Te has conectado perfectamente");
format(string, sizeof(string), "Nivel Admin %d", NivelAdmin[playerid]);
SendClientMessage(playerid, COLOR_GRAD3, string);
JugadorConectadoTotalmente[playerid] = 1;
TogglePlayerSpectating(playerid, 0);
|
Porque me esta retrasando un huevo totalmente.
Y los mysqlupdateplayerint son los del moderntopia...
Re: [Ayuda] Guardado Datos -
SpanishMan - 10.03.2010
cuando te piden ayuda tu no ayudas -.-
esta re facil tu error
Re: [Ayuda] Guardado Datos -
Miguel - 10.03.2010
En mi opinion deberнa usar este plugin:
http://forum.sa-mp.com/index.php?topic=79352.0
Quote:
Originally Posted by Sergio_team
pawn Код:
new Data[3024]; new Field[64]; new rcnt = 1; new pName1[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName1,sizeof(pName1)); format(query,sizeof(query),"SELECT * FROM `jugadoresracing` WHERE usuario = '%s' LIMIT 1", pName1); samp_mysql_query(query); samp_mysql_store_result(); samp_mysql_fetch_row(Data); samp_mysql_strtok(Field, "|", Data); while (samp_mysql_strtok(Field, "|", "")==1) { if (rcnt == 3) PlayerInfo[playerid][pLevel] = strval(Field); //if (rcnt == 4) NivelAdmin[playerid] = strval(Field); if (rcnt == 5) PlayerInfo[playerid][pReg] = strval(Field); if (rcnt == 6) PlayerInfo[playerid][pCash] = strval(Field); if (rcnt == 7) PlayerInfo[playerid][pScore] = strval(Field); if (rcnt == 8) PlayerInfo[playerid][pPcarkey] = strval(Field); if (rcnt == 9) PlayerInfo[playerid][pPcarkey2] = strval(Field); if (rcnt == 10) PlayerInfo[playerid][pPcarkey3] = strval(Field); if (rcnt == 11) PlayerInfo[playerid][pPcarkey4] = strval(Field); if (rcnt == 12) PlayerInfo[playerid][pPcarkey5] = strval(Field); if (rcnt == 13) PlayerInfo[playerid][CocheSec] = strval(Field); if (rcnt == 14) NivelAdmin[playerid] = strval(Field); rcnt++; } gPlayerSpawned[playerid] = 1; SendClientMessage(playerid, COLOR_WHITE, "Te has conectado perfectamente"); format(string, sizeof(string), "Nivel Admin %d", NivelAdmin[playerid]); SendClientMessage(playerid, COLOR_GRAD3, string); JugadorConectadoTotalmente[playerid] = 1; TogglePlayerSpectating(playerid, 0);
|
pawn Код:
new Data[3024]; // <<<<<<<<------- lolwut!?
La variable data es demaciado pesada, es imposible que con lo poco que pusistes necesites cierta cantidad de espacio. Trata de calcular lo que vas a utilizar

.
Re: [Ayuda] Guardado Datos -
Sergio_team - 10.03.2010
Quote:
Originally Posted by SpanishMan
cuando te piden ayuda tu no ayudas -.-
esta re facil tu error 
|
OYe no estoi las 24h y no tengo todo el tiempo libre...., y si es tan facil dilo, xk sino va a ser k eres un puto troll que me conozco desde hace mucho tiempo.
No ha funcionado eso..
Re: [Ayuda] Guardado Datos -
CristianTdj - 10.03.2010
Quote:
Originally Posted by Sergio_team
Quote:
Originally Posted by SpanishMan
cuando te piden ayuda tu no ayudas -.-
esta re facil tu error 
|
OYe no estoi las 24h y no tengo todo el tiempo libre...., y si es tan facil dilo, xk sino va a ser k eres un puto troll que me conozco desde hace mucho tiempo.
No ha funcionado eso..
|
Bueno... dejen los insultos porfavor.
Re: [Ayuda] Guardado Datos -
CristianTdj - 10.03.2010
Quote:
Originally Posted by SpanishMan
cuando te piden ayuda tu no ayudas -.-
esta re facil tu error 
|
No postees tonterнas, limнtate a decir lo que sabes.
Re: [Ayuda] Guardado Datos -
Sergio_team - 14.03.2010
Error solventado, ya no hace falta que contesten.
Podeis Cerrar