dialoginput style question -
BlackWolf120 - 01.05.2011
hi,
damn maybe im just too tired now xD but i cant fugure this out.
I want that itgives me the first weapon that is listed on the list if i enter 1 into the dialog.
The 2nd weapon if i enter 2 and so on.
But it just does not work. Nothing happens.
pawn Код:
new Weaponsdialog = 1;
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
new Weaponsdialogue[710] = "{CD5555}Katana - {CDAF95}15800$\n{CD5555}Chainsaw - {CDAF95}2500$\n...
foreach (Player, i)
{
if(IsPlayerInRangeOfPoint(i,2,311.2411,-165.3235,999.6010))
{
ShowPlayerDialog(i, Weaponsdialog, DIALOG_STYLE_INPUT, "{CD5555}Weapon {CDAF95}Price",Weaponsdialogue,"Buy", "Cancel");
}
}
return 1;
}
//OnDialogResponse
if(dialogid == Weaponsdialog)
{
if(response)
{
if(strcmp("1", inputtext, true))
{
GivePlayerWeapon(playerid,8,0);
}
else if(strcmp("2", inputtext, true))
{
GivePlayerWeapon(playerid,9,0);
}
// and so on...
regards.
Re: dialoginput style question -
Joe Staff - 01.05.2011
You could just use a list dialog instead of a input dialog... Also you're supposed to check if strcmp(...)==0
Re: dialoginput style question -
BlackWolf120 - 01.05.2011
thx for ur answer but if i do it like this it also does not work:
pawn Код:
if(strcmp("1", inputtext, true))==0
And i know about the list dialog cause im using it right now but thats why im asking

I wanna change my list doalog to input.
regards.
Re: dialoginput style question -
BlackWolf120 - 02.05.2011
pls can anyone take a quick look at his code
Re: dialoginput style question -
BlackWolf120 - 03.05.2011
cmon guys...
realy no one of all this smart samp'ers wanna help me?
Re: dialoginput style question -
admantis - 03.05.2011
Strcmp is used to compare strings and '1' is a integer so you could easily do..
AW: dialoginput style question -
BlackWolf120 - 04.05.2011
could u pls explain?
i cant find anything about MyVar...
is there another way to do this?
Re: dialoginput style question -
Jeffry - 05.05.2011
Try:
pawn Код:
[if(dialogid == Weaponsdialog)
{
if(response)
{
if(!strcmp("1", inputtext)) GivePlayerWeapon(playerid,8,0);
else if(!strcmp("2", inputtext)) GivePlayerWeapon(playerid,9,0);
}
}
Re: dialoginput style question -
Vince - 05.05.2011
Get rid of the ugly strcmp:
pawn Код:
switch(strval(inputtext))
{
case 1: GivePlayerWeapon(playerid, 8, 1);
case 2: GivePlayerWeapon(playerid, 9, 1);
default: SendClientMessage(playerid, COLOR_RED, "Invalid Input");
}
Though it has already been suggested that you should use a list for this kind of stuff. Much easier.
Re: dialoginput style question -
BlackWolf120 - 06.05.2011
k thx alot imma try it out
regards, wolf.