Jump to content
  • 0

Doua erori.


Shad0wdpbgd

Question

Salut, am aceste doua erori si nu stiu cum sa le rezolv. Poate sa ma ajute cineva?

C:\Gamemode\Gamemode\gamemodes\BigZoneGM.pwn(34883) : error 029: invalid expression, assumed zero
C:\Gamemode\Gamemode\gamemodes\BigZoneGM.pwn(34895) : warning 225: unreachable code

COD: CMD:rob(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(PlayerInfo[playerid][pLevel] < 3) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need level 3 to do this.");
    if(PlayerInfo[playerid][pWantedLevel] > 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You can't rob a business when you have wanted.");
    {
        if(IsACop(playerid)) return SCM(playerid,COLOR_WHITE,"{FFB870}You're a cop.");
        for(new i = 1; i < sizeof(HouseInfo); i++)
        {
            if(PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
            {
                SetTimerEx("SpargeUsa", 5000, 0, "i", playerid);
                GameTextForPlayer(playerid, "~r~Asteapta sa spargi usa...", 5000, 4);
                TogglePlayerControllable(playerid, 0);
                BusinessRob[playerid] = 3;
                if(PlayerInfo[playerid][pPremiumAccount] == 0)
                {
                    PlayerInfo[playerid][pRob] -= 10;
                }
                else if(PlayerInfo[playerid][pPremiumAccount] == 1)
                {
                    PlayerInfo[playerid][pRob] -= 8;
                }    
                Update(playerid,pRobx);
                total_objects[playerid] = 0;
                rob_time[playerid] = 180;
                PlayerTextDrawSetString(playerid, RobPTD, "Loading...");
                PlayerTextDrawShow(playerid, RobPTD);
            }
        }
    }
// 34883    else 
    {
        if(PlayerInfo[playerid][pPremiumAccount] == 0)
        {
            SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You don't have 10 rob points.");
        }
        else if(PlayerInfo[playerid][pPremiumAccount] == 1)
        {
            SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You don't have 8 rob points.");
        }
        return 1;
    }
// 34895    return 1;
}

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Problema ta e in felul urmator.

if(PlayerInfo[playerid][pWantedLevel] > 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You can't rob a business when you have wanted.");

Daca te uiti la acest if se termina cu return, daca deschizi acolade pentru acel if sunt nefolosite, nu au sens. In consecinta acel else arunca eroare pentru ca nu are nici un sens pentru compilator. Daca stergi ce am zis mai sus, rezulta asta

CMD:rob(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(PlayerInfo[playerid][pLevel] < 3) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need level 3 to do this.");
    if(PlayerInfo[playerid][pWantedLevel] > 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You can't rob a business when you have wanted.");
    
    if(IsACop(playerid)) return SCM(playerid,COLOR_WHITE,"{FFB870}You're a cop.");
    for(new i = 1; i < sizeof(HouseInfo); i++)
    {
        if(PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
        {
            SetTimerEx("SpargeUsa", 5000, 0, "i", playerid);
            GameTextForPlayer(playerid, "~r~Asteapta sa spargi usa...", 5000, 4);
            TogglePlayerControllable(playerid, 0);
            BusinessRob[playerid] = 3;
            if(PlayerInfo[playerid][pPremiumAccount] == 0)
            {
                PlayerInfo[playerid][pRob] -= 10;
            }
            else if(PlayerInfo[playerid][pPremiumAccount] == 1)
            {
                PlayerInfo[playerid][pRob] -= 8;
            }    
            Update(playerid,pRobx);
            total_objects[playerid] = 0;
            rob_time[playerid] = 180;
            PlayerTextDrawSetString(playerid, RobPTD, "Loading...");
            PlayerTextDrawShow(playerid, RobPTD);
        }
    }


    if(PlayerInfo[playerid][pPremiumAccount] == 0)
    {
        SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You don't have 10 rob points.");
    }
    else if(PlayerInfo[playerid][pPremiumAccount] == 1)
    {
        SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You don't have 8 rob points.");
    }
    return 1;
    
   return 1;
} 

Motiv pentru care ultimul tau return nu poate fi atins, pentru  ca comanda deja s-a finalizat. In concluzie codul corect este

CMD:rob(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(PlayerInfo[playerid][pLevel] < 3) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need level 3 to do this.");
    if(PlayerInfo[playerid][pWantedLevel] > 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You can't rob a business when you have wanted.");
    
    if(IsACop(playerid)) return SCM(playerid,COLOR_WHITE,"{FFB870}You're a cop.");
    for(new i = 1; i < sizeof(HouseInfo); i++)
    {
        if(PlayerToPoint(3, playerid,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
        {
            SetTimerEx("SpargeUsa", 5000, 0, "i", playerid);
            GameTextForPlayer(playerid, "~r~Asteapta sa spargi usa...", 5000, 4);
            TogglePlayerControllable(playerid, 0);
            BusinessRob[playerid] = 3;
            if(PlayerInfo[playerid][pPremiumAccount] == 0)
            {
                PlayerInfo[playerid][pRob] -= 10;
            }
            else if(PlayerInfo[playerid][pPremiumAccount] == 1)
            {
                PlayerInfo[playerid][pRob] -= 8;
            }    
            Update(playerid,pRobx);
            total_objects[playerid] = 0;
            rob_time[playerid] = 180;
            PlayerTextDrawSetString(playerid, RobPTD, "Loading...");
            PlayerTextDrawShow(playerid, RobPTD);
        }
    }

    
    if(PlayerInfo[playerid][pPremiumAccount] == 0)
    {
        SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You don't have 10 rob points.");
    }
    else if(PlayerInfo[playerid][pPremiumAccount] == 1)
    {
        SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You don't have 8 rob points.");
    }
    
    return 1;
} 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.