SA-MP Forums Archive
MySQL errors - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL errors (/showthread.php?tid=381379)



MySQL errors - MechaTech - 29.09.2012

I trying to make if a robber do something he will get 1+ point, so first I am going to test it in a command, but it has errors and I dont know how to fix it.

pawn Код:
CMD:skill(playerid,params[])
{
    new pname[24];
    new query[300];
    format(query, sizeof(query), "UPDATE playerdata SET copsskill=%d+1 WHERE user='%s'" PlayerInfo[playerid][pRobberskill], pname);
    mysql_query(query);
    return 1;
}
Код:
C:\Users\Magdy\Desktop\Games\Server 0.3e\gamemodes\[DG]CNR.pwn(4683) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\Magdy\Desktop\Games\Server 0.3e\gamemodes\[DG]CNR.pwn(4683) : warning 215: expression has no effect
C:\Users\Magdy\Desktop\Games\Server 0.3e\gamemodes\[DG]CNR.pwn(4683) : warning 215: expression has no effect
C:\Users\Magdy\Desktop\Games\Server 0.3e\gamemodes\[DG]CNR.pwn(4683) : error 001: expected token: ";", but found ")"
C:\Users\Magdy\Desktop\Games\Server 0.3e\gamemodes\[DG]CNR.pwn(4683) : error 029: invalid expression, assumed zero
C:\Users\Magdy\Desktop\Games\Server 0.3e\gamemodes\[DG]CNR.pwn(4683) : fatal error 107: too many error messages on one line



Re: MySQL errors - Camacorn - 29.09.2012

If you have a statistics saving stock, why not just do this:
Код:
Playerinfo[playerid][pRobberskill]=PlayerInfo[playerid][pRobberskill]+1;



Re: MySQL errors - Necro[ABK] - 29.09.2012

Код:
CMD:skill(playerid,params[]){
    new pname[24];
    new query[300];
    GetPlayerName(playerid,pname,sizeof(pname));
    PlayerInfo[playerid][pRobberskill]++;
    format(query, sizeof(query), "UPDATE `"playerdata"` SET `copsskill`='%i' WHERE `user`='%s'", PlayerInfo[playerid][pRobberskill], pname);
    mysql_query(query); 
    return 1;
}



Re: MySQL errors - Camacorn - 29.09.2012

Quote:
Originally Posted by Necro[ABK]
Посмотреть сообщение
Код:
CMD:skill(playerid,params[]){
    new pname[24];
    new query[300];
    GetPlayerName(playerid,pname,sizeof(pname));
    PlayerInfo[playerid][pRobberskill]++;
    format(query, sizeof(query), "UPDATE playerdata SET copsskill=%d WHERE user='%s'", PlayerInfo[playerid][pRobberskill], pname);
    mysql_query(query); 
    return 1;
}
That's a weird way to do it, just do it like this:

Код:
CMD:skill(playerid,params[]){
    new pname[24];
    new query[90];
    GetPlayerName(playerid,pname,sizeof(pname));
    format(query, sizeof(query), "UPDATE playerdata SET copsskill=%d WHERE user='%s'", PlayerInfo[playerid][pRobberskill]+1, pname);
    mysql_query(query); 
    return 1;
}



Re: MySQL errors - Necro[ABK] - 29.09.2012

my way isnt weird its perfecto but w/e