MySQL Problem..
#1

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 076syntax error in the expression, or invalid function call
C
:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(1246) : error 076syntax 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 012invalid function callnot a valid address
C
:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(26711) : warning 215expression has no effect
C
:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(26711) : error 001expected token";"but found ")"
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(26711) : error 029invalid expressionassumed zero
C
:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(26711) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB 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(Querysizeof(Query),"UPDATE `banneds` SET `ip` = '%s' WHERE `name` = '%s'",pIP(playerid),pName(playerid)); 
full code:
PHP код:
public BanCheck(playerid) {
    new 
rowsfields,ibanned[10][2],ifbanned[2],save[4][80],Query[250];
    
cache_get_data(rowsfieldsmysql);
    if(
rows)
    {
         
format(Querysizeof(Query),"UPDATE `banneds` SET `ip` = '%s' WHERE `name` = '%s'",pIP(playerid),pName(playerid));
         
mysql_tquery(mysqlQuery"""");
         
cache_get_field_content(0"banned"ibanned[0], mysql10);
         
ifbanned[0] = strval(ibanned[0]);
         if(
ifbanned[0] == 1) {
         
cache_get_field_content(0"date"save[0], mysql80);
         
cache_get_field_content(0"time"save[1], mysql80);
         
cache_get_field_content(0"bannedby"save[2], mysql80);
         
cache_get_field_content(0"reason"save[3], mysql80);
         new 
str[550],content[128]; format(content,sizeof content,"%s %s",save[0],save[1]);
         
format(strsizeof(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(playerid801DIALOG_STYLE_MSGBOX"{FF0000}You Are Banned!"str"Close","");
         
SetTimerEx("kickplayer"3000false"i"playerid);
         return 
1;
         } else if(
ifbanned[0] == 0) {
         
cache_get_field_content(0"tempban"ibanned[1], mysql10);
         
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(YearMonthDay);
         
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(Querysizeof(Query),"UPDATE `banneds` SET `tempban` = 0,`bannedby` = %d,`reason` = %d WHERE `name` = '%s'",0,0,pName(playerid));
           
mysql_tquery(mysqlQuery"""");
           
format(Query100"DELETE FROM `bannedips` WHERE `ip` = '%s'",pIP(playerid));
           
mysql_tquery(mysqlQuery"""");
           return 
SendClientMessage(playerid0x33FF33AA,"Ban BOT: |- Your Ban Has been Expired -|");
         }
         new 
saves[3][128],by[128],expire;
         
cache_get_field_content(0"date"saves[0], mysql128);
         
cache_get_field_content(0"time"saves[1], mysql128);
         
cache_get_field_content(0"reason"saves[2], mysql128);
         
cache_get_field_content(0"bannedby"bymysql128);
         
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(strsizeof(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(strsizeof(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(playerid801DIALOG_STYLE_MSGBOX"{FF0000}You Are Temporary Banned!"str"Close","");
         
SetTimerEx("kickplayer"3000false"i"playerid);
         return 
1;
         }
         }
         if(
ifbanned[1] == 0) {
             
banrows[playerid] = 1;
             
format(Querysizeof(Query), "SELECT * FROM `bannedips` WHERE `ip` = '%s'"pIP(playerid));
             
mysql_tquery(mysqlQuery"BanIPCheck""i"playerid);
         }
      }
       if(!
rows)
    {
     
format(Querysizeof(Query), "SELECT * FROM `bannedips` WHERE `ip` = '%s'"pIP(playerid));
     
mysql_tquery(mysqlQuery"BanIPCheck""i"playerid);
     }
    return 
1;

Reply
#2

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()'.
Reply
#3

Код:
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.
Reply
#4

PHP код:
         format(Querysizeof(Query),"UPDATE `banneds` SET `ip` = '%s' WHERE `name` = '%s'",pIP(playerid),pName(playerid)); 
Reply
#5

And also you shouldn't update the data by the players name, use the row id instead hence it is not changeable.
Reply
#6

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 012invalid function callnot a valid address
C
:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(19653) : warning 215expression has no effect
C
:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(19653) : error 001expected token";"but found ")"
C:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(19653) : error 029invalid expressionassumed zero
C
:\Users\PC\Desktop\Younes\-\Nouveau doss4ier\mysql.pwn(19653) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

Line:19653
whats wrong ?? i'm using MySQL R39-4
PHP код:
 format(Querysizeof(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)); 
Reply
#7

Update to MySQL r39-6, there are some bug fixes in it.

PHP код:
format(Querysizeof(Query), "UPDATE `banneds` SET `ip` = '%q', `date` = '%q', `time` = '%q', `bannedby` = '%q', `banned` = '%d', `reason` = '%q' WHERE `name` = '%q'"pIP(player1), strdatestrtimepName(playerid), 1tmp2pName(player1)); 
In the following query, what is the value of strdate, strtime and tmp2? Also use %q instead of %s where necessary.
Reply
#8

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)