Compiling Error 079
#1

All these errors im getting:

Error is:
Quote:

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

pawn Код:
if (strcmp("/wepshop", cmdtext, true, 11) == 0)
    {
    if(IsPlayerVipType(playerid,1))
    {
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Weapon Shop","Brass Knuckles ($500)\nGolf Club ($500)\nNite Stick ($500)\nKnife ($500)\nBaseball Bat ($500)\nShovel ($500)\nPool Cue ($500)\nKatana ($500)\nChainsaw ($1500)\n9mm Pistol ($2000)\nSilenced 9mm Pistol ($2100)\nDesert Eagle ($2100)\nSawn-Off Shotgun ($10000)\nAK-47 ($5000)\nTEC-9 ($2500)\nSpecial Weapon ($50000)\n","Buy!", "Exit");
        return 1;
Error is on the last
Код:
return 1;
Why does this happend? I got many error of those...
Reply
#2

Probably because the 'ShowPlayerDialog' line is to long.. Try cutting it in half.
Reply
#3

Would you make an example? Since im trying to cut it but dont know how... like make the pawn code?
Reply
#4

I think this should work.
pawn Код:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Weapon Shop","Brass Knuckles ($500)\nGolf Club ($500)\nNite Stick ($500)\nKnife ($500)\nBaseball Bat ($500)\nShovel ($500)\nPool Cue ($500)\nKatana ($500)\n
Chainsaw ($1500)\n9mm Pistol ($2000)\nSilenced 9mm Pistol ($2100)\nDesert Eagle ($2100)\nSawn-Off Shotgun ($10000)\nAK-47 ($5000)\nTEC-9 ($2500)\nSpecial Weapon ($50000)\n"
,"Buy!", "Exit");
Reply
#5

pawn Код:
LINE 416:   if (strcmp("/wepshop", cmdtext, true, 11) == 0)
LINE 417:    {
LINE 418:   if(IsPlayerVipType(playerid,1))
LINE 419:   {
LINE 420:       new listitem[] = "1\tBrass Knuckles ($500)\n2\tGolf Club ($500)\n3\tNite Stick ($500)\n4\tKnife ($500)\n5\tBaseball Bat ($500)\n6\tShovel ($500)\n7\tPool Cue ($500)\n8\tKatana ($500)\n9\tChainsaw ($1500)\n10\t9mm Pistol ($2000)\n11\tSilenced 9mm Pistol ($2100)\n12\tDesert Eagle ($2100)\n13\tSawn-Off Shotgun ($10000)\n14\tAK-47 ($5000)\n15\tTEC-9 ($2500)\n16\tSpecial Weapon ($50000)\n";
LINE 421:       ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"List of weapons:",listitems,"Get Gun","Cancel");
LINE 422:   if(dialogid == 1) {
LINE 423:        if(response) {
LINE 424:            new message[256+1];
LINE 425:            if(listitem == 0) {
LINE 426:                format(message, 256, "You selected 'Brass Knuckles'", listitem);
LINE 427:           GivePlayerMoney(playerid, -500);
LINE 428:           SendClientMessage(playerid, 0xFFFFFFFF, message);
LINE 429:            GivePlayerWeapon (playerid, 1, 500);
LINE 430:            } else if(listitem == 1) {
LINE 431:                format(message, 256, "You selected 'Golf Club'", listitem);
LINE 432:            SendClientMessage(playerid, 0xFFFFFFFF, message);
LINE 433:            GivePlayerWeapon (playerid, 2, 500);
LINE 434:               return 1;
Attempted doing this... But got these errors:

Quote:

(421) : error 017: undefined symbol "listitems"
(422) : error 017: undefined symbol "dialogid"
(423) : error 017: undefined symbol "response"
(425) : error 033: array must be indexed (variable "listitem")
(430) : error 033: array must be indexed (variable "listitem")
(434) : error 079: inconsistent return types (array & non-array)

Reply
#6

Well, instead of doing 'listitems = blabla' you could just do the format(...) and make it easier, also the dialogid and response are variables for the 'OnDialogResponse' callback, it will not work under 'OnPlayerCommandText'
Reply
#7

Credits to vince for this:

You are doing something like:
pawn Код:
MyFunction()
{
    if(somevalue)
    {
        return 1;
    }
    new string[64] = "a text";
    return string;
}
"In one function, all return types must be consistent (that's what the error says). So you need to return all arrays (strings), all integers or all floats, but not a combination of them."
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)