SA-MP Forums Archive
Need help with these anoying error, thanks for all responses. :( - 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: Need help with these anoying error, thanks for all responses. :( (/showthread.php?tid=474995)



Need help with these anoying error, thanks for all responses. :( - Riwerry - 10.11.2013

Hello guys, I am making system to save weapons into slots in cars. I can't really know what is with "else" function, it gives an errors.

ERRORS:
C:\Users\Jakub\Desktop\Las Venturas Roleplay\gamemodes\LVRP.pwn(437) : error 029: invalid expression, assumed zero
C:\Users\Jakub\Desktop\Las Venturas Roleplay\gamemodes\LVRP.pwn(437 -- 43 : warning 215: expression has no effect
C:\Users\Jakub\Desktop\Las Venturas Roleplay\gamemodes\LVRP.pwn(43 : error 001: expected token: ";", but found "if"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

pawn Код:
if(listitem == 0)
                {
                    GetPlayerWeaponData(playerid, 1, WeaponInfo[playerid][Weapon1], WeaponInfo[playerid][Weapon1a]);
                    GetPlayerWeaponData(playerid, 2, WeaponInfo[playerid][Weapon2], WeaponInfo[playerid][Weapon2a]);
                    GetPlayerWeaponData(playerid, 3, WeaponInfo[playerid][Weapon3], WeaponInfo[playerid][Weapon3a]);
                    GetPlayerWeaponData(playerid, 4, WeaponInfo[playerid][Weapon4], WeaponInfo[playerid][Weapon4a]);
                    GetPlayerWeaponData(playerid, 5, WeaponInfo[playerid][Weapon5], WeaponInfo[playerid][Weapon5a]);
                    GetPlayerWeaponData(playerid, 6, WeaponInfo[playerid][Weapon6], WeaponInfo[playerid][Weapon6a]);
                    GetPlayerWeaponData(playerid, 7, WeaponInfo[playerid][Weapon7], WeaponInfo[playerid][Weapon7a]);
                    GetPlayerWeaponData(playerid, 8, WeaponInfo[playerid][Weapon8], WeaponInfo[playerid][Weapon8a]);
                    GetPlayerWeaponData(playerid, 9, WeaponInfo[playerid][Weapon9], WeaponInfo[playerid][Weapon9a]);
                    GetPlayerWeaponData(playerid, 10, WeaponInfo[playerid][Weapon10], WeaponInfo[playerid][Weapon10a]);
                    GetPlayerWeaponData(playerid, 11, WeaponInfo[playerid][Weapon11], WeaponInfo[playerid][Weapon11a]);
                    GetPlayerWeaponData(playerid, 12, WeaponInfo[playerid][Weapon12], WeaponInfo[playerid][Weapon12a]);
                    new INI:PouzivatelovSubor2 = INI_Open (PouzivateloveUmiestnenie2 (playerid));
                    INI_SetTag (PouzivatelovSubor2, "Guns");
                    INI_WriteInt (PouzivatelovSubor2, "Slot1", WeaponInfo[playerid][Weapon1]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot1ammo", WeaponInfo[playerid][Weapon1a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot2", WeaponInfo[playerid][Weapon2]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot2ammo", WeaponInfo[playerid][Weapon2a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot3", WeaponInfo[playerid][Weapon3]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot3ammo", WeaponInfo[playerid][Weapon3a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot4", WeaponInfo[playerid][Weapon4]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot4ammo", WeaponInfo[playerid][Weapon4a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot5", WeaponInfo[playerid][Weapon5]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot5ammo", WeaponInfo[playerid][Weapon5a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot6", WeaponInfo[playerid][Weapon6]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot6ammo", WeaponInfo[playerid][Weapon6a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot7", WeaponInfo[playerid][Weapon7]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot7ammo", WeaponInfo[playerid][Weapon7a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot8", WeaponInfo[playerid][Weapon8]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot8ammo", WeaponInfo[playerid][Weapon8a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot9", WeaponInfo[playerid][Weapon9]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot9ammo", WeaponInfo[playerid][Weapon9a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot10", WeaponInfo[playerid][Weapon10]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot10ammo", WeaponInfo[playerid][Weapon10a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot11", WeaponInfo[playerid][Weapon11]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot11ammo", WeaponInfo[playerid][Weapon11a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot12", WeaponInfo[playerid][Weapon12]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot12ammo", WeaponInfo[playerid][Weapon12a]);
                    INI_Close (PouzivatelovSubor2);
                        ResetPlayerWeapons(playerid);
                    SendClientMessage(playerid, 0xFFFFFF, "You successfully saved weapon to slot 1!");
                    SlotTaken = 1;
                    else //LINE 437
                    if(SlotTaken == 1) //LINE 438
                                        SendClientMessage(playerid, 0xFFFFFF, "In this slot is weapon already saved!");
                }
                else if(listitem == 1)
                {
                    SendClientMessage(playerid,0xFFFFFFFF,"Uloћil jsi zbraт do slotu 2");
                }
                else if(listitem == 2)
                {
                    SendClientMessage(playerid,0xFFFFFFFF,"Uloћil jsi zbraт do slotu 3");
                }
            }
        }
    }
    return true;
}



Re: Need help with these anoying error, thanks for all responses. :( - BizzyD - 10.11.2013

What is line 437


Re: Need help with these anoying error, thanks for all responses. :( - Riwerry - 10.11.2013

The "else"
438 is under it.


Re: Need help with these anoying error, thanks for all responses. :( - DexterC - 10.11.2013

Quote:
Originally Posted by Riwerry
Посмотреть сообщение
Hello guys, I am making system to save weapons into slots in cars. I can't really know what is with "else" function, it gives an errors.

ERRORS:
C:\Users\Jakub\Desktop\Las Venturas Roleplay\gamemodes\LVRP.pwn(437) : error 029: invalid expression, assumed zero
C:\Users\Jakub\Desktop\Las Venturas Roleplay\gamemodes\LVRP.pwn(437 -- 43 : warning 215: expression has no effect
C:\Users\Jakub\Desktop\Las Venturas Roleplay\gamemodes\LVRP.pwn(43 : error 001: expected token: ";", but found "if"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

pawn Код:
if(listitem == 0)
                {
                    GetPlayerWeaponData(playerid, 1, WeaponInfo[playerid][Weapon1], WeaponInfo[playerid][Weapon1a]);
                    GetPlayerWeaponData(playerid, 2, WeaponInfo[playerid][Weapon2], WeaponInfo[playerid][Weapon2a]);
                    GetPlayerWeaponData(playerid, 3, WeaponInfo[playerid][Weapon3], WeaponInfo[playerid][Weapon3a]);
                    GetPlayerWeaponData(playerid, 4, WeaponInfo[playerid][Weapon4], WeaponInfo[playerid][Weapon4a]);
                    GetPlayerWeaponData(playerid, 5, WeaponInfo[playerid][Weapon5], WeaponInfo[playerid][Weapon5a]);
                    GetPlayerWeaponData(playerid, 6, WeaponInfo[playerid][Weapon6], WeaponInfo[playerid][Weapon6a]);
                    GetPlayerWeaponData(playerid, 7, WeaponInfo[playerid][Weapon7], WeaponInfo[playerid][Weapon7a]);
                    GetPlayerWeaponData(playerid, 8, WeaponInfo[playerid][Weapon8], WeaponInfo[playerid][Weapon8a]);
                    GetPlayerWeaponData(playerid, 9, WeaponInfo[playerid][Weapon9], WeaponInfo[playerid][Weapon9a]);
                    GetPlayerWeaponData(playerid, 10, WeaponInfo[playerid][Weapon10], WeaponInfo[playerid][Weapon10a]);
                    GetPlayerWeaponData(playerid, 11, WeaponInfo[playerid][Weapon11], WeaponInfo[playerid][Weapon11a]);
                    GetPlayerWeaponData(playerid, 12, WeaponInfo[playerid][Weapon12], WeaponInfo[playerid][Weapon12a]);
                    new INI:PouzivatelovSubor2 = INI_Open (PouzivateloveUmiestnenie2 (playerid));
                    INI_SetTag (PouzivatelovSubor2, "Guns");
                    INI_WriteInt (PouzivatelovSubor2, "Slot1", WeaponInfo[playerid][Weapon1]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot1ammo", WeaponInfo[playerid][Weapon1a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot2", WeaponInfo[playerid][Weapon2]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot2ammo", WeaponInfo[playerid][Weapon2a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot3", WeaponInfo[playerid][Weapon3]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot3ammo", WeaponInfo[playerid][Weapon3a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot4", WeaponInfo[playerid][Weapon4]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot4ammo", WeaponInfo[playerid][Weapon4a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot5", WeaponInfo[playerid][Weapon5]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot5ammo", WeaponInfo[playerid][Weapon5a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot6", WeaponInfo[playerid][Weapon6]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot6ammo", WeaponInfo[playerid][Weapon6a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot7", WeaponInfo[playerid][Weapon7]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot7ammo", WeaponInfo[playerid][Weapon7a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot8", WeaponInfo[playerid][Weapon8]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot8ammo", WeaponInfo[playerid][Weapon8a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot9", WeaponInfo[playerid][Weapon9]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot9ammo", WeaponInfo[playerid][Weapon9a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot10", WeaponInfo[playerid][Weapon10]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot10ammo", WeaponInfo[playerid][Weapon10a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot11", WeaponInfo[playerid][Weapon11]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot11ammo", WeaponInfo[playerid][Weapon11a]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot12", WeaponInfo[playerid][Weapon12]);
                    INI_WriteInt (PouzivatelovSubor2, "Slot12ammo", WeaponInfo[playerid][Weapon12a]);
                    INI_Close (PouzivatelovSubor2);
                        ResetPlayerWeapons(playerid);
                    SendClientMessage(playerid, 0xFFFFFF, "You successfully saved weapon to slot 1!");
                    SlotTaken = 1;
                    else //LINE 437
                    if(SlotTaken == 1) //LINE 438
                                        SendClientMessage(playerid, 0xFFFFFF, "In this slot is weapon already saved!");
                }
                else if(listitem == 1)
                {
                    SendClientMessage(playerid,0xFFFFFFFF,"Uloћil jsi zbraт do slotu 2");
                }
                else if(listitem == 2)
                {
                    SendClientMessage(playerid,0xFFFFFFFF,"Uloћil jsi zbraт do slotu 3");
                }
            }
        }
    }
    return true;
}
Under line 438 you forgot your opening and closing brackets, { and }.

This.
pawn Код:
if(SlotTaken == 1) //LINE 438
    SendClientMessage(playerid, 0xFFFFFF, "In this slot is weapon already saved!");
to this.
pawn Код:
if(SlotTaken == 1)//LINE 438
{
    SendClientMessage(playerid, 0xFFFFFF, "In this slot is weapon already saved!");
}

EDIT: Also under the else put an opening bracket {, and at the end of the if, add another closing bracket }.


Re: Need help with these anoying error, thanks for all responses. :( - Riwerry - 10.11.2013

Still problem

437) : error 029: invalid expression, assumed zero

pawn Код:
else  //LINE 437
    {
        if(SlotTaken == 1)
        {
            SendClientMessage(playerid, 0xFFFFFF, "In this slot is weapon already saved!");
        }
    }
}



Re: Need help with these anoying error, thanks for all responses. :( - DexterC - 10.11.2013

Try this let me know if it works or not.

pawn Код:
if(listitem == 0)
{
    GetPlayerWeaponData(playerid, 1, WeaponInfo[playerid][Weapon1], WeaponInfo[playerid][Weapon1a]);
    GetPlayerWeaponData(playerid, 2, WeaponInfo[playerid][Weapon2], WeaponInfo[playerid][Weapon2a]);
    GetPlayerWeaponData(playerid, 3, WeaponInfo[playerid][Weapon3], WeaponInfo[playerid][Weapon3a]);
    GetPlayerWeaponData(playerid, 4, WeaponInfo[playerid][Weapon4], WeaponInfo[playerid][Weapon4a]);
    GetPlayerWeaponData(playerid, 5, WeaponInfo[playerid][Weapon5], WeaponInfo[playerid][Weapon5a]);
    GetPlayerWeaponData(playerid, 6, WeaponInfo[playerid][Weapon6], WeaponInfo[playerid][Weapon6a]);
    GetPlayerWeaponData(playerid, 7, WeaponInfo[playerid][Weapon7], WeaponInfo[playerid][Weapon7a]);
    GetPlayerWeaponData(playerid, 8, WeaponInfo[playerid][Weapon8], WeaponInfo[playerid][Weapon8a]);
    GetPlayerWeaponData(playerid, 9, WeaponInfo[playerid][Weapon9], WeaponInfo[playerid][Weapon9a]);
    GetPlayerWeaponData(playerid, 10, WeaponInfo[playerid][Weapon10], WeaponInfo[playerid][Weapon10a]);
    GetPlayerWeaponData(playerid, 11, WeaponInfo[playerid][Weapon11], WeaponInfo[playerid][Weapon11a]);
    GetPlayerWeaponData(playerid, 12, WeaponInfo[playerid][Weapon12], WeaponInfo[playerid][Weapon12a]);
    new INI:PouzivatelovSubor2 = INI_Open (PouzivateloveUmiestnenie2 (playerid));
    INI_SetTag (PouzivatelovSubor2, "Guns");
    INI_WriteInt (PouzivatelovSubor2, "Slot1", WeaponInfo[playerid][Weapon1]);
    INI_WriteInt (PouzivatelovSubor2, "Slot1ammo", WeaponInfo[playerid][Weapon1a]);
    INI_WriteInt (PouzivatelovSubor2, "Slot2", WeaponInfo[playerid][Weapon2]);
    INI_WriteInt (PouzivatelovSubor2, "Slot2ammo", WeaponInfo[playerid][Weapon2a]);
    INI_WriteInt (PouzivatelovSubor2, "Slot3", WeaponInfo[playerid][Weapon3]);
    INI_WriteInt (PouzivatelovSubor2, "Slot3ammo", WeaponInfo[playerid][Weapon3a]);
    INI_WriteInt (PouzivatelovSubor2, "Slot4", WeaponInfo[playerid][Weapon4]);
    INI_WriteInt (PouzivatelovSubor2, "Slot4ammo", WeaponInfo[playerid][Weapon4a]);
    INI_WriteInt (PouzivatelovSubor2, "Slot5", WeaponInfo[playerid][Weapon5]);
    INI_WriteInt (PouzivatelovSubor2, "Slot5ammo", WeaponInfo[playerid][Weapon5a]);
    INI_WriteInt (PouzivatelovSubor2, "Slot6", WeaponInfo[playerid][Weapon6]);
    INI_WriteInt (PouzivatelovSubor2, "Slot6ammo", WeaponInfo[playerid][Weapon6a]);
    INI_WriteInt (PouzivatelovSubor2, "Slot7", WeaponInfo[playerid][Weapon7]);
    INI_WriteInt (PouzivatelovSubor2, "Slot7ammo", WeaponInfo[playerid][Weapon7a]);
    INI_WriteInt (PouzivatelovSubor2, "Slot8", WeaponInfo[playerid][Weapon8]);
    INI_WriteInt (PouzivatelovSubor2, "Slot8ammo", WeaponInfo[playerid][Weapon8a]);
    INI_WriteInt (PouzivatelovSubor2, "Slot9", WeaponInfo[playerid][Weapon9]);
    INI_WriteInt (PouzivatelovSubor2, "Slot9ammo", WeaponInfo[playerid][Weapon9a]);
    INI_WriteInt (PouzivatelovSubor2, "Slot10", WeaponInfo[playerid][Weapon10]);
    INI_WriteInt (PouzivatelovSubor2, "Slot10ammo", WeaponInfo[playerid][Weapon10a]);
    INI_WriteInt (PouzivatelovSubor2, "Slot11", WeaponInfo[playerid][Weapon11]);
    INI_WriteInt (PouzivatelovSubor2, "Slot11ammo", WeaponInfo[playerid][Weapon11a]);
    INI_WriteInt (PouzivatelovSubor2, "Slot12", WeaponInfo[playerid][Weapon12]);
    INI_WriteInt (PouzivatelovSubor2, "Slot12ammo", WeaponInfo[playerid][Weapon12a]);
    INI_Close (PouzivatelovSubor2);
    ResetPlayerWeapons(playerid);
    SendClientMessage(playerid, 0xFFFFFF, "You successfully saved weapon to slot 1!");
    SlotTaken = 1;
    else
    {
        if(SlotTaken == 1)
        {
            SendClientMessage(playerid, 0xFFFFFF, "In this slot is weapon already saved!");
        }
        else if(listitem == 1)
        {
            SendClientMessage(playerid,0xFFFFFFFF,"Uložil jsi zbraт do slotu 2");
        }
        else if(listitem == 2)
        {
            SendClientMessage(playerid,0xFFFFFFFF,"Uložil jsi zbraт do slotu 3");
        }
    }
    return true;
}



Re: Need help with these anoying error, thanks for all responses. :( - Riwerry - 10.11.2013

nope, got about 9 errors


Re: Need help with these anoying error, thanks for all responses. :( - DexterC - 10.11.2013

Under this part
pawn Код:
INI_Close (PouzivatelovSubor2);
    ResetPlayerWeapons(playerid);
    SendClientMessage(playerid, 0xFFFFFF, "You successfully saved weapon to slot 1!");
    SlotTaken = 1;
Remove the else and the opening and closing brackets and it will look like this.
pawn Код:
ResetPlayerWeapons(playerid);
    SendClientMessage(playerid, 0xFFFFFF, "You successfully saved weapon to slot 1!");
    SlotTaken = 1;
    if(SlotTaken == 1)
    {
        SendClientMessage(playerid, 0xFFFFFF, "In this slot is weapon already saved!");
    }
    else if(listitem == 1)
    {
        SendClientMessage(playerid,0xFFFFFFFF,"Uloћil jsi zbraт do slotu 2");
    }
    else if(listitem == 2)
    {
        SendClientMessage(playerid,0xFFFFFFFF,"Uloћil jsi zbraт do slotu 3");
    }
    return true;
}



Re: Need help with these anoying error, thanks for all responses. :( - Riwerry - 10.11.2013

I DONT BELIEVE! MY GOD!!!!! It works.. Thx mate alot!!

//EDIT: Well it compilled perfect, but got problem when I save weapon it still says SendClientMessage(playerid, 0xFFFFFF, "In this slot is weapon already saved!");


Re: Need help with these anoying error, thanks for all responses. :( - DexterC - 10.11.2013

Quote:
Originally Posted by Riwerry
Посмотреть сообщение
I DONT BELIEVE! MY GOD!!!!! It works.. Thx mate alot!!

//EDIT: Well it compilled perfect, but got problem when I save weapon it still says SendClientMessage(playerid, 0xFFFFFF, "In this slot is weapon already saved!");
Hmm, you could try renaming the listitem to SlotTaken like this.
pawn Код:
if(SlotTaken == 1)
{
    SendClientMessage(playerid, 0xFFFFFF, "In this slot is weapon already saved!");
}
else if(SlotTaken == 2)
{
    SendClientMessage(playerid,0xFFFFFFFF,"Uloћil jsi zbraт do slotu 2");
}
else if(SlotTaken == 3)
{
    SendClientMessage(playerid,0xFFFFFFFF,"Uloћil jsi zbraт do slotu 3");
}