error 079: inconsistent return types (array & non-array)
#1

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;
Reply
#2

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...
}
Reply
#3

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

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)
Reply
#5

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.
Reply
#6

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

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

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;
}
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)