Help needed
#1

Okay, I am trying to make a dialog list which if the player click on one of the weapons he should start a training;
pawn Код:
if(strcmp(cmd, "/weapontraining", true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,5,300.5705,-134.0464,1004.0625))
        {
            ShowPlayerDialog(playerid,0,DIALOG_STYLE_LIST,"Weapon Training","Desert Eagle\nPump Shotgun\nSawn Off\nCombat Shotgun\nUzi\nMP5\nAK-47\nM4A1\n","Buy!", "Exit");
        }
        return 1;
    }
To make it with this;
pawn Код:
if(dialogid == 0) // Ammunation
        {
            if(response)
            {
                if(listitem == 1)
                {
                    if(GetPlayerMoney(playerid) > 49)
                    {
                        if(PlayerInfo[playerid][pPistSkill] < 1000)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: We are going to Start the Pistol Training in a few Seconds");
                            TrainTimer[playerid] = SetTimerEx("TrainPistol", 2500, false, "i", playerid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: You are already an Expert with this weapon!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "TRAINER: You don't have enough money!");
                        return 1;
                    }
                }
                else if(listitem == 2)
                {
                    if(GetPlayerMoney(playerid) > 75)
                    {
                        if(PlayerInfo[playerid][pSilenSkill] < 1000)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: We are going to Start the Silenced Pistol Training in a few Seconds");
                            TrainTimer[playerid] = SetTimerEx("TrainSilenced", 2500, false, "i", playerid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: You are already an Expert with this weapon!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "TRAINER: You don't have enough money!");
                        return 1;
                    }
                }
                else if(listitem == 3)
                {
                    if(GetPlayerMoney(playerid) > 150)
                    {
                        if(PlayerInfo[playerid][pDesertSkill] < 1000)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: We are going to Start the Deagle Training in a few Seconds");
                            TrainTimer[playerid] = SetTimerEx("TrainDeagle", 2500, false, "i", playerid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: You are already an Expert with this weapon!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "TRAINER: You don't have enough money!");
                        return 1;
                    }
                }
                else if(listitem == 4)
                {
                    if(GetPlayerMoney(playerid) > 125)
                    {
                        if(PlayerInfo[playerid][pShotgSkill] < 1000)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: We are going to Start the Shotgun Training in a few Seconds");
                            TrainTimer[playerid] = SetTimerEx("TrainShotgun", 2500, false, "i", playerid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: You are already an Expert with this weapon!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "TRAINER: You don't have enough money!");
                        return 1;
                    }
                }
                else if(listitem == 5)
                {
                    if(GetPlayerMoney(playerid) > 100)
                    {
                        if(PlayerInfo[playerid][pSawnSkill] < 800)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: We are going to Start the Sawn-Off Training in a few Seconds");
                            TrainTimer[playerid] = SetTimerEx("TrainSawn", 2500, false, "i", playerid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: You are already an Expert with this weapon!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "TRAINER: You don't have enough money!");
                        return 1;
                    }
                }
                else if(listitem == 6)
                {
                    if(GetPlayerMoney(playerid) > 200)
                    {
                        if(PlayerInfo[playerid][pCombSkill] < 1000)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: We are going to Start the Combat Shotgun Training in a few Seconds");
                            TrainTimer[playerid] = SetTimerEx("TrainCombat", 2500, false, "i", playerid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: You are already an Expert with this weapon!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "TRAINER: You don't have enough money!");
                        return 1;
                    }
                }
                else if(listitem == 7)
                {
                    if(GetPlayerMoney(playerid) > 125)
                    {
                        if(PlayerInfo[playerid][pUziSkill] < 800)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: We are going to Start the Micro Sub Machine Gun Training in a few Seconds");
                            TrainTimer[playerid] = SetTimerEx("TrainUzi", 2500, false, "i", playerid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: You are already an Expert with this weapon!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "TRAINER: You don't have enough money!");
                        return 1;
                    }
                }
                else if(listitem == 8)
                {
                    if(GetPlayerMoney(playerid) > 155)
                    {
                        if(PlayerInfo[playerid][pSmgSkill] < 1000)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: We are going to Start the MP5 Training in a few Seconds");
                            TrainTimer[playerid] = SetTimerEx("TrainSmg", 2500, false, "i", playerid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: You are already an Expert with this weapon!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "TRAINER: You don't have enough money!");
                        return 1;
                    }
                }
                else if(listitem == 9)
                {
                    if(GetPlayerMoney(playerid) > 140)
                    {
                        if(PlayerInfo[playerid][pAkSkill] < 1000)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: We are going to Start the AK-47 Training in a few Seconds");
                            TrainTimer[playerid] = SetTimerEx("TrainAk47", 2500, false, "i", playerid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: You are already an Expert with this weapon!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "TRAINER: You don't have enough money!");
                        return 1;
                    }
                }
                else if(listitem == 10)
                {
                    if(GetPlayerMoney(playerid) > 140)
                    {
                        if(PlayerInfo[playerid][pM4Skill] < 1000)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: We are going to Start the M4 Training in a few Seconds");
                            TrainTimer[playerid] = SetTimerEx("TrainM4", 2500, false, "i", playerid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "TRAINER: You are already an Expert with this weapon!");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "TRAINER: You don't have enough money!");
                        return 1;
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "You selected Cancel");
            }
            return 1;
        }
Reply
#2

May I bump this??
Reply
#3

Bump
Reply
#4

Stop bumping. You must wait 48 hours between bumps.

You don't even explain what the problem is..

Also, learn to use arrays etc.
Reply
#5

pawn Код:
C:\Documents and Settings\Lindvall\Skrivbord\Raven's Roleplay 0.3c V4.2\gamemodes\larp.pwn(10096) : warning 217: loose indentation
C:\Documents and Settings\Lindvall\Skrivbord\Raven'
s Roleplay 0.3c V4.2\gamemodes\larp.pwn(16346) : warning 217: loose indentation
C:\Documents and Settings\Lindvall\Skrivbord\Raven's Roleplay 0.3c V4.2\gamemodes\larp.pwn(16382) : warning 217: loose indentation
C:\Documents and Settings\Lindvall\Skrivbord\Raven'
s Roleplay 0.3c V4.2\gamemodes\larp.pwn(28014) : warning 219: local variable "idcar" shadows a variable at a preceding level
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Warnings.
Line 10096:
pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "Type /weapontraining to get a specific weapon for your training.");
Line 16346:
pawn Код:
if(newstate == PLAYER_STATE_WASTED)
Line 16382:
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
Line 28014:
pawn Код:
new idcar = GetPlayerVehicleID(playerid);
Reply
#6

Loose indentation just means it's not indented properly. Each 'level' should be indented one level, so the opening and closing braces/brackets are aligned. This makes code easier to read:

pawn Код:
CMD:test(playerid, params[])
{
    function();
    if(condition)
    {
        foo();
    }
    else
    {
        bar();
    }
    return 1;
}
As for the fourth error, you already declared a variable called 'idcar' so re-name it and any related to it.
Reply
#7

So it's one of the brackets to much right?
Reply
#8

Show the whole block of code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)