What is the problem in this loop?
#1

PHP Code:
                    for(new 14i++)
                    {
                        new 
p[128];
                        
format(p128"Rope%d"i);
                        if(
Player[playerid][p] != 0)
                        {
                        
                        }
                } 
What is the problem here? it's need to find the first one that not available.
but the problem with the format and the variable.
This is the error:
PHP Code:
error 033: array must be indexed (variable "p"
Reply
#2

pawn Code:
for(new i = 1; i < 4; i++)
                    {
                        new p[128];
                        format(p, 128, "Rope%d", i);
                        if(strcmp(p, "TEXT")//comparing the Two Strings
                        {
                       
                        }
                }
Reply
#3

But I need in the Player enum.
Player[playerid][p] <
Like:
Player[playerid][Rope1]
Player[playerid][Rope2]
Player[playerid][Rope3]

I want to check what isn't available, if its founded so will happend something.
Reply
#4

I'll give rep to the person that can help me.
Reply
#5

Someone?
Reply
#6

I'm not sure what exactly what should do but try
pawn Code:
for(new i = 1; i < 4; i++)
                    {
                        new p[128];
                        format(p, 128, "Rope%d", Player[playerid][i]);
                        if(Player[playerid][i] != 0)
                        {
                        SendClientMessage(playerid,-1,p);
                        }
                }
Reply
#7

Its not good, Its takes the number not the Ropenumber.
Reply
#8

tell exactly what its should do
Reply
#9

You could use Player[playerid][Rope][idx] and then the following code should work.
pawn Code:
for(new i = 1; i != 3; i++)
{
    if(Player[playerid][Rope][i] == 0) continue;
    //code goes here
}
And change
Player[playerid][Rope1]
Player[playerid][Rope2]
Player[playerid][Rope3]

To
Player[playerid][Rope][4]
in enum
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)