SA-MP Forums Archive
Can You Help Me ? - 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: Can You Help Me ? (/showthread.php?tid=629823)



Can You Help Me ? - Jihanz - 04.03.2017

Can You Help me

My Function
PHP код:
public OnRumahLoad()
{
    new 
num_rows,num_fields;
    
cache_get_data(num_rows,num_fields,mysqlku);
    if(!
num_rows) return 1;
    for(new 
i=0i<num_rowsi++)
    {
        new 
id getRumahID();
        
rInfo[id][r_x] = cache_get_field_content_float(i,"r_x",mysqlku);
        
rInfo[id][r_y] = cache_get_field_content_float(i,"r_y",mysqlku);
        
rInfo[id][r_z] = cache_get_field_content_float(i,"r_z",mysqlku);
        
rInfo[id][ir_x] = cache_get_field_content_float(i,"ir_x",mysqlku);
        
rInfo[id][ir_y] = cache_get_field_content_float(i,"ir_y",mysqlku);
        
rInfo[id][ir_z] = cache_get_field_content_float(i,"ir_z",mysqlku);
        
rInfo[id][r_interior] = cache_get_field_content_int(i,"r_interior",mysqlku);
        
cache_get_field_content(i,"pemilik",rInfo[id][r_pemilik],mysqlku);
        
rInfo[id][r_id] = cache_get_field_content_int(i,"id",mysqlku);
    }
    return 
1;

i got this
Код:
D:\data aji\Samp server\gamemodes\tes.pwn(168) : warning 219: local variable "id" shadows a variable at a preceding level
D:\data aji\Samp server\gamemodes\tes.pwn(169) : warning 213: tag mismatch
D:\data aji\Samp server\gamemodes\tes.pwn(170) : warning 213: tag mismatch
D:\data aji\Samp server\gamemodes\tes.pwn(171) : warning 213: tag mismatch
D:\data aji\Samp server\gamemodes\tes.pwn(172) : warning 213: tag mismatch
D:\data aji\Samp server\gamemodes\tes.pwn(173) : warning 213: tag mismatch
D:\data aji\Samp server\gamemodes\tes.pwn(174) : warning 213: tag mismatch
D:\data aji\Samp server\gamemodes\tes.pwn(175) : warning 213: tag mismatch
D:\data aji\Samp server\gamemodes\tes.pwn(176) : warning 213: tag mismatch
D:\data aji\Samp server\gamemodes\tes.pwn(177) : warning 213: tag mismatch
D:\data aji\Samp server\gamemodes\tes.pwn(168) : warning 204: symbol is assigned a value that is never used: "id"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


11 Warnings.



Re: Can You Help Me ? - X337 - 04.03.2017

There's a variable with name "id" already in your script. You can't have two variables with the same name, you can simply fix "local variable "id" shadows a variable at a preceding level" warning by renaming the variable.
And for tag mismatch warnings, can you show the enum of "rInfo" variable?


Re: Can You Help Me ? - LEOTorres - 04.03.2017

You've already created a variable with the value "id", so the script will not detect the previous value you've created if you replace it for your new one, assuming you require the original for the execution of the code below but nevertheless, you should rename the variable created.

The output of cache_get_field_content_float has to be stored as a float such as the following:

Код:
new Float:example = cache_get_field_content_float (row, const field_name[], connectionHandle = 1)



Re: Can You Help Me ? - Jihanz - 04.03.2017

Quote:
Originally Posted by LEOTorres
Посмотреть сообщение
You've already created a variable with the value "id", so the script will not detect the previous value you've created if you replace it for your new one, assuming you require the original for the execution of the code below but nevertheless, you should rename the variable created.

The output of cache_get_field_content_float has to be stored as a float such as the following:

Код:
new Float:example = cache_get_field_content_float (row, const field_name[], connectionHandle = 1)
ITS WORKS THANKS A LOT REP+ FOR YOU