SA-MP Forums Archive
error 079: inconsistent return types (array & non-array) - 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: error 079: inconsistent return types (array & non-array) (/showthread.php?tid=548937)



error 079: inconsistent return types (array & non-array) - AroseKhanNiazi - 03.12.2014

pawn Код:
if(!PlayerInfo[playerid][pSpawn]) return SendClientMessage(playerid,COLOR_ERROR,ERROR_NOT_SPAWNED);
error
pawn Код:
error 079: inconsistent return types (array & non-array)
no idea why it is there even tried

pawn Код:
if(!PlayerInfo[playerid][pSpawn]) SendClientMessage(playerid,COLOR_ERROR,ERROR_NOT_SPAWNED); return  1;



Re: error 079: inconsistent return types (array & non-array) - BroZeus - 03.12.2014

1.
It should be :
Quote:

if(!PlayerInfo[playerid][pSpawn])
{
SendClientMessage(playerid,COLOR_ERROR,ERROR_NOT_S PAWNED);
return 1;
}
2. It is caused when different types of value are returned..
An example of this array maybe like this -
pawn Код:
stock example(bool condition)
{
new a = 5;
new b[5] = {1,2,3,4,5};
if(!condition)return a;//returning int type
return b;//return array..
//error caused due to different return types...
}



Re: error 079: inconsistent return types (array & non-array) - AroseKhanNiazi - 03.12.2014

i am using it in other places + commands it's fine but in this command why not ?


Re: error 079: inconsistent return types (array & non-array) - Sawalha - 03.12.2014

why not simply using:
pawn Код:
new IsPlayerSpawned[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
    IsPlayerSpawned[playerid] = 1;
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    IsPlayerSpawned[playerid] = 0;
    return 1;
}
// anywhere u want
if(IsPlayerSpawned[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, ERROR_NOT_SPAWNED)



Re: error 079: inconsistent return types (array & non-array) - Raweresh - 03.12.2014

Quote:
Originally Posted by AroseKhanNaizi
Посмотреть сообщение
pawn Код:
if(!PlayerInfo[playerid][pSpawn]) return SendClientMessage(playerid,COLOR_ERROR,ERROR_NOT_SPAWNED);
error
pawn Код:
error 079: inconsistent return types (array & non-array)
no idea why it is there even tried

pawn Код:
if(!PlayerInfo[playerid][pSpawn]) SendClientMessage(playerid,COLOR_ERROR,ERROR_NOT_SPAWNED); return  1;
Show all of this callback or function where you use that line.


Re: error 079: inconsistent return types (array & non-array) - AroseKhanNiazi - 04.12.2014

pawn Код:
CMD:rob(playerid, params[])
{
    if(!PlayerInfo[playerid][pSpawn]) return SendClientMessage(playerid,COLOR_ERROR,ERROR_NOT_SPAWNED);
using in this command works like charm


Re: error 079: inconsistent return types (array & non-array) - Threshold - 04.12.2014

Can you show us the entire command that this belongs to?


Re: error 079: inconsistent return types (array & non-array) - AroseKhanNiazi - 04.12.2014

sorry i can't show that command full but here this will work
pawn Код:
CMD:moneyrush(playerid)
{
    if(!PlayerInfo[playerid][pSpawn]) return SendClientMessage(playerid,COLOR_ERROR,ERROR_NOT_SPAWNED);
    new bags = 0, string[50];
    for(new i=0; i < MAX_BAGS; i++)
    {
        if(PlayerMoneyBagInfo[i][pBagDropped])
        {
            bags++;
            if(bags < 16 && bags > 0)
            {
                ShowTextDrawMenu(playerid, TD_MENU_INFO,"~G~Money Bags", bags+3, 0);
                if(!MoneyBagInfo[LostGoldBag] && !MoneyBagInfo[LostMoneyBag])ShowTextDrawMenuItems(playerid, 0, "~r~No ~b~ Mafia ~G~Money Bag ~R~Lost", " ", " ",0);
                else
                {
                    if(MoneyBagInfo[LostMoneyBag])format(string,sizeof(string),"~B~Mafia ~G~Money Bag ~W~In ~P~%s",MoneyBagInfo[BagLoc]);
                    else format(string,sizeof(string),"~B~Mafia ~Y~Gold Bag ~W~In ~P~%s",MoneyBagInfo[BagLoc]);
                    ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
                }
                format(string,sizeof(string),"~P~%s ~W~by %s",PlayerMoneyBagInfo[i][pBagLoc],PlayerMoneyBagInfo[i][pBagDroppedBy]);
                ShowTextDrawMenuItems(playerid, bags+2, " ", string, " ",0);
            }
        }
    }
    if(bags == 0)
    {
        ShowTextDrawMenu(playerid, TD_MENU_INFO,"~G~Money Bags", bags+1, 0);
        if(!MoneyBagInfo[LostGoldBag] && !MoneyBagInfo[LostMoneyBag])ShowTextDrawMenuItems(playerid, 0, "~r~No ~b~ Mafia ~G~Money Bag ~R~Lost", " ", " ",0);
        else
        {
            if(MoneyBagInfo[LostMoneyBag])format(string,sizeof(string),"~B~Mafia ~G~Money Bag ~W~In ~P~%s",MoneyBagInfo[BagLoc]);
            else format(string,sizeof(string),"~B~Mafia ~Y~Gold Bag ~W~In ~P~%s",MoneyBagInfo[BagLoc]);
            ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
        }
        ShowTextDrawMenuItems(playerid, bags+1, " ", "~R~ No ~W~Players ~G~Money Bag~R~ Lost ", " ",0);
    }
    return 1;
}



Re: error 079: inconsistent return types (array & non-array) - Raweresh - 04.12.2014

How the fuck we can help you if you don't show us code man? Sorry but I'm very pissed off now.


Re: error 079: inconsistent return types (array & non-array) - AroseKhanNiazi - 04.12.2014

i want to see the error code i showed it on first post and in that command
pawn Код:
CMD:takedrugs(playerid,params[])
{
    if(!PlayerInfo[playerid][pSpawn]) return SendClientMessage(playerid,COLOR_ERROR,ERROR_NOT_SPAWNED);
when it's not going forward from first step wth u need to see full command