[Ajuda] Comprar armas - Dialog
#1

E aн pessoal beleza?

Eu criei uma dialog para comprar armas sу que, eu nгo sei por p/ diminuir a grana do player que comprar tal arma e caso ele nгo tenha dinheiro, aparecer uma mensagem de erro...

Alguйm pode me dizer como eu tenho que fazer?

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DIALOG_ARMAS)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0: GivePlayerWeapon(playerid, WEAPON_SAWEDOFF, 300);
                case 1: GivePlayerWeapon(playerid, WEAPON_SNIPER, 100);
                case 2: GivePlayerWeapon(playerid, WEAPON_M4, 350);
            }
        }
	}
	return 1;
}
Код:
CMD:armas(playerid)
{
    ShowPlayerDialog(playerid, DIALOG_ARMAS, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Armas",
	"Arma\tMuniзгo\tPreзo\n\
	{FFFFFF}Sawnoff\t{FFFFFF}300\t{1A920B}$900{FFFFFF}\n\
	{FFFFFF}Sniper Rifle\t{FFFFFF}100\t{1A920B}$2500{FFFFFF}\n\
	{FFFFFF}M4\t{FFFFFF}350\t{1A920B}$1000{FFFFFF}",
	"Selecionar", "Fechar");
	return 1;
}
Agradeзo qualquer ajuda rapaziada!
Reply
#2

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_ARMAS)
    {
        if(
response)
        {
            switch(
listitem)
            {
                case 
0
                {
                    if(
GetPlayerMoney(playerid) < 300)
                    {
                        return 
SendClientMessage(playerid, -1"Vocк nгo tem dinheiro suficiente.");
                    }
                    else
                    {
                        
GivePlayerWeapon(playeridWEAPON_SAWEDOFF300);
                        
GivePlayerMoney(playerid, -300);
                    }
                }
                case 
1
                {
                    if(
GetPlayerMoney(playerid) < 100)
                    {
                        return 
SendClientMessage(playerid, -1"Vocк nгo tem dinheiro suficiente.");
                    }
                    else
                    {
                        
GivePlayerWeapon(playeridWEAPON_SNIPER100);
                        
GivePlayerMoney(playerid, -100);
                    }
                }
                case 
2
                {
                    if(
GetPlayerMoney(playerid) < 350)
                    {
                        return 
SendClientMessage(playerid, -1"Vocк nгo tem dinheiro suficiente.");
                    }
                    else
                    {
                        
GivePlayerWeapon(playeridWEAPON_M4350);
                        
GivePlayerMoney(playerid, -350);
                    }
                }
            }
        }
    }
    return 
1;

Reply
#3

Quote:
Originally Posted by FallweN
Посмотреть сообщение
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == DIALOG_ARMAS)
    {
        if(
response)
        {
            switch(
listitem)
            {
                case 
0
                {
                    if(
GetPlayerMoney(playerid) < 300)
                    {
                        return 
SendClientMessage(playerid, -1"Vocк nгo tem dinheiro suficiente.");
                    }
                    else
                    {
                        
GivePlayerWeapon(playeridWEAPON_SAWEDOFF300);
                        
GivePlayerMoney(playerid, -300);
                    }
                }
                case 
1
                {
                    if(
GetPlayerMoney(playerid) < 100)
                    {
                        return 
SendClientMessage(playerid, -1"Vocк nгo tem dinheiro suficiente.");
                    }
                    else
                    {
                        
GivePlayerWeapon(playeridWEAPON_SNIPER100);
                        
GivePlayerMoney(playerid, -100);
                    }
                }
                case 
2
                {
                    if(
GetPlayerMoney(playerid) < 350)
                    {
                        return 
SendClientMessage(playerid, -1"Vocк nгo tem dinheiro suficiente.");
                    }
                    else
                    {
                        
GivePlayerWeapon(playeridWEAPON_M4350);
                        
GivePlayerMoney(playerid, -350);
                    }
                }
            }
        }
    }
    return 
1;

Vlw
Reply
#4

Aconselho usar um Anti-Money Hack no seu servidor.
Cria uma variбvel para armazenar grana e ficar verificando em X segundos.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)