SA-MP Forums Archive
local variable "Random" shadows a variable at a preceding level - 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: local variable "Random" shadows a variable at a preceding level (/showthread.php?tid=640107)



local variable "Random" shadows a variable at a preceding level - Thanks - 28.08.2017

Some 3warrings...


PHP код:
new Random random(sizeof(RandomJailSpawns));
new 
Random random(sizeof(RandomJailSpawns));
new 
Random random(sizeof(RandomJailSpawns)); 
3warrings: WARRING: local variable "Random" shadows a variable at a preceding level

PHP код:
new Float:RandomJailSpawns[4][4] = {
    {
215.0879,110.2830,999.0156},
    {
219.1756,109.4038,999.0156},
    {
222.9073,110.0211,999.0156},
    {
226.7357,110.1853,999.0156}
}; 



Re: local variable "Random" shadows a variable at a preceding level - Shaheen - 28.08.2017

Try This.. [Delete 2 Random only one is enought to define it.]

PHP код:
new Random random(sizeof(RandomJailSpawns)); 

new 
Float:RandomJailSpawns[4][4] = { 
    {
215.0879,110.2830,999.0156}, 
    {
219.1756,109.4038,999.0156}, 
    {
222.9073,110.0211,999.0156}, 
    {
226.7357,110.1853,999.0156
}; 



Re: local variable "Random" shadows a variable at a preceding level - FreAkeD - 28.08.2017

You cant use a variable name like that more than once, so just change the names of them. Eg: random_1, random_2 and random_3 or however you want it.