Need Help With Player Variables
#2

pawn Код:
Line 119: if (GetPVarInt(playerid, "BSP") == 0)
Line 120    {
Line 121 - 134: //Part One Text
Line 135: SetPVarInt(playerid, "BSP", 1);
Line 136: }
Line 137: if (GetPVarInt(playerid, "BSP") == 1);
Line 121:   {
Line 121-(not done yet): //Part Two Text
Line ???: {
Line ???: SetPVarInt(playerid, "BSP", 2);
== equals to checking if a value is the same.
= equals to setting an value inside a variable.

Also, after an if-condition, you don't need to put ";", as you'll be closing the code after the if-statement while no code has been executed.

Even better would be:
pawn Код:
switch (GetPVarInt(playerid, "BSP"))
{
    case 0:
    {
        //Part One Text
        SetPVarInt(playerid, "BSP", 1);
    }
    case 1:
    {
        //Part Two Text
        SetPVarInt(playerid, "BSP", 2);
    }
}
Otherwise your code will just run through all conditions in one go, because you're setting the variable to the next value, and the next if-statement checks that value again, execuitng that code as well.
Using switch-case statements, you only execute one condition.
Reply


Messages In This Thread
Need Help With Player Variables - by Toxas - 06.12.2014, 13:32
Re: Need Help With Player Variables - by PowerPC603 - 06.12.2014, 13:48
Re: Need Help With Player Variables - by Capua - 06.12.2014, 13:52
Re: Need Help With Player Variables - by Toxas - 06.12.2014, 14:03
Re: Need Help With Player Variables - by Toxas - 06.12.2014, 14:09

Forum Jump:


Users browsing this thread: 1 Guest(s)