HELP update strcat MYSQL
#1

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?

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.
838
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",\
837
pawn Код:
new query[128]; //query[128] is for formatting our query and Float:pos[3] is for getting and saving player's position
Reply
#2

You do not need to save everything at once all the time. How often does a player's admin level change? Once a month? Why bother saving it if it probably hasn't changed? Just update it immediately when it does change. Same goes for VIP levels. Same goes for the tutorial.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
You do not need to save everything at once all the time. How often does a player's admin level change? Once a month? Why bother saving it if it probably hasn't changed? Just update it immediately when it does change. Same goes for VIP levels. Same goes for the tutorial.
Good idea, that's true, I'll try to put it this way to run and then I'll split into parts rescues, because there are some things rarely change, I will put only when adiquirir something to change, thanks for the light


But does anyone know how I do to replace my code for strcat
Reply
#4

anyy?? i need this base!!! pls
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)