forech
#1

How to fix this warring?

Код:
warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
PHP код:
foreach(Houses, hid) 
Reply
#2

Use this:

PHP код:
for(new hid = 0; hid < Houses; hid++)
{
  
// ...
} 
Reply
#3

Why they are given me this error? after put it?
Is there something wrong with your code?
PHP код:
error 017: undefined symbol "Houses" 
The code is

PHP код:
CMD:houseinfo(playerid, params[])
{
    for(new 
hid = 0; hid < Houses; hid++)
       { 
Reply
#4

Quote:
Originally Posted by Thanks
Посмотреть сообщение
Why they are given me this error? after put it?
Is there something wrong with your code?
PHP код:
error 017: undefined symbol "Houses" 
The code is

PHP код:
CMD:houseinfo(playerid, params[])
{
    for(new 
hid = 0; hid < Houses; hid++)
       { 
Because houses does not exist.
use:
Код:
#define Houses 1000
Above will loop 1000 times
Reply
#5

Quote:
Originally Posted by kovac
Посмотреть сообщение
Use this:

PHP код:
for(new hid = 0; hid < Houses; hid++)
{
  
// ...
} 
Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
Because houses does not exist.
use:
Код:
#define Houses 1000
Above will loop 1000 times
No. That's completely wrong, iterator is not a number.


This is an old foreach syntax, you need to replace it with the newest one:

PHP код:
foreach(new hid : Houses) 
Reply
#6

Thanks @iKarim
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)