SA-MP Forums Archive
MySQL help? - 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 help? (/showthread.php?tid=599693)



MySQL help? - Hellman92 - 29.01.2016

Код:
./includes/mysql.pwn(814) : warning 213: tag mismatch
./includes/mysql.pwn(814) : warning 215: expression has no effect
./includes/mysql.pwn(814) : error 001: expected token: ";", but found "["
./includes/mysql.pwn(814) : error 029: invalid expression, assumed zero
./includes/mysql.pwn(814) : warning 215: expression has no effect
./includes/mysql.pwn(814) : error 001: expected token: ";", but found "]"
./includes/mysql.pwn(814) : fatal error 107: too many error messages on one line
PHP код:
case LOADCAMP_THREAD:
        {
            if(
IsPlayerConnected(extraid))
            {
                new 
0;
                while(
rows)
                {
                    if(
>= MAX_KAMP)
                        break;
                    new 
szResult[32];
                    
                    
cache_get_field_content(i,  "Owner"szResultMainPipeline);
                    
CampInfo[extraid][i][cOwner] = strval(szResult); line 814
                    cache_get_field_content
(i"id"szResultMainPipeline);
                    
CampInfo[extraid][i][cID] = strval(szResult);
                    if(
CampInfo[extraid][i][cID] != 0)
                    {
                        
cache_get_field_content(i,  "cPosX"szResultMainPipeline);
                        
CampInfo[extraid][i][cPosition][0] = floatstr(szResult);
                        
cache_get_field_content(i,  "cPosY"szResultMainPipeline);
                        
CampInfo[extraid][i][cPosition][1] = floatstr(szResult);
                        
cache_get_field_content(i,  "cPosZ"szResultMainPipeline);
                        
CampInfo[extraid][i][cPosition][2] = floatstr(szResult);
                        
cache_get_field_content(i,  "cPosAngle"szResultMainPipeline);
                        
CampInfo[extraid][i][cPosition][3] = floatstr(szResult);
                        
cache_get_field_content(i,  "cLock"szResultMainPipeline);
                        
CampInfo[extraid][i][cLocked] = strval(szResult);
                        
                        
cache_get_field_content(i,  "cVirtualWorld"szResultMainPipeline);
                        
CampInfo[extraid][i][cVW] = strval(szResult);
                        
                        new 
szLog[128];
                        
format(szLogsizeof(szLog), "[CAMPLOAD] [User: %s(%i)] [Model: %d] [Vehicle ID: %d]"GetPlayerNameEx(extraid), PlayerInfo[extraid][pId]);
                        
Log("logs/vehicledebug.log"szLog);
                    }
                    else
                    {
                        new 
query[128];
                        
//format(query, sizeof(query), "DELETE FROM `vehicles` WHERE `id` = '%d'", CampInfo[extraid][i][pvSlotId]);
                        
mysql_function_query(MainPipelinequeryfalse"OnQueryFinish""ii"SENDDATA_THREADextraid);
                    }
                    
i++;
                }
            }
        } 



Re: MySQL help? - Shinja - 29.01.2016

Where is the line 814?


Re: MySQL help? - Hellman92 - 29.01.2016

Quote:
Originally Posted by Shinja
Посмотреть сообщение
Where is the line 814?
I already place that if u checked

EDIT: Sloved!


Re: MySQL help? - RoastBeef - 29.01.2016

Hi Hellman92,

please post the lines where you

1) declare CampInfo ( 'new CampInfo...' )

2) declare cOwner

Also post the function header.


Re: MySQL help? - AmigaBlizzard - 29.01.2016

Why read every field as a string, to convert it to a integer or float afterwards before it can be stored in a variable?
You should set your columns to the correct type and read it directly.
Cleaner and shorter code will be your result.

PHP код:
CampInfo[extraid][i][cOwner] = cache_get_field_content_int(i,  "Owner"MainPipeline);
CampInfo[extraid][i][cID] = cache_get_field_content_int(i"id"MainPipeline);
if(
CampInfo[extraid][i][cID] != 0)
{
    
CampInfo[extraid][i][cPosition][0] = cache_get_field_content_float(i,  "cPosX"MainPipeline);
    
CampInfo[extraid][i][cPosition][1] = cache_get_field_content_float(i,  "cPosY"MainPipeline);
    
CampInfo[extraid][i][cPosition][2] = cache_get_field_content_float(i,  "cPosZ"MainPipeline);
    
CampInfo[extraid][i][cPosition][3] = cache_get_field_content_float(i,  "cPosAngle"MainPipeline);
    
CampInfo[extraid][i][cLocked] = cache_get_field_content_int(i,  "cLock"MainPipeline);
    
CampInfo[extraid][i][cVW] = cache_get_field_content_int(i,  "cVirtualWorld"MainPipeline); 
Isn't this easier to read and follow?