SA-MP Forums Archive
warniiiing Help Me Pls - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: warniiiing Help Me Pls (/showthread.php?tid=492919)



warniiiing Help Me Pls - alishvasis - 06.02.2014

Hi.This Is My code :
Код:
public waitrob()
{
    new robpossible;
    robpossible = 1;
}
Give Me This Warning:

Код:
warning 204: symbol is assigned a value that is never used: "taskhirpossible"
What Can Id Do Help Me Tnx :Xx


Re: warniiiing Help Me Pls - PowerPC603 - 06.02.2014

It's because you define it, set a value in it, but it's never used.

Why create a variable and store a value in it if it won't get used anywhere to do something with it?

Either use the variable in an if-statement or whatever, or remove it.

It's like buying a coffee machine (new coffeemachine, using it to make coffee (coffeemachine = 1), and never drink to coffee you just made (if (coffeemachine == 1) SendClientMessage(playerid, -1 "You're drinking the coffee").
It's a waste.


Re: warniiiing Help Me Pls - alishvasis - 06.02.2014

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
It's because you define it, set a value in it, but it's never used.

Why create a variable and store a value in it if it won't get used anywhere to do something with it?

Either use the variable in an if-statement or whatever, or remove it.
How To Do Is? Pls Give Me Example I Rep You :Xx


Re: warniiiing Help Me Pls - PowerPC603 - 06.02.2014

pawn Код:
public waitrob()
{
    new robpossible;
    robpossible = 1;

    if (robpossible == 1)
    {
        SendClientMessageToAll(-1, "Robbing is possible");
    }
}
In this example, you're using the "robpossible" in an if-statement to do something with it, like send a message to all players.
Now the variable is "used" and you won't get that warning anymore.


Re: warniiiing Help Me Pls - Beckett - 06.02.2014

How are you defining it as robpossible and the warning is.
Код:
warning 204: symbol is assigned a value that is never used: "taskhirpossible"
This warning has nothing to do with this line, however that variable is not used, use it in a simple if statement as explained above ^


Re: warniiiing Help Me Pls - alishvasis - 06.02.2014

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
How are you defining it as robpossible and the warning is.
Код:
warning 204: symbol is assigned a value that is never used: "taskhirpossible"
This warning has nothing to do with this line, however that variable is not used, use it in a simple if statement as explained above ^
Tnx Fixed This :Xx