Dialog Working fine but there is a Problem
#1

Well.. I Made a dialog when you do /buyweapons a Dialog appear with 3 Guns and you buy from them , it's worknig Fine...BUT...let's say i bought a Spas12 from the Dialog and i took it , Let's say i didn't buy the Spas12 yet *Note : I Spawn with Shotgun* , I DOn't want Spas12 but i want Deagle , so i do /buyweapons and choose Deagle , it take from me the money BUT i don't take the gun , i see it in sec then it Disappear and i only stay with Shotgun , same happen with M4 , only the Spas12 works , here is the Dialog :


Quote:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)// They pressed the first button.
{
switch (dialogid == // If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
case 1:// Our dialog!
{
switch(listitem)// Checking which listitem was selected
{
case 0:// The first item listed
{
if(GetPlayerMoney(playerid) < 20000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -20000);
GivePlayerWeapon(playerid, 24);
}
case 1: // The second item listed
{
if(GetPlayerMoney(playerid) < 50000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -50000);
GivePlayerWeapon(playerid, 31);
}
case 2: // The third item listed
{
if(GetPlayerMoney(playerid) < 100000) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
GivePlayerMoney(playerid, -100000);
GivePlayerWeapon(playerid, 27);
}
}
}
}
}
return 1;
}

And this :

Quote:

if(!strcmp(cmdtext, "/BuyWeapons", true))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Weapons List", "Desert Eagle ($20,000)\nM4 ($50,000)\nSpas12 ($100,000)", "Purchase", "Cancel");
return 1;
}
}

Any Solutions ?
Reply
#2

GivePlayerWeapon requires a ammo field.

pawn Код:
GivePlayerWeapon(playerid, weaponid, ammo)
Add a amount of ammo onto the end of your GivePlayerWeapon's.
Reply
#3

Source: wiki.sa-mp.com

GivePlayerWeapon(playerid, weaponid, ammo);

The guns probably dissapear since your not giving an ammo ammount.

//EDIT: [HiC]TheKiller was first :P
Reply
#4

You wrong using dialogs..
I made 2examples

pawn Код:
if(dialogid == YOUR_DIALOG)
{
    if(response)
    {
        // Your code
    }
    else
    {
        // if(!response)
    }
    return 1;
}

switch(dialogid)
{
    case YOUR_DIALOG:
    {
        if(response)
        {
            // Your code
        }
        else
        {
            // if(!response)
        }
    }
}
Reply
#5

Quote:
Originally Posted by Raimis_R
Посмотреть сообщение
You wrong using dialogs..
I made 2examples

pawn Код:
if(dialogid == YOUR_DIALOG)
{
    if(response)
    {
        // Your code
    }
    else
    {
        // if(!response)
    }
    return 1;
}

switch(dialogid)
{
    case YOUR_DIALOG:
    {
        if(response)
        {
            // Your code
        }
        else
        {
            // if(!response)
        }
    }
}
That is not the problem, as he said the dialog works fine, it's the Guns that are not be giving since he isn't applying ammo in the deagle case and the M4 case.

The reason why the Spas works, is like he said, he spawns with an shotgun already. (so the shotgun HAS ammo already)

The reason why the other guns aren't working is simple, they don't have bullets and dissapear
Reply
#6

Do you think so?

Look

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)// They pressed the first button.
{
switch (dialogid == // If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
{
case 1:// Our dialog!
{
Do you think his using dialogs fine?

https://sampwiki.blast.hk/wiki/OnDialogResponse
Reply
#7

Quote:
Originally Posted by Mr.Black
Посмотреть сообщение
Well.. I Made a dialog when you do /buyweapons a Dialog appear with 3 Guns and you buy from them , it's worknig Fine...
Your dialog issue isn't his question is it?
Reply
#8

Just i'm saying his bad using OnDialogResponse you understand it?

if you love mistakes very sorry for it.
Reply
#9

Quote:
Originally Posted by Raimis_R
Посмотреть сообщение
Just i'm saying his bad using OnDialogResponse you understand it?

if you love mistakes very sorry for it.
You should be sorry for going offtopic there.
His problem should be solved with the help [HiC]TheKiller posted.

This board is also called Scripting Discussion, not Raimis_R Discussion.
Reply
#10

Worked , Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)