PlayerSkin[playerid] = dini_Int(file,"Skin");
if(PlayerSkin[playerid] > 0) //If higher
{
//Then...
}
else
{
//If not higher than 0.
}
Use if-statement to check if it's 0 or higher than it after you load it from the file:
pawn Код:
|
error 017: undefined symbol "file"
SetPlayerSkin(playerid,dini_Int(file,"Skin"));
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 }
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 } 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. |
// 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; }
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; } |