[SOLVED] Pawno giving false errors
#1

My pawno is giving me false errors about certain variables "already being defined", although they are not. They are enclosed in their own brackets, like that:
Код:
if (blah)
{
    new shit;
    shit = 1;
}
if (blah2)
{
    new shit;
    shit = 2;
}
EDIT: Btw, if i don't make a new variable (just create it once), when the variable is used the server crashes -.-
Reply
#2

Код:
if (blah)
{
    new shit;
    shit = 1;
}
else if (blah2)
{
    new shit;
    shit = 2;
}
Reply
#3

if (blah)
{
new shit;
shit = 1;
}
else if (blah2)
{
new shit;
shit = 2;
}

or try to end it with return 1; like

if (blah)
{
new shit;
shit = 1;
return 1;
}
if (blah2)
{
new shit;
shit = 2;
return 1;
}
Reply
#4

That is not how pawno works, there shouldn't be a problem with variables intersecting if they are in their own brackets.
Reply
#5

if , or else if, cannot be returned or breaked.

@[FSaF]Jarno
use if and else if.

If it still does not work, create the variable outside of the if / else if, and configure it inside of the if / else if.
Reply
#6

Quote:
Originally Posted by next-studio|TheKiller
Посмотреть сообщение
if , or else if, cannot be returned or breaked.

@[FSaF]Jarno
use if and else if.
it can because look code like yours ...

Quote:

if(classid == 0 || classid == 1 || classid == 2)
{
gTeam[playerid] = GS;
GameTextForPlayer(playerid,"~b~Cripz",3000,5); // This will show up an Text , when you select your class
SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
SetPlayerFacingAngle(playerid,122.4500);
SetPlayerColor(playerid, COLOR_GS);
return 1;
}
else if(classid == 3 || classid == 4 || classid == 5)
{
gTeam[playerid] = Ballas;
GameTextForPlayer(playerid,"~r~Bloodz",3000,5); // This will show up an Text , when you select your class
SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
SetPlayerFacingAngle(playerid,122.4500);
SetPlayerColor(playerid,COLOR_Ballas);
return 1;
}

Reply
#7

they can be returned, that way it will skip the rest of the script like this:

shit = 1;
if (shit == 1) return 1; // This returns 1 so the script below won't be used
ass = 3;
shit = 2;
Reply
#8

They can be returned, but they will get returned automatically if the string / code / whatever is found / not found / whatever.
And why are you going to use more resources, for the codes which can be removed?

This is just what i think.
Reply
#9

This is not a problem like that, it's some kind of a glitch in pawno. I am a professional scripter and i know it's not a problem with that. (AND, i already tried it)
Reply
#10

Problem solved, (wasn't a problem with the script, the reason for this behavior still is a mystery, i renamed some variables and it started working.)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)