[Pedido] Adptaзгo ao Cod
#1

PHP код:
 if(dialogid == 123) 
    { 
        if(
response) 
        { 
            if(
listitem == 0) 
            { 
                        
ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_INPUT, "Muniзгo Desert", "{436EEE}Muniзгo:", "Equipar", "Cancelar"); 
                        
SetPVarInt(playerid,"arma",24); 
            } 
            if(
listitem == 1) 
            { 
                        
ShowPlayerDialog(playerid,1234, DIALOG_STYLE_INPUT, "Muniзгo Shotgun", "{436EEE}Muniзгo:", "Equipar", "Cancelar"); 
                        
SetPVarInt(playerid,"arma",25); 
            } 
            if(
listitem == 2) 
            { 
                        
ShowPlayerDialog(playerid, 1234, DIALOG_STYLE_INPUT, "Muniзгo MP5", "{436EEE}Muniзгo:", "Equipar", "Cancelar"); 
                        
SetPVarInt(playerid,"arma",29); 
            } 
            if(
listitem == 3) 
            { 
                        
ShowPlayerDialog(playerid,1234, DIALOG_STYLE_INPUT, "Muniзгo M4A1", "{436EEE}Muniзгo:", "Equipar", "Cancelar"); 
                        
SetPVarInt(playerid,"arma",31); 
            } 
            if(
listitem == 4) 
            { 
            
ShowPlayerDialog(playerid,1234, DIALOG_STYLE_INPUT, "Muniзгo Silenced 9mm", "{436EEE}Muniзгo:", "Equipar", "Cancelar"); 
            
SetPVarInt(playerid,"arma",23); 
            } 
            if(
listitem == 5) 
            { 
            
ShowPlayerDialog(playerid,1234, DIALOG_STYLE_INPUT, "Muniзгo Combat Shotgun", "{436EEE}Muniзгo:", "Equipar", "Cancelar"); 
            
SetPVarInt(playerid,"arma",27); 
            } 
            if(
listitem == 6) 
            { 
            
ShowPlayerDialog(playerid,1234, DIALOG_STYLE_INPUT, "Muniзгo Sniper", "{436EEE}Muniзгo:", "Equipar", "Cancelar"); 
            
SetPVarInt(playerid,"arma",34); 
            } 
            if(
listitem == 7) 
            { 
            
ShowPlayerDialog(playerid,1234, DIALOG_STYLE_INPUT, "Muniзгo 9mm", "{436EEE}Muniзгo:", "Equipar", "Cancelar"); 
            
SetPVarInt(playerid,"arma",22); 
            } 
            if(
listitem == 8) 
            { 
            
ShowPlayerDialog(playerid,1234, DIALOG_STYLE_INPUT, "Qunatidades Bomba de Gбs", "{436EEE}Muniзгo:", "Equipar", "Cancelar"); 
            
SetPVarInt(playerid,"arma",17); 
            } 
            if(
listitem == 9) 
            { 
            
ShowPlayerDialog(playerid,1234, DIALOG_STYLE_INPUT, "Colete", "{436EEE}Muniзгo:", "Equipar", "Cancelar"); 
            if(
ColocarColete[playerid] == 0) 
            { 
                new 
id = CountAttachedObjects(playerid); 
                
SetPlayerAttachedObject(playerid, id, 19142, 1, 0.1, 0.05, 0.0); 
                
SetPlayerAttachedObjectEx(19142,Vaga_Colete,playerid,id); 
                
SendClientMessage(playerid, 0x00BFFFAA, "[Informaзгo] Voce colocou seu Colete!"); 
                
ColocarColete[playerid] = 1; 
              
SetPlayerArmour(playerid, 50); 
            } 
            else if(
ColocarColete[playerid] == 1) 
            { 
            
RemovePlayerAttachedObjectEx(playerid,Vaga_Colete); 
            
SendClientMessage(playerid, 0x00BFFFAA, "[Informaзгo] Voce retirou seu Colete!"); 
            
ColocarColete[playerid] = 0; 
            
SetPlayerArmour(playerid, 0); 
            
SetPVarInt(playerid,"arma",0); 
            } 
        } 
        } 
        return 
1; 
    } 
    if(
dialogid == 1234) 
    { 
        if(
response) 
        { 
        if(!
strval(inputtext)|| strval(inputtext) < 1 ) return ShowPlayerDialog(playerid,1234, DIALOG_STYLE_INPUT, "ERRO", "{ff0000}ERRO:{ffffff}Valor invalido\nDigite uma muniзгo de 1 - 1000:", "Equipar", "Cancelar"); 
        if(
strval(inputtext) > 1000 ) return ShowPlayerDialog(playerid,1234, DIALOG_STYLE_INPUT, "ERRO", "{FF0000}ERRO:{ffffff}Valor invalido\nDigite uma muniзгo de 1 - 1000:", "Equipar", "Cancelar"); 
        new 
str[200]; 
        
GivePlayerWeapon(playerid,GetPVarInt(playerid,"arma"),strval(inputtext)); 
        if(
GetPVarInt(playerid,"arma") == 24) format(str,200,"Vocк se equipou com uma Deserte Eagle, com %d balas.",strval(inputtext)); 
        if(
GetPVarInt(playerid,"arma") == 25) format(str,200,"Vocк se equipou com uma Shotgun, com %d balas.",strval(inputtext)); 
        if(
GetPVarInt(playerid,"arma") == 29) format(str,200,"Vocк se equipou com uma MP5, com %d balas.",strval(inputtext)); 
        if(
GetPVarInt(playerid,"arma") == 31) format(str,200,"Vocк se equipou com uma M4A1, com %d balas.",strval(inputtext)); 
        if(
GetPVarInt(playerid,"arma") == 23) format(str,200,"Vocк se equipou com uma Silenced 9mm, com %d balas.",strval(inputtext)); 
        if(
GetPVarInt(playerid,"arma") == 27) format(str,200,"Vocк se equipou com uma Combat Shotgun, com %d balas.",strval(inputtext)); 
        if(
GetPVarInt(playerid,"arma") == 34) format(str,200,"Vocк se equipou com uma Sniper, com %d balas.",strval(inputtext)); 
        if(
GetPVarInt(playerid,"arma") == 22) format(str,200,"Vocк se equipou com uma 9mm, com %d balas.",strval(inputtext)); 
        if(
GetPVarInt(playerid,"arma") == 17) format(str,200,"Vocк se equipou com uma Bomba de Gбs, com %d balas.",strval(inputtext)); 
        if(
GetPVarInt(playerid,"arma") == 0) format(str,200,"Vocк se equipou com uma Colete, com %d balas.",strval(inputtext)); 
        
SendClientMessage(playerid,-1,str); 
        } 
        else 
ShowPlayerDialog(playerid, 123, DIALOG_STYLE_LIST, "Equipamentos Militar", "Deserte Eagle\nShotgun\nMP5\nM4A1\nSilenced 9mm\nCombat Shotgun\nSniper\n9mm\nBomba de Gбs\nColete\nC.O.E", "Escolher", "Cancelar"); 
        return 
1; 
    } 


Entгo como eu disse Adptaзгo ao Codigo

Eu queria que alguйm em ajudasse pelo menos fazer a primeira linha pra eu ver como se faz , entгo vamos ao assunto eu queria que cada arma tivesse um limite de balas o meu amigo me disse pra fazer isso aqui
PHP код:
new municao = strval(inputtext); // converte string para int 
if(municao > 120) 
{ 
    
// digitou + que 120, faзa algo 
    
municao = 120; // Nгo deixar passar de 120? 
} 
PHP код:
// seta valor para 120 se o valor digitado for > que 120 
new municao = strval(inputtext) > 120 ? 120 : strval(inputtext); 
Reply
#2

nгo sei por que esta a utilizar PVar..
pawn Код:
switch(dialogid)
{
    case lala:
    {
        if(response)
        {
            switch(GetPVarInt(playerid, "arma"))
            {
                case 24:
                {
                    if(!strval(inputtext) || strval(inputtext) > 24)
                    {
                        SendClientMessage(playerid, -1, "essa arma apenas suporta 24 balas."),
                        ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "LALA", "LALA", "LALA", "LALA");
                    }
                }
            }
        }
    }
}
Reply
#3

Quote:
Originally Posted by Whoo
Посмотреть сообщение
nгo sei por que esta a utilizar PVar..
pawn Код:
switch(dialogid)
{
    case lala:
    {
        if(response)
        {
            switch(GetPVarInt(playerid, "arma"))
            {
                case 24:
                {
                    if(!strval(inputtext) || strval(inputtext) > 24)
                    {
                        SendClientMessage(playerid, -1, "essa arma apenas suporta 24 balas."),
                        ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "LALA", "LALA", "LALA", "LALA");
                    }
                }
            }
        }
    }
}
Poderia me explicar? um pouco melhor sobre o que vocк fez por favor?... e a onde eu posso colocar isso ?
Reply
#4

vocк coloca na dialog de comprar muniзгo faz uma verificaзгo para saber qual id de arma esta querendo comprar bala e coloca um limite de bala pra esse id, fiz um exemplo com o id 24 no caso desert eagle.
Код:
if(dialogid == 1234)
{
	if(response)
	{
		switch(GetPVarInt(playerid, "arma"))
		{
			case 24:
			{
				if(!strval(inputtext) || strval(inputtext) > 24)
				{
					SendClientMessage(playerid, -1, "essa arma apenas suporta 24 balas."),
					ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "LALA", "LALA", "LALA", "LALA");
				}
			}
			case 25:
			{
				if(!strval(inputtext) || strval(inputtext) > 50) // balas pra essa arma atй 50..
				{

				}
			}
			case 29:
			{
				...
			}
			case 31:
			{
				...
			}
			case 23:
			{
				...
			}
			case 27:
			{
				...
			}
			case 34:
			{
				...
			}
			case 22:
			{
				...
			}
			case 17:
			{
				...
			}
			case 0:
			{
				...
			}
			default: ShowPlayerDialog(playerid, 123, DIALOG_STYLE_LIST, "Equipamentos Militar", "Deserte Eagle\nShotgun\nMP5\nM4A1\nSilenced 9mm\nCombat Shotgun\nSniper\n9mm\nBomba de Gбs\nColete\nC.O.E", "Escolher", "Cancelar");

		}
	}
}
Reply
#5

Quote:
Originally Posted by Whoo
Посмотреть сообщение
vocк coloca na dialog de comprar muniзгo faz uma verificaзгo para saber qual id de arma esta querendo comprar bala e coloca um limite de bala pra esse id, fiz um exemplo com o id 24 no caso desert eagle.
Код:
if(dialogid == 1234)
{
	if(response)
	{
		switch(GetPVarInt(playerid, "arma"))
		{
			case 24:
			{
				if(!strval(inputtext) || strval(inputtext) > 24)
				{
					SendClientMessage(playerid, -1, "essa arma apenas suporta 24 balas."),
					ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "LALA", "LALA", "LALA", "LALA");
				}
			}
			case 25:
			{
				if(!strval(inputtext) || strval(inputtext) > 50) // balas pra essa arma atй 50..
				{

				}
			}
			case 29:
			{
				...
			}
			case 31:
			{
				...
			}
			case 23:
			{
				...
			}
			case 27:
			{
				...
			}
			case 34:
			{
				...
			}
			case 22:
			{
				...
			}
			case 17:
			{
				...
			}
			case 0:
			{
				...
			}
			default: ShowPlayerDialog(playerid, 123, DIALOG_STYLE_LIST, "Equipamentos Militar", "Deserte Eagle\nShotgun\nMP5\nM4A1\nSilenced 9mm\nCombat Shotgun\nSniper\n9mm\nBomba de Gбs\nColete\nC.O.E", "Escolher", "Cancelar");

		}
	}
}
Obrigado vocк tem skype para um melhor contato? estou criando meu servidor se puder ajudar posso te dar uma grana...
Reply
#6

Quote:
Originally Posted by Whoo
Посмотреть сообщение
vocк coloca na dialog de comprar muniзгo faz uma verificaзгo para saber qual id de arma esta querendo comprar bala e coloca um limite de bala pra esse id, fiz um exemplo com o id 24 no caso desert eagle.
Код:
if(dialogid == 1234)
{
	if(response)
	{
		switch(GetPVarInt(playerid, "arma"))
		{
			case 24:
			{
				if(!strval(inputtext) || strval(inputtext) > 24)
				{
					SendClientMessage(playerid, -1, "essa arma apenas suporta 24 balas."),
					ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "LALA", "LALA", "LALA", "LALA");
				}
			}
			case 25:
			{
				if(!strval(inputtext) || strval(inputtext) > 50) // balas pra essa arma atй 50..
				{

				}
			}
			case 29:
			{
				...
			}
			case 31:
			{
				...
			}
			case 23:
			{
				...
			}
			case 27:
			{
				...
			}
			case 34:
			{
				...
			}
			case 22:
			{
				...
			}
			case 17:
			{
				...
			}
			case 0:
			{
				...
			}
			default: ShowPlayerDialog(playerid, 123, DIALOG_STYLE_LIST, "Equipamentos Militar", "Deserte Eagle\nShotgun\nMP5\nM4A1\nSilenced 9mm\nCombat Shotgun\nSniper\n9mm\nBomba de Gбs\nColete\nC.O.E", "Escolher", "Cancelar");

		}
	}
}
Estб dando erro de chave 26 erros... se puder me ajudar
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)