trying to make shop
#1

for my dialog
pawn Код:
if(dialogid == 1)
            {
            if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You canceled!");
            ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST, "Meele Weapons", "Brass Knuckles $100 \nGolf Club $100 \nNite Stick $100 \nKnife $100 \nBaseball Bat $100 \nShovel $100 \nKatana $150 \nChainsaw $150 \nFlowers $150 \nCane $150", "Buy", "Back");
            }
            return 1;
            }
if(dialogid == 2)
            {
            if(response)
            {
            if(listitem == 0)
            {
            GivePlayerWeapon(playerid,1,99999);
            }
            if(listitem == 1)
            {
            GivePlayerWeapon(playerid,2,99999);
            }
            if(listitem == 2)
            {
            GivePlayerWeapon(playerid,3,1);
            }
            if(listitem == 3)
            {
            GivePlayerWeapon(playerid,4,1);
            }
            if(listitem == 4)
            {
            GivePlayerWeapon(playerid,5,1);
            }
            if(listitem == 5)
            {
            GivePlayerWeapon(playerid,6,1);
            }
            if(listitem == 6)
            {
            GivePlayerWeapon(playerid,8,1);
            }
            if(listitem == 7)
            {
            GivePlayerWeapon(playerid,9,1);
            }
            if(listitem == 8)
            {
            GivePlayerWeapon(playerid,14,1);
            }
            if(listitem == 9)
            {
            GivePlayerWeapon(playerid,15,1);
            }
            }
            return 1;
            }
i get these weird errors :S
pawn Код:
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(486) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(488) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(490) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(494) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(498) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(502) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(506) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(510) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(514) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(518) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(522) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(526) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(531) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


13 Errors.
LINE 486 is
pawn Код:
if(dialogid == 2)
Reply
#2

it looks like you got a bracket to much (two lines before your error)

And you could use a switch statment instead of if's

pawn Код:
switch(listitem)
{
    case 0: GivePlayerWeapon(playerid,1,1);
    case 1: GivePlayerWeapon(playerid,2,1);
}
Reply
#3

wtf same errors lol
pawn Код:
if(dialogid == 2)
            {
            if(!response)
            {
            SendClientMessage(playerid,0xFF0000FF,"You had go back!");
            return 1;
            }
            switch(listitem)
            {
            case 0:GivePlayerWeapon(playerid,1,99999);
            case 1:GivePlayerWeapon(playerid,2,99999);
            case 2:GivePlayerWeapon(playerid,3,1);
            case 3:GivePlayerWeapon(playerid,4,1);
            case 4:GivePlayerWeapon(playerid,5,1);
            case 5:GivePlayerWeapon(playerid,6,1);
            case 6:GivePlayerWeapon(playerid,8,1);
            case 7:GivePlayerWeapon(playerid,9,1);
            case 8:GivePlayerWeapon(playerid,14,1);
            case 9:GivePlayerWeapon(playerid,15,1);
            }
            return 1;
            }
Reply
#4

You overread the first line of my old reply

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
it looks like you got a bracket to much (two lines before your error)
Errorline 486 -> two lines before 486 "}"

I know code blocks are so shiny but please dont ignore the rest
Reply
#5

pawn Код:
if(dialogid == 1)
{
    if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You canceled!");
    ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST, "Meele Weapons", "Brass Knuckles $100 \nGolf Club $100 \nNite Stick $100 \nKnife $100 \nBaseball Bat $100 \nShovel $100 \nKatana $150 \nChainsaw $150 \nFlowers $150 \nCane $150", "Buy", "Back");
}


if(dialogid == 2)
{
    if(response) {
        if(listitem == 0) {
            GivePlayerWeapon(playerid,1,99999);
        }
        if(listitem == 1) {
            GivePlayerWeapon(playerid,2,99999);
        }
        if(listitem == 2) {
            GivePlayerWeapon(playerid,3,1);
        }
        if(listitem == 3) {
            GivePlayerWeapon(playerid,4,1);
        }
        if(listitem == 4) {
            GivePlayerWeapon(playerid,5,1);
        }
        if(listitem == 5) {
            GivePlayerWeapon(playerid,6,1);
        }
        if(listitem == 6) {
            GivePlayerWeapon(playerid,8,1);
        }
        if(listitem == 7) {
            GivePlayerWeapon(playerid,9,1);
        }
        if(listitem == 8) {
            GivePlayerWeapon(playerid,14,1);
        }
        if(listitem == 9) {
            GivePlayerWeapon(playerid,15,1);
        }
        return 1;
    }
Stop returning 1 when you don't need to. You don't need to return 1 after each if.


EDIT: The name tanush is farmiliar from my server today. I remember you admitting to being a 12 year old...
Reply
#6

wtf
pawn Код:
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(43) : error 017: undefined symbol "SendTeamMessage"
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(286) : error 001: expected token: "do", but found "{"
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(455) : error 079: inconsistent return types (array & non-array)
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(457) : error 079: inconsistent return types (array & non-array)
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(472) : error 079: inconsistent return types (array & non-array)
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(473) : error 079: inconsistent return types (array & non-array)
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(479) : error 079: inconsistent return types (array & non-array)
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(489) : error 079: inconsistent return types (array & non-array)
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(492) : warning 217: loose indentation
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(492) : error 029: invalid expression, assumed zero
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(492) : error 017: undefined symbol "cmd_setadmin"
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(492) : error 029: invalid expression, assumed zero
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(492) : fatal error 107: too many error messages on one line
Reply
#7

... I dont think those are from your onplayerdialogresponse.
Reply
#8

my bad i accidently put 3 bracket on beginning, now i fuckin still have same problems
pawn Код:
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(486) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(488) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(490) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(494) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(498) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(502) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(506) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(510) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(514) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(518) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(522) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(526) : error 010: invalid function or declaration
D:\Users\Tanush\Desktop\samp dm\gamemodes\DM.pwn(531) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


13 Errors.
Reply
#9

That means YOU HAVE MORE OF THE RETURN 1;'s. You GOTTA stop putting the return 1;'s everywhere dude, they mainly go at the end of callbacks.
Reply
#10

pawn Код:
if(dialogid == 1)
{
    if(response)
    {
        ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST, "Meele Weapons", "Brass Knuckles $100 \nGolf Club $100 \nNite Stick $100 \nKnife $100 \nBaseball Bat $100 \nShovel $100 \nKatana $150 \nChainsaw $150 \nFlowers $150 \nCane $150", "Buy", "Back");
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "You canceled!");
}
else if(dialogid == 2)
{
    if(response)
    {
        switch(listitem)
        {
            case 0: GivePlayerWeapon(playerid,1,99999);
            case 1: GivePlayerWeapon(playerid,2,99999);
            case 2: GivePlayerWeapon(playerid,4,1);
            case 3: GivePlayerWeapon(playerid,5,1);
            case 4: GivePlayerWeapon(playerid,6,1);
            case 5: GivePlayerWeapon(playerid,8,1);
            case 6: GivePlayerWeapon(playerid,9,1);
            case 7: GivePlayerWeapon(playerid,14,1);
            case 8: GivePlayerWeapon(playerid,15,1);
        }
    }
    return 1;
}
Proper indentation always helps, also, I switched it to the switch method.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)