MySQL Problem.. -
Younes44 - 16.12.2016
Hi..
i'm still learning mysql so don't judge me :P ( i'm ini scripter
)
anyway
PHP код:
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(1243) : error 076: syntax error in the expression, or invalid function call
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(1246) : error 076: syntax error in the expression, or invalid function call
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(26693) : warning 235: public function lacks forward declaration (symbol "Banip")
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(26706) : warning 235: public function lacks forward declaration (symbol "BanCheck")
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(26711) : error 012: invalid function call, not a valid address
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(26711) : warning 215: expression has no effect
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(26711) : error 001: expected token: ";", but found ")"
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(26711) : error 029: invalid expression, assumed zero
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(26711) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
7 Errors.
well.. is there wrong with my codes -_-
Line: 1243
PHP код:
PlayerInfo[i][Time] += 1;
Full code:
Код:
public PlayersData() {
foreach (new i : Player) {
if(IsPlayerConnected(i)) {
PlayerInfo[i][Time] += 1;
if(PlayerInfo[i][Registered] == 1 && PlayerInfo[i][LoggedIn] == 1) {
new Query[250];
format(Query, sizeof(Query),"UPDATE `accounts` SET `Score` = '%d',`Money` = '%d',`TimeOnServer` = '%d' WHERE `Name` = '%s'",GetPlayerScore(i),GetPlayerMoney(i),PlayerInfo[i][Time],pName(i));
mysql_tquery(mysql, Query, "", "");
}
}
}
}
And line 26711:
PHP код:
format(Query, sizeof(Query),"UPDATE `banneds` SET `ip` = '%s' WHERE `name` = '%s'",pIP(playerid),pName(playerid));
full code:
PHP код:
public BanCheck(playerid) {
new rows, fields,ibanned[10][2],ifbanned[2],save[4][80],Query[250];
cache_get_data(rows, fields, mysql);
if(rows)
{
format(Query, sizeof(Query),"UPDATE `banneds` SET `ip` = '%s' WHERE `name` = '%s'",pIP(playerid),pName(playerid));
mysql_tquery(mysql, Query, "", "");
cache_get_field_content(0, "banned", ibanned[0], mysql, 10);
ifbanned[0] = strval(ibanned[0]);
if(ifbanned[0] == 1) {
cache_get_field_content(0, "date", save[0], mysql, 80);
cache_get_field_content(0, "time", save[1], mysql, 80);
cache_get_field_content(0, "bannedby", save[2], mysql, 80);
cache_get_field_content(0, "reason", save[3], mysql, 80);
new str[550],content[128]; format(content,sizeof content,"%s %s",save[0],save[1]);
format(str, sizeof(str),"{C0C0C0}Your Account's currently Banned.\n\n{00FFFF}In-Game Name: {33FF33}%s\n{00FFFF}Administrator: {33FF33}%s\n{00FFFF}Date: {33FF33}%s\n{00FFFF}Reason: {33FF33}%s\n{C0C0C0}* if you think that you're banned wrongfully,\n feel free to make unban appeal on our forum: \n forum link: coming soon",pName(playerid),save[2],content,save[3]);
ShowPlayerDialog(playerid, 801, DIALOG_STYLE_MSGBOX, "{FF0000}You Are Banned!", str, "Close","");
SetTimerEx("kickplayer", 3000, false, "i", playerid);
return 1;
} else if(ifbanned[0] == 0) {
cache_get_field_content(0, "tempban", ibanned[1], mysql, 10);
ifbanned[1] = strval(ibanned[1]);
if(ifbanned[1] == 1) {
new whatdate;
whatdate = cache_get_field_content_int(0,"bdate",mysql);
new Year,Month,Day,tempbandate[3],string;
getdate(Year, Month, Day);
tempbandate[0] = 60 * 60 * 24 * Year;
tempbandate[1] = 60 * 60 * 24 * 30 * Month;
tempbandate[2] = 60 * 60 * 24 * Day;
string = tempbandate[0]+tempbandate[1]+tempbandate[2];
if(whatdate - string <= 0) {
format(Query, sizeof(Query),"UPDATE `banneds` SET `tempban` = 0,`bannedby` = %d,`reason` = %d WHERE `name` = '%s'",0,0,pName(playerid));
mysql_tquery(mysql, Query, "", "");
format(Query, 100, "DELETE FROM `bannedips` WHERE `ip` = '%s'",pIP(playerid));
mysql_tquery(mysql, Query, "", "");
return SendClientMessage(playerid, 0x33FF33AA,"Ban BOT: |- Your Ban Has been Expired -|");
}
new saves[3][128],by[128],expire;
cache_get_field_content(0, "date", saves[0], mysql, 128);
cache_get_field_content(0, "time", saves[1], mysql, 128);
cache_get_field_content(0, "reason", saves[2], mysql, 128);
cache_get_field_content(0, "bannedby", by, mysql, 128);
expire = cache_get_field_content_int(0, "bdate",mysql);
new str[550],content[128]; format(content,sizeof content,"%s %s",saves[0],saves[1]);
expire -= string;
expire /= 86400;
if(expire == 1) {
format(str, sizeof(str),"{C0C0C0}Your Account's currently Banned.\n\n{00FFFF}In-Game Name: {33FF33}%s\n{00FFFF}Administrator: {33FF33}%s\n{00FFFF}Date: {33FF33}%s\n{00FFFF}Reason: {33FF33}%s\n{00FFFF}Ban Expire After: {33FF33}%d Day\n{C0C0C0}* if you think that you're banned wrongfully,\n feel free to make unban appeal on our forum: \n forum link: comingsoon"\
,pName(playerid),by,content,saves[2],expire);
}
if(expire > 1) {
format(str, sizeof(str),"{C0C0C0}Your Account's currently Banned.\n\n{00FFFF}In-Game Name: {33FF33}%s\n{00FFFF}Administrator: {33FF33}%s\n{00FFFF}Date: {33FF33}%s\n{00FFFF}Reason: {33FF33}%s\n{00FFFF}Ban Expire After: {33FF33}%d Days\n{C0C0C0}* if you think that you're banned wrongfully,\n feel free to make unban appeal on our forum: \n forum link: comingsoon"\
,pName(playerid),by,content,saves[2],expire);
}
ShowPlayerDialog(playerid, 801, DIALOG_STYLE_MSGBOX, "{FF0000}You Are Temporary Banned!", str, "Close","");
SetTimerEx("kickplayer", 3000, false, "i", playerid);
return 1;
}
}
if(ifbanned[1] == 0) {
banrows[playerid] = 1;
format(Query, sizeof(Query), "SELECT * FROM `bannedips` WHERE `ip` = '%s'", pIP(playerid));
mysql_tquery(mysql, Query, "BanIPCheck", "i", playerid);
}
}
if(!rows)
{
format(Query, sizeof(Query), "SELECT * FROM `bannedips` WHERE `ip` = '%s'", pIP(playerid));
mysql_tquery(mysql, Query, "BanIPCheck", "i", playerid);
}
return 1;
}
Re: MySQL Problem.. -
Logic_ - 16.12.2016
Code is messed up as fuck, rewrite your code, it's copy paste from a script as it makes feel feel that I've read the same code in a gamemode.
Change your custom callbacks into functions, not stock, instead of 'public Ban()' use 'Ban()'.
Re: MySQL Problem.. -
X337 - 16.12.2016
Код:
syntax error in the expression, or invalid function call
Change "Time" into something else in PlayerInfo enum.
Код:
public function lacks forward declaration (symbol "Banip")
All public functions must be forwarded.
https://sampwiki.blast.hk/wiki/Public_functions
Код:
error 012: invalid function call, not a valid address
Show us the code on that line.
Re: MySQL Problem.. -
Younes44 - 16.12.2016
PHP код:
format(Query, sizeof(Query),"UPDATE `banneds` SET `ip` = '%s' WHERE `name` = '%s'",pIP(playerid),pName(playerid));
Re: MySQL Problem.. -
Runn3R - 16.12.2016
And also you shouldn't update the data by the players name, use the row id instead hence it is not changeable.
Re: MySQL Problem.. -
Younes44 - 16.12.2016
But i try to avoid this error.. i've added other codes.. and same errors
PHP код:
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(19653) : error 012: invalid function call, not a valid address
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(19653) : warning 215: expression has no effect
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(19653) : error 001: expected token: ";", but found ")"
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(19653) : error 029: invalid expression, assumed zero
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(19653) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
Line:19653
whats wrong ?? i'm using MySQL R39-4
PHP код:
format(Query, sizeof(Query), "UPDATE `banneds` SET `ip` = '%s', `date` = '%s', `time` = '%s', `bannedby` = '%s', `banned` = '%d', `reason` = '%s' WHERE `name` = '%s'", pIP(player1),strdate,strtime,pName(playerid),1,tmp2,pName(player1));
Re: MySQL Problem.. -
Logic_ - 17.12.2016
Update to MySQL r39-6, there are some bug fixes in it.
PHP код:
format(Query, sizeof(Query), "UPDATE `banneds` SET `ip` = '%q', `date` = '%q', `time` = '%q', `bannedby` = '%q', `banned` = '%d', `reason` = '%q' WHERE `name` = '%q'", pIP(player1), strdate, strtime, pName(playerid), 1, tmp2, pName(player1));
In the following query, what is the value of strdate, strtime and tmp2? Also use
%q instead of
%s where necessary.
Re: MySQL Problem.. -
Younes44 - 17.12.2016
well same..
between i've just changed ban system to mysql (accounts not yet :P )
i'll try to update mysql to R39-6( or 40)