SA-MP Forums Archive
OnDialogResponse (Dialog_Style_Input) need help! T_T - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnDialogResponse (Dialog_Style_Input) need help! T_T (/showthread.php?tid=264121)



OnDialogResponse (Dialog_Style_Input) need help! T_T - leingod - 24.06.2011

well... on dialog response 1 - 9 its okay
when the 10 - 14 its going error

the erorrs
Код:
D:\GTA SERVER\GTA Server\filterscripts\asdasd.pwn(5366) : error 027: invalid character constant
D:\GTA SERVER\GTA Server\filterscripts\asdasd.pwn(5366) : error 027: invalid character constant
D:\GTA SERVER\GTA Server\filterscripts\asdasd.pwn(5366 -- 5367) : error 029: invalid expression, assumed zero
D:\GTA SERVER\GTA Server\filterscripts\asdasd.pwn(5366 -- 5367) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

4 Errors.
the code... on (5366 -- 5416)
Код:
        else if(inputtext[0] == '10')
        {
        	if(GetPlayerMoney(playerid) < 9000) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
         	else
          	{
           		GivePlayerMoney(playerid, -9000);
             	GivePlayerWeapon(playerid, 33, 800);
              	SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        else if(inputtext[0] == '11')
        {
        	if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
         	else
          	{
           		GivePlayerMoney(playerid, -10000);
             	GivePlayerWeapon(playerid, 34, 800);
              	SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        else if(inputtext[0] == '12')
        {
        	if(GetPlayerMoney(playerid) < 6500) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
         	else
          	{
           		GivePlayerMoney(playerid, -6500);
             	GivePlayerWeapon(playerid, 30, 1000);
              	SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        else if(inputtext[0] == '13')
        {
        	if(GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
         	else
          	{
           		GivePlayerMoney(playerid, -7000);
             	GivePlayerWeapon(playerid, 31, 1000);
              	SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        else if(inputtext[0] == '14')
        {
        	if(GetPlayerMoney(playerid) < 300) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
         	else
          	{
           		GivePlayerMoney(playerid, -300);
             	SetPlayerHealth(playerid, 100);
             	SetPlayerArmour(playerid, 100);
              	SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
what the hell happen??
are Dialog_Style_Input cannot response 2 numbers or more ??
help pls


Re: OnDialogResponse (Dialog_Style_Input) need help! T_T - =WoR=Varth - 24.06.2011

What about this?
pawn Код:
else if(inputtext == "10")



Re: OnDialogResponse (Dialog_Style_Input) need help! T_T - leingod - 24.06.2011

@varthshenon
Doesn't work -_-"


Re: OnDialogResponse (Dialog_Style_Input) need help! T_T - =WoR=Varth - 24.06.2011

pawn Код:
else if(strval(inputtext) == 10)



Re: OnDialogResponse (Dialog_Style_Input) need help! T_T - leingod - 24.06.2011

thats can compiled but.. get some bugs... -_-
when i buy id 10 i get weapon id 1 :3


Re: OnDialogResponse (Dialog_Style_Input) need help! T_T - rjjj - 24.06.2011

I think it will solve your problem .


Just one symbol can be put inside the ' '.


Example:


pawn Код:
'A' //It will work
'1'//It will work
'10'//It won't work
'AB'//It won't work

So, just separate the numbers (like 10) in parts :


pawn Код:
else if(inputtext[0] == '1' && inputtext[1] == '0')
        {
            if(GetPlayerMoney(playerid) < 9000) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
            else
            {
                GivePlayerMoney(playerid, -9000);
                GivePlayerWeapon(playerid, 33, 800);
                SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        else if(inputtext[0] == '1' && inputtext[1] == '1')
        {
            if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
            else
            {
                GivePlayerMoney(playerid, -10000);
                GivePlayerWeapon(playerid, 34, 800);
                SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        else if(inputtext[0] == '1' && inputtext[1] == '2')
        {
            if(GetPlayerMoney(playerid) < 6500) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
            else
            {
                GivePlayerMoney(playerid, -6500);
                GivePlayerWeapon(playerid, 30, 1000);
                SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        else if(inputtext[0] == '1' && inputtext[1] == '3')
        {
            if(GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
            else
            {
                GivePlayerMoney(playerid, -7000);
                GivePlayerWeapon(playerid, 31, 1000);
                SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        else if(inputtext[0] == '1' && inputtext[1] == '4')
        {
            if(GetPlayerMoney(playerid) < 300) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
            else
            {
                GivePlayerMoney(playerid, -300);
                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 100);
                SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }


I hope that i have helped .


Re: OnDialogResponse (Dialog_Style_Input) need help! T_T - =WoR=Varth - 24.06.2011

Did you convert all of your inputtext to integer? (strval)
Btw it's easier if you make dialog list for that.


Re: OnDialogResponse (Dialog_Style_Input) need help! T_T - Lorenc_ - 24.06.2011

You could use strcmp..

if(!strcmp(inputtext, "10"))

Try convert everything to this.


Re: OnDialogResponse (Dialog_Style_Input) need help! T_T - leingod - 04.07.2011

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
You could use strcmp..

if(!strcmp(inputtext, "10"))

Try convert everything to this.
still error


Re: OnDialogResponse (Dialog_Style_Input) need help! T_T - leong124 - 04.07.2011

pawn Код:
switch(strval(inputtext))
{
        //Some more here, for example: case 9:
        case 10:
        {
            if(GetPlayerMoney(playerid) < 9000) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
            else
            {
                GivePlayerMoney(playerid, -9000);
                GivePlayerWeapon(playerid, 33, 800);
                SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        case 11:
        {
            if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
            else
            {
                GivePlayerMoney(playerid, -10000);
                GivePlayerWeapon(playerid, 34, 800);
                SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        case 12:
        {
            if(GetPlayerMoney(playerid) < 6500) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
            else
            {
                GivePlayerMoney(playerid, -6500);
                GivePlayerWeapon(playerid, 30, 1000);
                SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        case 13:
        {
            if(GetPlayerMoney(playerid) < 7000) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
            else
            {
                GivePlayerMoney(playerid, -7000);
                GivePlayerWeapon(playerid, 31, 1000);
                SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
        case 14:
        {
            if(GetPlayerMoney(playerid) < 300) return SendClientMessage(playerid, 0xFFFFFFFF, NEC);
            else
            {
                GivePlayerMoney(playerid, -300);
                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 100);
                SendClientMessage(playerid, 0xFFFFFFFF, "Buying weapon success.");
            }
        }
}
Actually #5 and #7 are correct. You get wrong weapon is because the parameters in your GivePlayerWeapon are wrong.