Function not calling
#1

I don't know why function OnDoorsLoad calling...

Code:
PHP Code:
CMD:door(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] < 3) return    SendClientMessage(playeridCOLOR_ORANGE"Error: {ffffff}You're not authorized to use this command.");
    new 
Float:xFloat:yFloat:z;
    new 
str[280],m[512];
    for(new 
1MAX_DOORSi++)
    {
      if(
DynamicDoor[i][dUsed] == 0)
      {
            
GetPlayerPos(playeridxyz);
            
DynamicDoor[i][dUsed] = 1;
            
DynamicDoor[i][posX] = x;
            
DynamicDoor[i][posY] = y;
            
DynamicDoor[i][posZ] = z;
            
DynamicDoor[i][dOutWorld] = GetPlayerVirtualWorld(playerid);
            
DynamicDoor[i][dOutInt] = GetPlayerInterior(playerid);
            
format(msizeof(m), "INSERT INTO doors (posX,posY,posZ,dOutWorld,dOutInt) VALUES ('%f','%f','%f','%i','%i')"DynamicDoor[i][posX],DynamicDoor[i][posY],DynamicDoor[i][posZ],DynamicDoor[i][dOutWorld],DynamicDoor[i][dOutInt]);
            
printf("%s"m);
            
mysql_function_query(dbhandle,m,true,"OnDoorsLoad","");
            
printf("%d"mysql_function_query(dbhandle,m,true,"OnDoorsLoad",""));
            
format(strsizeof(str), "Sucess: {ffffff}You created Door ID: %d."i);
            
SendClientMessage(playeridCOLOR_LIMEstr);
            return 
1;
       }
    }
       return 
1;

Data inserting in MYSQL but function not calling
Reply
#2

what's mysql_function_query (Show the definition)? Also show OnDoorsLoad
Reply
#3

Quote:
Originally Posted by SyS
View Post
what's mysql_function_query ? Also show OnDoorsLoad
mysql_function_query is now mysql_tquery

Code OnDoorsLoad
PHP Code:
public OnDoorsLoad()
{
    new 
num_fields,num_rows,str[512];
    
cache_get_data(num_rows,num_fields,dbhandle);
    if(!
num_rows)return 1;
    print(
"========================| Loading Doors |=========================");
    for(new 
i=1;i<sizeof(DynamicDoor);i++){
        
DestroyPickup(DynamicDoor[i][dPickup]);
        
DestroyPickup(DynamicDoor[i][dOPickup]);
        
Delete3DTextLabel(DynamicDoor[i][dLabel]);
    }
    for(new 
i=0i<num_rowsi++)
    {
        new 
id=GetFreeDoorID();
        
DynamicDoor[id][doorID]=id;
        
DynamicDoor[id][dUsed]=1;
        
DynamicDoor[id][doorSQLID]=cache_get_field_content_int(i"id"dbhandle);
        
DynamicDoor[id][posX]=cache_get_field_content_float(i"posX"dbhandle);
        
DynamicDoor[id][posX]=cache_get_field_content_float(i"posX"dbhandle);
        
DynamicDoor[id][posY]=cache_get_field_content_float(i"posY"dbhandle);
        
DynamicDoor[id][posZ]=cache_get_field_content_float(i"posZ"dbhandle);
        
DynamicDoor[id][posi][0]=cache_get_field_content_float(i"posiX"dbhandle);
        
DynamicDoor[id][posi][1]=cache_get_field_content_float(i"posiY"dbhandle);
        
DynamicDoor[id][posi][2]=cache_get_field_content_float(i"posiZ"dbhandle);
        
DynamicDoor[id][dBarOne]=cache_get_field_content_int(i"bar"dbhandle);
        
DynamicDoor[id][dTreasury]=cache_get_field_content_int(i"dTreasury"dbhandle);
        
DynamicDoor[id][dFee]=cache_get_field_content_int(i"dFee"dbhandle);
        
DynamicDoor[id][dOutWorld]=cache_get_field_content_int(i"dOutWorld"dbhandle);
        
DynamicDoor[id][dOutInt]=cache_get_field_content_int(i"dOutInt"dbhandle);
        
DynamicDoor[id][dOwner]=cache_get_field_content_int(i"dOwner"dbhandle);
        
DynamicDoor[id][dWorld]=cache_get_field_content_int(i"dWorld"dbhandle);
        
DynamicDoor[id][dInterior]=cache_get_field_content_int(i"dInterior"dbhandle);
        
DynamicDoor[id][dLock]=cache_get_field_content_int(i"dLock"dbhandle);
        
cache_get_field_content(i"dName"DynamicDoor[i][dName], dbhandle);
        
DynamicDoor[id][dPickup] = CreatePickup(12391DynamicDoor[id][posX], DynamicDoor[id][posY], DynamicDoor[id][posZ], -1);
        
DynamicDoor[id][dOPickup] = CreatePickup(12391DynamicDoor[id][posi][0], DynamicDoor[id][posi][1], DynamicDoor[id][posi][2], -1);
        
format(strsizeof(str), "%s\n{ffffff}Type /enter to enter."DynamicDoor[i][dName]);
        
DynamicDoor[id][dLabel] = CreateDynamic3DTextLabel(str ,COLOR_ORANGEDynamicDoor[id][posX], DynamicDoor[id][posY], DynamicDoor[id][posZ],30.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0, -1, -1, -17.0);
        
printf("Door %i[%i]: %f,%f,%f"DynamicDoor[id][doorSQLID],id,DynamicDoor[id][posX], DynamicDoor[id][posY], DynamicDoor[id][posZ]);
    }
    
printf("========================| Total Biz: %i |============================",num_rows);
    return 
1;

Reply
#4

Defination of mysq_function_query :
mysql_function_query( connectionHandle, query[], bool:cache, callback[], format[], {Float,_}:... )


Source: https://sampforum.blast.hk/showthread.php?tid=56564 (BlueG's post)
Reply
#5

You are performing INSERT query no result is returned
So basically your function is calling but it get stopped at if(!num_rows)return 1;
PHP Code:
public OnDoorsLoad()
{
    new 
num_fields,num_rows,str[512];
    
cache_get_data(num_rows,num_fields,dbhandle);
    if(!
num_rows)return 1;//here 
    //..............

as there are no rows returned num_rows is zero
Reply
#6

Quote:
Originally Posted by SyS
View Post
You are performing INSERT query no result is returned
So basically your function is calling but it get stopped at if(!num_rows)return 1;
PHP Code:
public OnDoorsLoad()
{
    new 
num_fields,num_rows,str[512];
    
cache_get_data(num_rows,num_fields,dbhandle);
    if(!
num_rows)return 1;//here 
    //..............

as there are no rows returned num_rows is zero
ahh shit, lemme change the code and try again, i will call select after inserting data?
Reply
#7

Fixed, thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)