[Ajuda] Problema saving MYSQL
#1

Nгo ta salvando! Pq!? Alguйm me ajuda a fixar PFVR

Atй tentei printar, mas sу printa o primeiro
"Salvou! 1"

Код:
stock OnPlayerSave(playerid) {
    new query[2500], ip[25];
    GetPlayerIp(playerid, ip, sizeof(ip));
    money[playerid] = GetPlayerMoneyEx(playerid);

    format(query, sizeof(query), "UPDATE `accounts` SET `Username` = '%s', `IP` = '%s', `scorelevel` = '%d', `maconha` = '%d', `material` = '%d', `sementes` = '%d', `BPsize` = '%d', `lastlogin` = '%d', `wanted` = '%d', `moneybag` = '%d', `COPskills` = '%d', `CRIMINALskills` = '%d', `PARAMEDICskills` = '%d', `admin` = '%d', `money` = '%d', `bank` = '%d', `kills` = '%d', `deaths` = '%d' WHERE `Username` = '%s' ",
    GetName(playerid),
    ip,
    scorelevel[playerid],
    maconha[playerid],
	material[playerid],
    sementes[playerid],
    BPsize[playerid],
    lastlogin[playerid],
    wanted[playerid],
    moneybag[playerid],
    COPskills[playerid],
    CRIMINALskills[playerid],
    PARAMEDICskills[playerid],
    admin[playerid],
    money[playerid],
    bank[playerid],
    kills[playerid],
    deaths[playerid],
    GetName(playerid));
	printf("Salvou! 1");
    mysql_pquery(ConnectMYSQL, query);

    format(query, sizeof(query), "UPDATE `accounts` SET `pistolSPAWN` = '%d', `shotgunSPAWN` = '%d', `submachineSPAWN` = '%d', `assaultSPAWN` = '%d', `sniperSPAWN` = '%d', `meleeSPAWN` = '%d', `carmtrunktype4` = '%d', `carmtrunktype5` = '%d' WHERE `Username` = '%s'",
    GetName(playerid),
    pistolSPAWN[playerid],
    shotgunSPAWN[playerid],
    submachineSPAWN[playerid],
    assaultSPAWN[playerid],
    sniperSPAWN[playerid],
    meleeSPAWN[playerid],
	MalaInfo[carid[playerid]][type4],
	MalaInfo[carid[playerid]][type5],
    GetName(playerid));
	printf("Salvou! 2");
    mysql_pquery(ConnectMYSQL, query);

    format(query, sizeof(query), "UPDATE `accounts` SET `DP` = '%d', `VIP` = '%d', `fmembro` = '%d', `preso` = '%d', `presotime` = '%d', `startVIPdia` = '%d', `startVIPmes` = '%d', `startVIPano` = '%d', `carid` = '%d', `carpos0` = '%f', `carpos1` = '%f', `carpos2` = '%f', `carpos3` = '%f' WHERE Username = '%s'",
    DP[playerid],
    VIP[playerid],
    fmembro[playerid],
    preso[playerid],
    presotime[playerid],
    startVIPdia[playerid],
    startVIPmes[playerid],
    startVIPano[playerid],
    carid[playerid],
    carpos[playerid][0],
    carpos[playerid][1],
    carpos[playerid][2],
    carpos[playerid][3],
    GetName(playerid) );
	printf("Salvou! 3");
    mysql_pquery(ConnectMYSQL, query);
	
    format(query, sizeof(query), "UPDATE `accounts` SET `carmtrunkarma1` = '%d', `carmtrunkarma2` = '%d', `carmtrunkarma3` = '%d', `carmtrunkarma4` = '%d', `carmtrunkarma5` = '%d', `carmtrunkbalas1` = '%d', `carmtrunkbalas2` = '%d', `carmtrunkbalas3` = '%d', `carmtrunkbalas4` = '%d', `carmtrunkbalas5` = '%d', `carmtrunktype1` = '%d', `carmtrunktype2` = '%d', `carmtrunktype3` = '%d' WHERE Username = '%s'",
    MalaInfo[carid[playerid]][arma1],
    MalaInfo[carid[playerid]][arma2],
    MalaInfo[carid[playerid]][arma3],
    MalaInfo[carid[playerid]][arma4],
    MalaInfo[carid[playerid]][arma5],
    MalaInfo[carid[playerid]][balas1],
    MalaInfo[carid[playerid]][balas2],
    MalaInfo[carid[playerid]][balas3],
    MalaInfo[carid[playerid]][balas4],
    MalaInfo[carid[playerid]][balas5],
    MalaInfo[carid[playerid]][type1],
    MalaInfo[carid[playerid]][type2],
    MalaInfo[carid[playerid]][type3],
    GetName(playerid) );
	printf("Salvou! 4");
    mysql_pquery(ConnectMYSQL, query);

    format(query, sizeof(query), "UPDATE `accounts` SET `spawnpoint` = '%d', `housekey` = '%d', `idiom` = '%d', `tutorial` = '%d', `banned` = '%d', `expirarban` = '%d', `morto` = '%d', `mortotime` = '%d' WHERE Username = '%s'",
    spawnpoint[playerid],
    housekey[playerid],
    idiom[playerid],
    tutorial[playerid],
    banned[playerid],
    expirarban[playerid],
	morto[playerid],
	mortotime[playerid],
    GetName(playerid) );
	printf("Salvou! 5");
    mysql_pquery(ConnectMYSQL, query);
}
Reply
#2

tenta ver esse tutorial http://*********/TMjhd95kAy8
Reply
#3

@maikons, Tente usar agora, com o debug feito por vocк, veio ao console as cinco mensagens, espero que funcione.
Код:
OnPlayerSave(playerid)
{
    new query[2500], ip[25];
    GetPlayerIp(playerid, ip, sizeof(ip));
    money[playerid] = GetPlayerMoneyEx(playerid);

    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `accounts` SET `Username` = '%s', `IP` = '%s', `scorelevel` = '%d', `maconha` = '%d', `material` = '%d', `sementes` = '%d', `BPsize` = '%d', `lastlogin` = '%d', `wanted` = '%d', `moneybag` = '%d', `COPskills` = '%d', `CRIMINALskills` = '%d', `PARAMEDICskills` = '%d', `admin` = '%d', `money` = '%d', `bank` = '%d', `kills` = '%d', `deaths` = '%d' WHERE `Username` = '%s' ",
    GetName(playerid),
    ip,
    scorelevel[playerid],
    maconha[playerid],
	material[playerid],
    sementes[playerid],
    BPsize[playerid],
    lastlogin[playerid],
    wanted[playerid],
    moneybag[playerid],
    COPskills[playerid],
    CRIMINALskills[playerid],
    PARAMEDICskills[playerid],
    admin[playerid],
    money[playerid],
    bank[playerid],
    kills[playerid],
    deaths[playerid],
    GetName(playerid));
	printf("Salvou! 1");
    mysql_tquery(ConnectMYSQL, query, "", "");

    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `accounts` SET `pistolSPAWN` = '%d', `shotgunSPAWN` = '%d', `submachineSPAWN` = '%d', `assaultSPAWN` = '%d', `sniperSPAWN` = '%d', `meleeSPAWN` = '%d', `carmtrunktype4` = '%d', `carmtrunktype5` = '%d' WHERE `Username` = '%s'",
    GetName(playerid),
    pistolSPAWN[playerid],
    shotgunSPAWN[playerid],
    submachineSPAWN[playerid],
    assaultSPAWN[playerid],
    sniperSPAWN[playerid],
    meleeSPAWN[playerid],
	MalaInfo[carid[playerid]][type4],
	MalaInfo[carid[playerid]][type5],
    GetName(playerid));
	printf("Salvou! 2");
    mysql_tquery(ConnectMYSQL, query, "", "");

    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `accounts` SET `DP` = '%d', `VIP` = '%d', `fmembro` = '%d', `preso` = '%d', `presotime` = '%d', `startVIPdia` = '%d', `startVIPmes` = '%d', `startVIPano` = '%d', `carid` = '%d', `carpos0` = '%f', `carpos1` = '%f', `carpos2` = '%f', `carpos3` = '%f' WHERE Username = '%s'",
    DP[playerid],
    VIP[playerid],
    fmembro[playerid],
    preso[playerid],
    presotime[playerid],
    startVIPdia[playerid],
    startVIPmes[playerid],
    startVIPano[playerid],
    carid[playerid],
    carpos[playerid][0],
    carpos[playerid][1],
    carpos[playerid][2],
    carpos[playerid][3],
    GetName(playerid) );
	printf("Salvou! 3");
    mysql_tquery(ConnectMYSQL, query, "", "");

    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `accounts` SET `carmtrunkarma1` = '%d', `carmtrunkarma2` = '%d', `carmtrunkarma3` = '%d', `carmtrunkarma4` = '%d', `carmtrunkarma5` = '%d', `carmtrunkbalas1` = '%d', `carmtrunkbalas2` = '%d', `carmtrunkbalas3` = '%d', `carmtrunkbalas4` = '%d', `carmtrunkbalas5` = '%d', `carmtrunktype1` = '%d', `carmtrunktype2` = '%d', `carmtrunktype3` = '%d' WHERE Username = '%s'",
    MalaInfo[carid[playerid]][arma1],
    MalaInfo[carid[playerid]][arma2],
    MalaInfo[carid[playerid]][arma3],
    MalaInfo[carid[playerid]][arma4],
    MalaInfo[carid[playerid]][arma5],
    MalaInfo[carid[playerid]][balas1],
    MalaInfo[carid[playerid]][balas2],
    MalaInfo[carid[playerid]][balas3],
    MalaInfo[carid[playerid]][balas4],
    MalaInfo[carid[playerid]][balas5],
    MalaInfo[carid[playerid]][type1],
    MalaInfo[carid[playerid]][type2],
    MalaInfo[carid[playerid]][type3],
    GetName(playerid) );
	printf("Salvou! 4");
    mysql_tquery(ConnectMYSQL, query, "", "");

    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `accounts` SET `spawnpoint` = '%d', `housekey` = '%d', `idiom` = '%d', `tutorial` = '%d', `banned` = '%d', `expirarban` = '%d', `morto` = '%d', `mortotime` = '%d' WHERE Username = '%s'",
    spawnpoint[playerid],
    housekey[playerid],
    idiom[playerid],
    tutorial[playerid],
    banned[playerid],
    expirarban[playerid],
	morto[playerid],
	mortotime[playerid],
    GetName(playerid) );
	printf("Salvou! 5");
    mysql_tquery(ConnectMYSQL, query, "", "");
}
Reply
#4

Quote:
Originally Posted by cicinho
Посмотреть сообщение
@maikons, Tente usar agora, com o debug feito por vocк, veio ao console as cinco mensagens, espero que funcione.
Код:
OnPlayerSave(playerid)
{
    new query[2500], ip[25];
    GetPlayerIp(playerid, ip, sizeof(ip));
    money[playerid] = GetPlayerMoneyEx(playerid);

    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `accounts` SET `Username` = '%s', `IP` = '%s', `scorelevel` = '%d', `maconha` = '%d', `material` = '%d', `sementes` = '%d', `BPsize` = '%d', `lastlogin` = '%d', `wanted` = '%d', `moneybag` = '%d', `COPskills` = '%d', `CRIMINALskills` = '%d', `PARAMEDICskills` = '%d', `admin` = '%d', `money` = '%d', `bank` = '%d', `kills` = '%d', `deaths` = '%d' WHERE `Username` = '%s' ",
    GetName(playerid),
    ip,
    scorelevel[playerid],
    maconha[playerid],
	material[playerid],
    sementes[playerid],
    BPsize[playerid],
    lastlogin[playerid],
    wanted[playerid],
    moneybag[playerid],
    COPskills[playerid],
    CRIMINALskills[playerid],
    PARAMEDICskills[playerid],
    admin[playerid],
    money[playerid],
    bank[playerid],
    kills[playerid],
    deaths[playerid],
    GetName(playerid));
	printf("Salvou! 1");
    mysql_tquery(ConnectMYSQL, query, "", "");

    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `accounts` SET `pistolSPAWN` = '%d', `shotgunSPAWN` = '%d', `submachineSPAWN` = '%d', `assaultSPAWN` = '%d', `sniperSPAWN` = '%d', `meleeSPAWN` = '%d', `carmtrunktype4` = '%d', `carmtrunktype5` = '%d' WHERE `Username` = '%s'",
    GetName(playerid),
    pistolSPAWN[playerid],
    shotgunSPAWN[playerid],
    submachineSPAWN[playerid],
    assaultSPAWN[playerid],
    sniperSPAWN[playerid],
    meleeSPAWN[playerid],
	MalaInfo[carid[playerid]][type4],
	MalaInfo[carid[playerid]][type5],
    GetName(playerid));
	printf("Salvou! 2");
    mysql_tquery(ConnectMYSQL, query, "", "");

    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `accounts` SET `DP` = '%d', `VIP` = '%d', `fmembro` = '%d', `preso` = '%d', `presotime` = '%d', `startVIPdia` = '%d', `startVIPmes` = '%d', `startVIPano` = '%d', `carid` = '%d', `carpos0` = '%f', `carpos1` = '%f', `carpos2` = '%f', `carpos3` = '%f' WHERE Username = '%s'",
    DP[playerid],
    VIP[playerid],
    fmembro[playerid],
    preso[playerid],
    presotime[playerid],
    startVIPdia[playerid],
    startVIPmes[playerid],
    startVIPano[playerid],
    carid[playerid],
    carpos[playerid][0],
    carpos[playerid][1],
    carpos[playerid][2],
    carpos[playerid][3],
    GetName(playerid) );
	printf("Salvou! 3");
    mysql_tquery(ConnectMYSQL, query, "", "");

    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `accounts` SET `carmtrunkarma1` = '%d', `carmtrunkarma2` = '%d', `carmtrunkarma3` = '%d', `carmtrunkarma4` = '%d', `carmtrunkarma5` = '%d', `carmtrunkbalas1` = '%d', `carmtrunkbalas2` = '%d', `carmtrunkbalas3` = '%d', `carmtrunkbalas4` = '%d', `carmtrunkbalas5` = '%d', `carmtrunktype1` = '%d', `carmtrunktype2` = '%d', `carmtrunktype3` = '%d' WHERE Username = '%s'",
    MalaInfo[carid[playerid]][arma1],
    MalaInfo[carid[playerid]][arma2],
    MalaInfo[carid[playerid]][arma3],
    MalaInfo[carid[playerid]][arma4],
    MalaInfo[carid[playerid]][arma5],
    MalaInfo[carid[playerid]][balas1],
    MalaInfo[carid[playerid]][balas2],
    MalaInfo[carid[playerid]][balas3],
    MalaInfo[carid[playerid]][balas4],
    MalaInfo[carid[playerid]][balas5],
    MalaInfo[carid[playerid]][type1],
    MalaInfo[carid[playerid]][type2],
    MalaInfo[carid[playerid]][type3],
    GetName(playerid) );
	printf("Salvou! 4");
    mysql_tquery(ConnectMYSQL, query, "", "");

    mysql_format(ConnectMYSQL, query, sizeof(query), "UPDATE `accounts` SET `spawnpoint` = '%d', `housekey` = '%d', `idiom` = '%d', `tutorial` = '%d', `banned` = '%d', `expirarban` = '%d', `morto` = '%d', `mortotime` = '%d' WHERE Username = '%s'",
    spawnpoint[playerid],
    housekey[playerid],
    idiom[playerid],
    tutorial[playerid],
    banned[playerid],
    expirarban[playerid],
	morto[playerid],
	mortotime[playerid],
    GetName(playerid) );
	printf("Salvou! 5");
    mysql_tquery(ConnectMYSQL, query, "", "");
}
Continua o msm problema no console sу printa
Salvou! 1
Reply
#5

@maikons, tenta agora, o que pode esta causando o erro pode ser este GetName no segundo format.
PHP код:
mysql_format(ConnectMYSQLquerysizeof(query), "UPDATE `accounts` SET `pistolSPAWN` = '%d', `shotgunSPAWN` = '%d', `submachineSPAWN` = '%d', `assaultSPAWN` = '%d', `sniperSPAWN` = '%d', `meleeSPAWN` = '%d', `carmtrunktype4` = '%d', `carmtrunktype5` = '%d' WHERE `Username` = '%s'",
    
GetName(playerid), //<< Esta setando pistolSPAWN
    
pistolSPAWN[playerid],
    
shotgunSPAWN[playerid],
    
submachineSPAWN[playerid],
    
assaultSPAWN[playerid],
    
sniperSPAWN[playerid],
    
meleeSPAWN[playerid],
    
MalaInfo[carid[playerid]][type4],
    
MalaInfo[carid[playerid]][type5],
    
GetName(playerid));
    
printf("Salvou! 2");
    
mysql_tquery(ConnectMYSQLquery""""); 
PHP код:
OnPlayerSave(playerid)
{
    new 
query[2500], ip[25];
    
GetPlayerIp(playeridipsizeof(ip));
    
money[playerid] = GetPlayerMoneyEx(playerid);
    
mysql_format(ConnectMYSQLquerysizeof(query), "UPDATE `accounts` SET `Username` = '%s', `IP` = '%s', `scorelevel` = '%d', `maconha` = '%d', `material` = '%d', `sementes` = '%d', `BPsize` = '%d', `lastlogin` = '%d', `wanted` = '%d', `moneybag` = '%d', `COPskills` = '%d', `CRIMINALskills` = '%d', `PARAMEDICskills` = '%d', `admin` = '%d', `money` = '%d', `bank` = '%d', `kills` = '%d', `deaths` = '%d' WHERE `Username` = '%s' ",
    
GetName(playerid),
    
ip,
    
scorelevel[playerid],
    
maconha[playerid],
    
material[playerid],
    
sementes[playerid],
    
BPsize[playerid],
    
lastlogin[playerid],
    
wanted[playerid],
    
moneybag[playerid],
    
COPskills[playerid],
    
CRIMINALskills[playerid],
    
PARAMEDICskills[playerid],
    
admin[playerid],
    
money[playerid],
    
bank[playerid],
    
kills[playerid],
    
deaths[playerid],
    
GetName(playerid));
    
printf("Salvou! 1");
    
mysql_tquery(ConnectMYSQLquery"""");
    
mysql_format(ConnectMYSQLquerysizeof(query), "UPDATE `accounts` SET `pistolSPAWN` = '%d', `shotgunSPAWN` = '%d', `submachineSPAWN` = '%d', `assaultSPAWN` = '%d', `sniperSPAWN` = '%d', `meleeSPAWN` = '%d', `carmtrunktype4` = '%d', `carmtrunktype5` = '%d' WHERE `Username` = '%s'",
    
pistolSPAWN[playerid],
    
shotgunSPAWN[playerid],
    
submachineSPAWN[playerid],
    
assaultSPAWN[playerid],
    
sniperSPAWN[playerid],
    
meleeSPAWN[playerid],
    
MalaInfo[carid[playerid]][type4],
    
MalaInfo[carid[playerid]][type5],
    
GetName(playerid));
    
printf("Salvou! 2");
    
mysql_tquery(ConnectMYSQLquery"""");
    
mysql_format(ConnectMYSQLquerysizeof(query), "UPDATE `accounts` SET `DP` = '%d', `VIP` = '%d', `fmembro` = '%d', `preso` = '%d', `presotime` = '%d', `startVIPdia` = '%d', `startVIPmes` = '%d', `startVIPano` = '%d', `carid` = '%d', `carpos0` = '%f', `carpos1` = '%f', `carpos2` = '%f', `carpos3` = '%f' WHERE Username = '%s'",
    
DP[playerid],
    
VIP[playerid],
    
fmembro[playerid],
    
preso[playerid],
    
presotime[playerid],
    
startVIPdia[playerid],
    
startVIPmes[playerid],
    
startVIPano[playerid],
    
carid[playerid],
    
carpos[playerid][0],
    
carpos[playerid][1],
    
carpos[playerid][2],
    
carpos[playerid][3],
    
GetName(playerid));
    
printf("Salvou! 3");
    
mysql_tquery(ConnectMYSQLquery"""");
    
mysql_format(ConnectMYSQLquerysizeof(query), "UPDATE `accounts` SET `carmtrunkarma1` = '%d', `carmtrunkarma2` = '%d', `carmtrunkarma3` = '%d', `carmtrunkarma4` = '%d', `carmtrunkarma5` = '%d', `carmtrunkbalas1` = '%d', `carmtrunkbalas2` = '%d', `carmtrunkbalas3` = '%d', `carmtrunkbalas4` = '%d', `carmtrunkbalas5` = '%d', `carmtrunktype1` = '%d', `carmtrunktype2` = '%d', `carmtrunktype3` = '%d' WHERE Username = '%s'",
    
MalaInfo[carid[playerid]][arma1],
    
MalaInfo[carid[playerid]][arma2],
    
MalaInfo[carid[playerid]][arma3],
    
MalaInfo[carid[playerid]][arma4],
    
MalaInfo[carid[playerid]][arma5],
    
MalaInfo[carid[playerid]][balas1],
    
MalaInfo[carid[playerid]][balas2],
    
MalaInfo[carid[playerid]][balas3],
    
MalaInfo[carid[playerid]][balas4],
    
MalaInfo[carid[playerid]][balas5],
    
MalaInfo[carid[playerid]][type1],
    
MalaInfo[carid[playerid]][type2],
    
MalaInfo[carid[playerid]][type3],
    
GetName(playerid));
    
printf("Salvou! 4");
    
mysql_tquery(ConnectMYSQLquery"""");
    
mysql_format(ConnectMYSQLquerysizeof(query), "UPDATE `accounts` SET `spawnpoint` = '%d', `housekey` = '%d', `idiom` = '%d', `tutorial` = '%d', `banned` = '%d', `expirarban` = '%d', `morto` = '%d', `mortotime` = '%d' WHERE Username = '%s'",
    
spawnpoint[playerid],
    
housekey[playerid],
    
idiom[playerid],
    
tutorial[playerid],
    
banned[playerid],
    
expirarban[playerid],
    
morto[playerid],
    
mortotime[playerid],
    
GetName(playerid));
    
printf("Salvou! 5");
    
mysql_tquery(ConnectMYSQLquery"""");

Reply
#6

Era besteira, consegui arrumar +rep!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)