I need some d*m* HELP [++REP]
#1

I use DINI!
Код:
PlayerSkin[playerid] = dini_Int(file,"Skin");
I use that now I need if PlayerSkin is bigger than it gives it it saved skin,but if skin is 0 it continues it's normal fu*** thing.
So if PlayerSkin is 0 it send a message,if it's bigger it loads the skin.
I REP....If you answear me quick I REP two times,once here and once tommorow
Reply
#2

Use if-statement to check if it's 0 or higher than it after you load it from the file:
pawn Код:
if(PlayerSkin[playerid] > 0) //If higher
{
    //Then...
}
else
{
    //If not higher than 0.
}
Reply
#3

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
Use if-statement to check if it's 0 or higher than it after you load it from the file:
pawn Код:
if(PlayerSkin[playerid] > 0) //If higher
{
    //Then...
}
else
{
    //If not higher than 0.
}
I get this error:
Код:
error 017: undefined symbol "file"
It's used all over the script but when I use it now it gives me this error

Код:
SetPlayerSkin(playerid,dini_Int(file,"Skin"));
It isn't defined but it gives me the error but when it's used everywhere else no error
Reply
#4

Sounds like you have a scope error.

Scope is basically the thing you're coding inside of. Whether that's an IF statement, CASE, a FUNCTION or if it is a GLOBAL/STATIC-access.

For example:
Код:
new red = 0;
if(red == 0)
{
  new blue = 2;
}
else
{
  blue = 1; // This would throw an error because blue is not defined in the scope of this ELSE container
}
In your case, file is not defined in that scope. So, here's what you can do --
1. Move the file handle up so it covers more than one scope (and subsequently covers the working scope)... or
2. Create a new file handle called file and use that handle to pass to the function.
Reply
#5

Quote:
Originally Posted by Lawbringer
Посмотреть сообщение
Sounds like you have a scope error.

Scope is basically the thing you're coding inside of. Whether that's an IF statement, CASE, a FUNCTION or if it is a GLOBAL/STATIC-access.

For example:
Код:
new red = 0;
if(red == 0)
{
  new blue = 2;
}
else
{
  blue = 1; // This would throw an error because blue is not defined in the scope of this ELSE container
}
In your case, file is not defined in that scope. So, here's what you can do --
1. Move the file handle up so it covers more than one scope (and subsequently covers the working scope)... or
2. Create a new file handle called file and use that handle to pass to the function.
I don't understand.Can you help a little more?With the 1. thing.Can you just send me script cuz really I don't understand.
Reply
#6

Umm I still need help
Reply
#7

Alright, think of it like this... (use the graphic i've made)



Let's say you make a new variable in the pink area. You would be able to use that variable in the red, blue, orange, and green because it's in a scope that contains all of those areas.

But, if you make a variable in the red area, you couldn't use it in the blue area unless you also make it in the blue area. If you only make a variable in the red area, you can use it in anything that is inside red - in this case, you could use it inside green. If you make a variable inside green, then you can use it only inside green.

Now, if you make a variable inside green, you can't use it inside red. Same with if you make one in red, you can't use it in pink.

Put this into code terms:
If you declare a variable x inside function f, you can't use x in another function g.

i.e.

Код:
// PINK would be our whole .pwn file

new G_VAR; // A variable declared outside here is called a field or a global variable - it can be used basically anywhere

public LolFunction()
{ // LolFunction would be like a RED
  new lolvar = 0; // This variable can be used anywhere inside LolFunction because it is a local variable
  if(lolvar == 1)
  { // This if statement is like a GREEN - it is inside RED
    new hey = 1; // This variable cannot be used inside RED (any level higher than this IF statement)
  }

  return 1;
}
Reply
#8

Quote:
Originally Posted by Lawbringer
Посмотреть сообщение
Alright, think of it like this... (use the graphic i've made)



Let's say you make a new variable in the pink area. You would be able to use that variable in the red, blue, orange, and green because it's in a scope that contains all of those areas.

But, if you make a variable in the red area, you couldn't use it in the blue area unless you also make it in the blue area. If you only make a variable in the red area, you can use it in anything that is inside red - in this case, you could use it inside green. If you make a variable inside green, then you can use it only inside green.

Now, if you make a variable inside green, you can't use it inside red. Same with if you make one in red, you can't use it in pink.

Put this into code terms:
If you declare a variable x inside function f, you can't use x in another function g.

i.e.

Код:
// PINK would be our whole .pwn file

new G_VAR; // A variable declared outside here is called a field or a global variable - it can be used basically anywhere

public LolFunction()
{ // LolFunction would be like a RED
  new lolvar = 0; // This variable can be used anywhere inside LolFunction because it is a local variable
  if(lolvar == 1)
  { // This if statement is like a GREEN - it is inside RED
    new hey = 1; // This variable cannot be used inside RED (any level higher than this IF statement)
  }

  return 1;
}
I don't get it!Can someone just give me code how it should look!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)