MySQL - Undefined symbol "query"
#1

Hey guys,

Iґm working a bit on an Attack and Defend gamemode and I want to create a command to start arenas.

So I created a stock where I can load all the datas that Iґm about to set for the players.
But My Problem is that it keeps telling me that the query isnt defined (im not even sure if the query is reading it from the right db!)

The Warnings/errors
Quote:

C:\PeMfr\gamemodes\WarfieldNew.pwn(136 : error 017: undefined symbol "query"
C:\PeMfr\gamemodes\WarfieldNew.pwn(136 : error 017: undefined symbol "query"
C:\PeMfr\gamemodes\WarfieldNew.pwn(136 : error 029: invalid expression, assumed zero
C:\PeMfr\gamemodes\WarfieldNew.pwn(136 : fatal error 107: too many error messages on one line

And the codes

PHP код:
stock StartArena(playerid,ArenaID)
{
    new 
rowsfields;
    
ArenaID mysql_format(mysqlquerysizeof(query), "SELECT * FROM `arenas` WHERE `ID` = '%d' LIMIT 1"RoundInfo[playerid][ID]);
 
//Line 1368
//    ArenaID = cache_get_field_content_int(0, "ID");
    
if(rows)
    {
                
//let's format our query
                //We select all rows in the table that has your name and limit the result to 1
        
RoundInfo[playerid][ID] = cache_get_field_content_int(0"ID");
        
RoundInfo[playerid][BaseName] = cache_get_field_content_int(0"Name");
        
RoundInfo[playerid][Description] = cache_get_field_content_int(0"Description");
        
RoundInfo[playerid][Creater] = cache_get_field_content_int(0"Creater");
        
RoundInfo[playerid][Interior] = cache_get_field_content_int(0"Interior");
        
RoundInfo[playerid][aPosX] = cache_get_field_content_int(0"aPosX");
        
RoundInfo[playerid][aPosY] = cache_get_field_content_int(0"aPosY");
        
RoundInfo[playerid][aPosZ] = cache_get_field_content_int(0"aPosZ");
        
RoundInfo[playerid][aFacingAng] = cache_get_field_content_int(0"aFacingAng");
        
RoundInfo[playerid][dPosX] = cache_get_field_content_int(0"dPosX");
        
RoundInfo[playerid][dPosY] = cache_get_field_content_int(0"dPosY");
        
RoundInfo[playerid][dPosZ] = cache_get_field_content_int(0"dPosZ");
        
RoundInfo[playerid][dFacingAng] = cache_get_field_content_int(0"dFacingAng");
        
printf(query); //DEBUG
    
}
    return 
1;

PHP код:
CMD:start(playeridparams[])
{
    if(
pInfo[playerid][Admin] >= 3)
    {
        new 
Mode[64],BaseID;
        
//new string[128];
        
if(sscanf(params,"sd",Mode,BaseID))return SendClientMessage(playerid0xFFFFFFFF,"{FFFFFF}Usage:{791A1A} /start [base | arena | ffa | tdm | ctf] [ID]");
        if(
strcmp(Mode,"base",true))
        {
            
BuildMode[playerid] = 1;
        }
        if(
strcmp(Mode,"arena",true)) SendClientMessage(playerid,0xFFFFFFFF,"Loift garnicht gut Bruder!");
        {
            
StartArena(playerid,BaseID);
        }
        if(
strcmp(Mode,"ctf",true))
        {
            
BuildMode[playerid] = 1;
        }
        if(
strcmp(Mode,"tdm",true))
        {
            
BuildMode[playerid] = 1;
        }
        if(
strcmp(Mode,"ffa",true))
        {
            
BuildMode[playerid] = 1;
        }
        if(
strcmp(Mode,"off",true))
        {
            
BuildMode[playerid] = 0;
            
SpawnPlayer(playerid);
        }
    }
    else
    {
        
SendClientMessage(playerid,0xFFFFFFFF,"{FFFFFF}Error: {791A1A}Your Adminlevel is not high enough!");
    }
    return 
1;

Reply
#2

delete
Reply
#3

The error tells you exactly what's missing: your query variable.

I recommend you to read the following article:
https://sampwiki.blast.hk/wiki/Scripting_Basics

And find what you missed yourself as this is the best way to learn.
Reply
#4

Quote:
Originally Posted by Bible
Посмотреть сообщение
The error tells you exactly what's missing: your query variable.

I recommend you to read the following article:
https://sampwiki.blast.hk/wiki/Scripting_Basics

And find what you missed yourself as this is the best way to learn.
I already tried to redefine the query but it didnt work
I think Iґve gotta make a new Function that Iґve gotta forward just like in my Login/Register system.

But that gave me some other errors

Sum1 knows whats wrong?
Reply
#5

Quote:
Originally Posted by Saize
Посмотреть сообщение
I already tried to redefine the query but it didnt work
I think Iґve gotta make a new Function that Iґve gotta forward just like in my Login/Register system.

But that gave me some other errors

Sum1 knows whats wrong?
Feel free to share your compile log when using a public function instead of a stock function.
Why did you create it as a stock in the first place?
Reply
#6

Now Im doing it like this:

PHP код:
CMD:start(playeridparams[])
{
    if(
pInfo[playerid][Admin] >= 3)
    {
        new 
Mode[64],BaseID;
        
//new string[128];
        
if(sscanf(params,"sd",Mode,BaseID))return SendClientMessage(playerid0xFFFFFFFF,"{FFFFFF}Usage:{791A1A} /start [base | arena | ffa | tdm | ctf] [ID]");
        if(
strcmp(Mode,"base",true))
        {
            
BuildMode[playerid] = 1;
        }
        if(
strcmp(Mode,"arena",true)) SendClientMessage(playerid,0xFFFFFFFF,"Loift garnicht gut Bruder!");
        {
            new 
query[1024];
              
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `arenas` WHERE `ID` = '%d' LIMIT 1"RoundInfo[playerid][ID]);
            
mysql_tquery(mysqlquery"OnArenaLoad""i"playerid);
        }
        if(
strcmp(Mode,"ctf",true))
        {
            
BuildMode[playerid] = 1;
        }
        if(
strcmp(Mode,"tdm",true))
        {
            
BuildMode[playerid] = 1;
        }
        if(
strcmp(Mode,"ffa",true))
        {
            
BuildMode[playerid] = 1;
        }
        if(
strcmp(Mode,"off",true))
        {
            
BuildMode[playerid] = 0;
            
SpawnPlayer(playerid);
        }
    }
    else
    {
        
SendClientMessage(playerid,0xFFFFFFFF,"{FFFFFF}Error: {791A1A}Your Adminlevel is not high enough!");
    }
    return 
1;

PHP код:
public OnArenaLoad(playerid)
{
    
RoundInfo[playerid][ID] = cache_get_field_content_int(0"ID");
     
RoundInfo[playerid][BaseName] = cache_get_field_content_int(0"Interior"); //Line 1484
      
RoundInfo[playerid][Description] = cache_get_field_content_int(0"Admin");
       
RoundInfo[playerid][Creater] = cache_get_field_content_int(0"Kills");
    
RoundInfo[playerid][Interior] = cache_get_field_content_int(0"Deaths");
    
RoundInfo[playerid][aPosX] = cache_get_field_content_int(0"WeaponSlot1");
    
RoundInfo[playerid][aPosY] = cache_get_field_content_int(0"WeaponSlot1");
     
RoundInfo[playerid][aPosZ] = cache_get_field_content_int(0"WeaponSlot1");
      
RoundInfo[playerid][aFacingAng] = cache_get_field_content_int(0"WeaponAmmo1");
    
RoundInfo[playerid][dPosX] = cache_get_field_content_int(0"WeaponSlot1");
    
RoundInfo[playerid][dPosY] = cache_get_field_content_int(0"WeaponSlot1");
    
RoundInfo[playerid][dPosZ] = cache_get_field_content_int(0"WeaponSlot1");
    
RoundInfo[playerid][dFacingAng] = cache_get_field_content_int(0"WeaponAmmo1");
    return 
1;

And the Warnings/Errors

Quote:

C:\PeMfr\gamemodes\WarfieldNew.pwn(1484) : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(1485) : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(1486) : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(1486) : error 032: array index out of bounds (variable "RoundInfo")
C:\PeMfr\gamemodes\WarfieldNew.pwn(148 : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(148 : error 032: array index out of bounds (variable "RoundInfo")
C:\PeMfr\gamemodes\WarfieldNew.pwn(1491) : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(1491) : error 032: array index out of bounds (variable "RoundInfo")
C:\PeMfr\gamemodes\WarfieldNew.pwn(1492) : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(1492) : error 032: array index out of bounds (variable "RoundInfo")
C:\PeMfr\gamemodes\WarfieldNew.pwn(1493) : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(1493) : error 032: array index out of bounds (variable "RoundInfo")
C:\PeMfr\gamemodes\WarfieldNew.pwn(1494) : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(1494) : error 032: array index out of bounds (variable "RoundInfo")
C:\PeMfr\gamemodes\WarfieldNew.pwn(1496) : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(1496) : error 032: array index out of bounds (variable "RoundInfo")
C:\PeMfr\gamemodes\WarfieldNew.pwn(1497) : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(1497) : error 032: array index out of bounds (variable "RoundInfo")
C:\PeMfr\gamemodes\WarfieldNew.pwn(149 : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(149 : error 032: array index out of bounds (variable "RoundInfo")
C:\PeMfr\gamemodes\WarfieldNew.pwn(1499) : warning 213: tag mismatch
C:\PeMfr\gamemodes\WarfieldNew.pwn(1499) : error 032: array index out of bounds (variable "RoundInfo")

I dont understand why it isnt working, I just started learning MySQL and the Login/Registersystem works sweet but this just dont
Reply
#7

Can you show me your RoundInfo enumerator?
Reply
#8

Quote:
Originally Posted by Bible
Посмотреть сообщение
Can you show me your RoundInfo enumerator?
omg

Its all fine, I just copied the enum from another one iґve made and Iґve forgot to change it from

"new RoundInfo[MAX_PLAYERS][TEAMDATA];"
to ROUNDATA.


Iґm dumb, nvm
Reply
#9

Quote:
Originally Posted by Saize
Посмотреть сообщение
omg

Its all fine, I just copied the enum from another one iґve made and Iґve forgot to change it from

"new RoundInfo[MAX_PLAYERS][TEAMDATA];"
to ROUNDATA.


Iґm dumb, nvm
I already thought so and you are loading the player's position from a row called: 'weaponslot', that seems odd to me.
Reply
#10

Quote:
Originally Posted by Bible
Посмотреть сообщение
I already thought so and you are loading the player's position from a row called: 'weaponslot', that seems odd to me.
ahahaha ye I just copied it, now Iґve edited it gonna see if its working
@Edit: I wanna test if its working before Iґm creating a Build command but I cant enter floats with a dot Iґve gotta use commas, how can I evade this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)