dialog help
#1

Im trying to0 make dialog system so for login,spawning,buying stuff at stores..etc

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if (dialogid == 0)
  {
      if(!response) return SendClientMessage(playerid, 0xFFFFFFFF, "You canceled!");
      switch (listitem)
      {
        if(listitem == 0)
        {
        SendClientMessage(playerid,0x1E90FFAA, "Type /commands for your commands");
        SendClientMessage(playerid,0x1E90FFAA, "RAPIST: You can rape other players and infect them with STDs that could kill them");
        GivePlayerWeapon(playerid,5,1);
        GivePlayerWeapon(playerid,22,100);
        GivePlayerWeapon(playerid,14,1);
        gTeam[playerid] = TEAM_RAPIST;
        SetPlayerToTeamColour(playerid);
        canchooseskill[playerid] =0;
        TextDrawHideForPlayer(playerid,txtTypeSkill);
       }
        if(listitem == 1)
        {
       SendClientMessage(playerid,0x1E90FFAA, "Type /commands for your commands");
        SendClientMessage(playerid,0x00FFFFAA, "DRUG DEALER: You will supply people with drugs for a price. Dont let people rip you off..");
        SendClientMessage(playerid,0x00FFFFAA, "Keep a watch on the chat for players wanting drugs. Visit the drug house to replenish your stock");
        GivePlayerWeapon(playerid,25,50);
        GivePlayerWeapon(playerid,28,100);
        GivePlayerWeapon(playerid,5,1);
        gTeam[playerid] = TEAM_DRGDEL;
        SetPlayerToTeamColour(playerid);
        PlayerDrugs[playerid] = 500;
        canchooseskill[playerid] =0;
        TextDrawHideForPlayer(playerid,txtTypeSkill);
        }
        if(listitem == 2)
        {
       SendClientMessage(playerid,0x1E90FFAA, "Type /commands for your commands");
       SendClientMessage(playerid,0x00FFFFAA, "GUN DEALER: If anyone needs weapons then you sell them some lead. Your prices are set by the game");
        SendClientMessage(playerid,0x00FFFFAA, "You can also deliver guns to ammunations, just get in the PATRIOT car at ammunation stores in LV");
        GivePlayerWeapon(playerid,29,500);
        GivePlayerWeapon(playerid,30,50);
        gTeam[playerid] = TEAM_GUNDEL;
        SetPlayerToTeamColour(playerid);
        canchooseskill[playerid] =0;
        TextDrawHideForPlayer(playerid,txtTypeSkill);
        }
        if(listitem == 3)
        {
              SendClientMessage(playerid,0x1E90FFAA, "Type /commands for your commands");
            SendClientMessage(playerid,0x00FFFFAA, "HITMAN: If anyone needs another player dead then they will contact you. Make sure you agree a price and get paid");
        //SendClientMessage(playerid,0x00FFFFAA, "Look out for messages on the chat like **Hitmen: PsyKo wants Tyrone dead. Contact PsyKo to discuss**");
        SendClientMessage(playerid,0x00FFFFAA, "Type /listhits to see if there are any hit contracts available");
        GivePlayerWeapon(playerid,27,250);
        GivePlayerWeapon(playerid,23,100);
        GivePlayerWeapon(playerid,31,250);
        gTeam[playerid] = TEAM_HITMAN;
        SetPlayerToTeamColour(playerid);
        canchooseskill[playerid] =0;
        TextDrawHideForPlayer(playerid,txtTypeSkill);
        }
        if(listitem == 4)
        {
                SendClientMessage(playerid,0x1E90FFAA, "Type /commands for your commands");
            SendClientMessage(playerid,0x00FFFFAA, "PRIVATE MEDIC: If anyone needs medical attention for cuts and bruses or STDs then you can cure then and heal them");
        SendClientMessage(playerid,0x00FFFFAA, "You can also infect them with STDs that could kill them DO NOT HIT/INFECT THEM JUST TO HEAL/CURE THEM");
        GivePlayerWeapon(playerid,22,250);
        gTeam[playerid] = TEAM_PVTMED;
        SetPlayerToTeamColour(playerid);
        canchooseskill[playerid] =0;
        TextDrawHideForPlayer(playerid,txtTypeSkill);
        }
        if(listitem == 5)
        {
                SendClientMessage(playerid,0x1E90FFAA, "Type /commands for your commands");
            SendClientMessage(playerid,0x00FFFFAA, "BOUNTY HUNTER: You have to help the cops take Escaped prisoners back into custody");
        SendClientMessage(playerid,0x00FFFFAA, "Simply target RED players and type /ar (id) next to them to see if you have found an escaped convict");
        SendClientMessage(playerid,0x00FFFFAA, "Type /bounty for details of Escaped Prisoners");
        GivePlayerWeapon(playerid,27,250);
        GivePlayerWeapon(playerid,23,100);
        GivePlayerWeapon(playerid,31,250);
        gTeam[playerid] = TEAM_BOUNTY;
        SetPlayerToTeamColour(playerid);
        canchooseskill[playerid] =0;
        TextDrawHideForPlayer(playerid,txtTypeSkill);
        }
        if(listitem == 6)
        {
                SendClientMessage(playerid,0x1E90FFAA, "Type /commands for your commands.");
              SendClientMessage(playerid,0x00FFFFAA, "Kidnapper: You have to get a passenger in your car.");
                SendClientMessage(playerid,0x00FFFFAA, "Tie them up using /tie, and then drive to a location which is out");
                SendClientMessage(playerid,0x00FFFFAA, "of the way and proceed to do what you wish.");
                GivePlayerWeapon(playerid,26,40);
                GivePlayerWeapon(playerid,32,200);
                GivePlayerWeapon(playerid,22,200);
                gTeam[playerid] = TEAM_KIDNAP;
                SetPlayerToTeamColour(playerid);
                canchooseskill[playerid] =0;
                TextDrawHideForPlayer(playerid,txtTypeSkill);
                }
        if(listitem == 7)
        {
                SendClientMessage(playerid,0x1E90FFAA, "Type /commands for your commands");
            SendClientMessage(playerid,0x00FFFFAA, "Pilot: You are a plane driver");
        SendClientMessage(playerid,0x00FFFFAA, "If a player orders a private plane you can be the driver");
        GivePlayerWeapon(playerid,5,1);
        GivePlayerWeapon(playerid,22,100);
        GivePlayerWeapon(playerid,14,1);
        gTeam[playerid] = TEAM_PILOT;
        SetPlayerToTeamColour(playerid);
        canchooseskill[playerid] =0;
        TextDrawHideForPlayer(playerid,txtTypeSkill);
        }
        if(listitem == 8)
        {
                SendClientMessage(playerid,0x1E90FFAA, "Type /commands for your commands");
            SendClientMessage(playerid,0x00FFFFAA, "CAR JACKER: You can stealcars from autobahn for money.");
        GivePlayerWeapon(playerid,5,1);
        GivePlayerWeapon(playerid,22,100);
        GivePlayerWeapon(playerid,14,1);
              gTeam[playerid] = TEAM_CARJACK;
        SetPlayerToTeamColour(playerid);
        canchooseskill[playerid] =0;
        TextDrawHideForPlayer(playerid,txtTypeSkill);
        }
        if(listitem == 9)
        {
                SendClientMessage(playerid,0x1E90FFAA, "Type /commands for your commands");
            SendClientMessage(playerid,0x00FFFFAA, "LAWYER: You can free players from jail for money.");
        GivePlayerWeapon(playerid,5,1);
        GivePlayerWeapon(playerid,22,100);
        GivePlayerWeapon(playerid,14,1);
              gTeam[playerid] = TEAM_LAWYER;
        SetPlayerToTeamColour(playerid);
        canchooseskill[playerid] =0;
        TextDrawHideForPlayer(playerid,txtTypeSkill);
        }
        if(listitem == 10)
        {
                SendClientMessage(playerid,0x1E90FFAA, "Type /commands for your commands");
            SendClientMessage(playerid,0x00FFFFAA, "ITEM SALESMAN: If anyone needs items then you sell them some. Your prices are set by the game");
        SendClientMessage(playerid,0x00FFFFAA, "Simply look out for players who want items and are to lazy to go ot a 24/7 store");
        GivePlayerWeapon(playerid,27,250);
        GivePlayerWeapon(playerid,23,100);
        GivePlayerWeapon(playerid,31,250);
        gTeam[playerid] = TEAM_ITEM;
        SetPlayerToTeamColour(playerid);
        canchooseskill[playerid] =0;
        TextDrawHideForPlayer(playerid,txtTypeSkill);
        }
        return 1;
      }
  }
The code got messed up after i copy and pasted tried to fix but too much work
Reply
#2

pawn Код:
if(listitem == 0)
Don't do this, use a switch.

pawn Код:
if (dialogid == 0)
{
   switch(listitem)
   {
      case 0:
      {
          // Code Here
      }
      case 1:
      {
          // Code Here
      }
   }
}
Reply
#3

i used that before it still didnt work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)