Help with ShowPlayerDialog and OnDialogResponse!
#1

pawn Code:
#include <a_samp>

public OnPlayerCommandText(playerid,cmdtext[])
{
    if(!strcmp(cmdtext, "/wepshop", true))
    {
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Weapon Shop","Brass Knuckles ($500)\r\nGolf Club ($500)\r\nNite Stick ($500)\r\n9mm Pistol ($1000)\r\nMP5 ($1000)\r\nSniper Rifle ($2000)\r\nRocket Launcher ($20000)\r\n","Buy!", "Exit");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        if(response)
        {
            if(listitem == 1)
            {
                GivePlayerWeapon(playerid,330,1);
                GivePlayerMoney(playerid,-500);
            }
            if(listitem == 2)
            {
                GivePlayerWeapon(playerid,333,1);
                GivePlayerMoney(playerid,-500);
            }
            if(listitem == 3)
            {
                GivePlayerWeapon(playerid,334,1);
                GivePlayerMoney(playerid,-500);
            }
            if(listitem == 4)
            {
                GivePlayerWeapon(playerid,346,500);
                GivePlayerMoney(playerid,-1000);
            }
            if(listitem == 5)
            {
                GivePlayerWeapon(playerid,353,500);
                GivePlayerMoney(playerid,-1000);
            }
            if(listitem == 6)
            {
                GivePlayerWeapon(playerid,358,500);
                GivePlayerMoney(playerid,-2000);
            }
            if(listitem == 7)
            {
            GivePlayerWeapon(playerid,359,10);
            GivePlayerMoney(playerid,-20000);
            }
        }
        return 1;
    }
    return 0;
}
Please help me nothing appears when i click ingame
Reply
#2

try taking off return 0
Reply
#3

nah that does not fix it
Reply
#4

well i cant get your porblem O.o sorry
Reply
#5

try a other dialog id
Reply
#6

Do you have any other dialogs using ID 1?
Reply
#7

Lol nubz getof teh internetzzz!

With the GivePlayerWeapon function you need to type in the weapon id, not the weapon model.

You can see weapons, slots and models here:
https://sampwiki.blast.hk/wiki/Weapons

The weapon id is the first param of the row containing the weapons name.
For example, 24 is the weapon id for desert eagle.
Reply
#8

Also, list items start with 0, not with 1. And you might use a switch as-well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)