SA-MP Forums Archive
[DUV] Algo errado nesse codigo? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [DUV] Algo errado nesse codigo? (/showthread.php?tid=164249)



[DUV] Algo errado nesse codigo? - brundavid - 30.07.2010

duv e pq quando coloco ele no ondialog o gm nao compila .-.
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==IDMENU)
{
if(response)
{
if(listitem==0)
{
if(GetPlayerMoney(playerid)<VPISTOL) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,PISTOL,DIALOG_STYLE_INP UT,TextoC1,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==1)
{
if(GetPlayerMoney(playerid)<VDESERT) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,DESERT,DIALOG_STYLE_INP UT,TextoC2,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==2)
{
if(GetPlayerMoney(playerid)<VSHOT) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,SHOT,DIALOG_STYLE_INPUT ,TextoC3,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==3)
{
if(GetPlayerMoney(playerid)<VMP5) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,MP5,DIALOG_STYLE_INPUT, TextoC4,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==4)
{
if(GetPlayerMoney(playerid)<VRIFLE) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,RIFLE,DIALOG_STYLE_INPU T,TextoC5,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==5)
{
if(GetPlayerMoney(playerid)<VAK) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,AK,DIALOG_STYLE_INPUT,T extoC8,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==6)
{
if(GetPlayerMoney(playerid)<VCOLT) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,COLT,DIALOG_STYLE_INPUT ,TextoC9,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==7)
{
if(GetPlayerMoney(playerid)<VSNIPER) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,SNIPER,DIALOG_STYLE_INP UT,TextoC10,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==
{
if(GetPlayerMoney(playerid)<VEXTIN) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,EXTIN,DIALOG_STYLE_INPU T,TextoC11,MSGComprar,Btn1,Btn2);}
return 1;}}
return 1;
}
if(dialogid==SHOT)
{
if(response)
{
new BalasP=strval(inputtext)*PSHOT+VSHOT;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,25,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==MP5)
{
if(response)
{
new BalasP=strval(inputtext)*PMP5+VMP5;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,29,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==PISTOL)
{
if(response)
{
new BalasP=strval(inputtext)*PPISTOL+VPISTOL;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,22,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==DESERT)
{
if(response)
{
new BalasP=strval(inputtext)*PDESERT+VDESERT;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,24,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==RIFLE)
{
if(response)
{
new BalasP=strval(inputtext)*PRIFLE+VRIFLE;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,33,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==AK)
{
if(response)
{
new BalasP=strval(inputtext)*PAK+VAK;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,30,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==COLT)
{
if(response)
{
new BalasP=strval(inputtext)*PCOLT+VCOLT;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,31,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==SNIPER)
{
if(response)
{
new BalasP=strval(inputtext)*PSNIPER+VSNIPER;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,34,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==EXTIN)
{
if(response)
{
new BalasP=strval(inputtext)*PEXTIN+VEXTIN;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,ID_Arma11,strv al(inputtext));SendClientMessage(playerid,amarelo, MSGSucesso);}}
return 1;
}
return 1;
}


Re: [DUV] Algo errado nesse codigo? - Mateus_Henrique - 30.07.2010

Tenta:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==IDMENU)
{
if(response)
{
if(listitem==0)
{
if(GetPlayerMoney(playerid)<VPISTOL) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,PISTOL,DIALOG_STYLE_INP UT,TextoC1,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==1)
{
if(GetPlayerMoney(playerid)<VDESERT) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,DESERT,DIALOG_STYLE_INP UT,TextoC2,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==2)
{
if(GetPlayerMoney(playerid)<VSHOT) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,SHOT,DIALOG_STYLE_INPUT ,TextoC3,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==3)
{
if(GetPlayerMoney(playerid)<VMP5) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,MP5,DIALOG_STYLE_INPUT, TextoC4,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==4)
{
if(GetPlayerMoney(playerid)<VRIFLE) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,RIFLE,DIALOG_STYLE_INPU T,TextoC5,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==5)
{
if(GetPlayerMoney(playerid)<VAK) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,AK,DIALOG_STYLE_INPUT,T extoC8,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==6)
{
if(GetPlayerMoney(playerid)<VCOLT) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,COLT,DIALOG_STYLE_INPUT ,TextoC9,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==7)
{
if(GetPlayerMoney(playerid)<VSNIPER) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,SNIPER,DIALOG_STYLE_INP UT,TextoC10,MSGComprar,Btn1,Btn2);}
return 1;}
if(listitem==
{
if(GetPlayerMoney(playerid)<VEXTIN) return SendClientMessage(playerid,vermelho,SDinheiro);
else {ShowPlayerDialog(playerid,EXTIN,DIALOG_STYLE_INPU T,TextoC11,MSGComprar,Btn1,Btn2);}}
return 1;
}
if(dialogid==SHOT)
{
if(response)
{
new BalasP=strval(inputtext)*PSHOT+VSHOT;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,25,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==MP5)
{
if(response)
{
new BalasP=strval(inputtext)*PMP5+VMP5;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,29,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==PISTOL)
{
if(response)
{
new BalasP=strval(inputtext)*PPISTOL+VPISTOL;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,22,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==DESERT)
{
if(response)
{
new BalasP=strval(inputtext)*PDESERT+VDESERT;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,24,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==RIFLE)
{
if(response)
{
new BalasP=strval(inputtext)*PRIFLE+VRIFLE;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,33,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==AK)
{
if(response)
{
new BalasP=strval(inputtext)*PAK+VAK;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,30,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==COLT)
{
if(response)
{
new BalasP=strval(inputtext)*PCOLT+VCOLT;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,31,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==SNIPER)
{
if(response)
{
new BalasP=strval(inputtext)*PSNIPER+VSNIPER;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,34,strval(inpu ttext));SendClientMessage(playerid,amarelo,MSGSuce sso);}}
return 1;
}
if(dialogid==EXTIN)
{
if(response)
{
new BalasP=strval(inputtext)*PEXTIN+VEXTIN;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,SBDinheiro);
else {GivePlayerMoneyEx(playerid,-(BalasP));GivePlayerWeapon(playerid,ID_Arma11,strv al(inputtext));SendClientMessage(playerid,amarelo, MSGSucesso);}}
return 1;
}
return 0;
}



Re: [DUV] Algo errado nesse codigo? - brundavid - 31.07.2010

n deu tb .-.


Re: [DUV] Algo errado nesse codigo? - [BEP]AcerPilot - 31.07.2010

if(listitem == X) estб errado, o certo seria:

pawn Код:
switch(listitem)
{
     case 0:
     {
          //funзгo
     }
     
     case 1:
     {
         //funзгo
     }//e assim vai
}