03.01.2015, 17:02
I followed some tutorials on the internet to spend my GM to MYSQL, but it seems that they are outdated
As far as I saw I need to change to strcat and split the query into parts, how I do it in my script?
838
837
As far as I saw I need to change to strcat and split the query into parts, how I do it in my script?
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if(Logado[playerid] == 1) {
SavePlayer(playerid);
}
new query[128]; //query[128] is for formatting our query and Float:pos[3] is for getting and saving player's position
mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `level`=%d, `maconha`=%d, `sementes`=%d, `BPsize`=%d, `wanted`=%d, `moneybag`=%d, `COPskills`=%d, `CRIMINALskills`=%d, `PARAMEDICskills`=%d, `admin`=%d, `kills`=%d, `deaths`=%d, `DP`=%d, `VIP`=%d, `fmembro`=%d, `fcargo`=%d, `preso`=%d, `presotime`=%d, `sementes`=%d, `startVIPdia`=%d, `startVIPmes`=%d, `startVIPano`=%d, `carid`=%d, `carpos0`=%f, `carpos1`=%f, `carpos2`=%f, `carpos3`=%f, `spawnpoint`=%d, `housekey`=%d, `idiom`=%d, `tutorial`=%d, WHERE `ID`=%d",\
scorelevel[playerid], maconha[playerid], sementes[playerid], BPsize[playerid], wanted[playerid], moneybag[playerid], COPskills[playerid], CRIMINALskills[playerid], PARAMEDICskills[playerid], admin[playerid], money[playerid], kills[playerid], deaths[playerid], DP[playerid], VIP[playerid], fmembro[playerid], fcargo[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], spawnpoint[playerid], housekey[playerid], idiom[playerid], tutorial[playerid], ID[playerid]);
//We update the table(`players`) by getting player's admin level, vip level, money, and positions and save them in the database
mysql_tquery(mysql, query, "", "");
//let's execute the query.
return 1;
}
pawn Код:
C:\Users\maikonsantos\Desktop\SAMP SERVER\gamemodes\copandrobbers.pwn(837) : error 075: input line too long (after substitutions)
C:\Users\maikonsantos\Desktop\SAMP SERVER\gamemodes\copandrobbers.pwn(838) : error 037: invalid string (possibly non-terminated string)
C:\Users\maikonsantos\Desktop\SAMP SERVER\gamemodes\copandrobbers.pwn(838) : error 017: undefined symbol "UPDATE"
C:\Users\maikonsantos\Desktop\SAMP SERVER\gamemodes\copandrobbers.pwn(838) : error 029: invalid expression, assumed zero
C:\Users\maikonsantos\Desktop\SAMP SERVER\gamemodes\copandrobbers.pwn(838) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
5 Errors.
pawn Код:
mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `level`=%d, `maconha`=%d, `sementes`=%d, `BPsize`=%d, `wanted`=%d, `moneybag`=%d, `COPskills`=%d, `CRIMINALskills`=%d, `PARAMEDICskills`=%d, `admin`=%d, `kills`=%d, `deaths`=%d, `DP`=%d, `VIP`=%d, `fmembro`=%d, `fcargo`=%d, `preso`=%d, `presotime`=%d, `sementes`=%d, `startVIPdia`=%d, `startVIPmes`=%d, `startVIPano`=%d, `carid`=%d, `carpos0`=%f, `carpos1`=%f, `carpos2`=%f, `carpos3`=%f, `spawnpoint`=%d, `housekey`=%d, `idiom`=%d, `tutorial`=%d, WHERE `ID`=%d",\
pawn Код:
new query[128]; //query[128] is for formatting our query and Float:pos[3] is for getting and saving player's position