SA-MP Forums Archive
How to add more items to my input dialog? - 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: How to add more items to my input dialog? (/showthread.php?tid=178827)



How to add more items to my input dialog? - ZamaXor - 24.09.2010

Hello,

I want to add more items to my input dialog menu. When i try to use if(inputtext[0] == '10') and if(strcmp(inputtext, "10", true, 2)) it's not working. if(strcmp(inputtext, "10", true, 2)) bag the script.

Is there any way to do it with if(inputtext[0] == '10')?

pawn Код:
if(dialogid == 67 && response == 1)
{
    if(inputtext[0] == '1') {
        SetPlayerPos(playerid, 2090.8916,-2545.3416,13.5469);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported LS Airport");
    }
    else if(inputtext[0] == '2') {
        SetPlayerPos(playerid, 1481.1478,1229.8453,10.8203);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported To LV Airport");
        }
    else if(inputtext[0] == '3') {
        SetPlayerPos(playerid, 1481.1478,1229.8453,10.8203);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported To LV Airport");
        }
    else if(inputtext[0] == '4') {
        SetPlayerPos(playerid, 1481.1478,1229.8453,10.8203);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported To LV Airport");
        }
    else if(inputtext[0] == '5') {
        SetPlayerPos(playerid, 1481.1478,1229.8453,10.8203);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported To LV Airport");
        }
    else if(inputtext[0] == '6') {
        SetPlayerPos(playerid, 1481.1478,1229.8453,10.8203);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported To LV Airport");
        }
    else if(inputtext[0] == '7') {
        SetPlayerPos(playerid, 1481.1478,1229.8453,10.8203);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported To LV Airport");
        }
    else if(inputtext[0] == '8') {
        SetPlayerPos(playerid, 1481.1478,1229.8453,10.8203);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported To LV Airport");
        }
     else if(inputtext[0] == '9') {
        SetPlayerPos(playerid, 1481.1478,1229.8453,10.8203);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported To LV Airport");
        }
    else if(inputtext[0] == '10') {
        SetPlayerPos(playerid, 1481.1478,1229.8453,10.8203);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported To LV Airport");
        }
    else if(inputtext[0] == '11') {
        SetPlayerPos(playerid, 1481.1478,1229.8453,10.8203);
        SendClientMessage(playerid,0xAA3333AA,"You Teleported To LV Airport");
        }
        return 1;
    }
return 0;
}



Re: How to add more items to my input dialog? - [XST]O_x - 24.09.2010

pawn Код:
else if(strcmp(inputtext,"10",true) == 0)
strcmp returns a negative value if the strings match.


Re: How to add more items to my input dialog? - ZamaXor - 24.09.2010

It works fine. Thank you Man.


Re: How to add more items to my input dialog? - smeti - 24.09.2010

Or use strval.

pawn Код:
if(strval(inputtext) == 10)
pawn Код:
switch(strval(inputtext))
{
    case 1: { SetPlayerPos(playerid, 2090.8916,-2545.3416,13.5469);
              SendClientMessage(playerid,0xAA3333AA,"You Teleported LS Airport"); }
    case 2: {}
    case 3: {}
    case 4: {}
    case 5: {}
    case 6: {}
    case 7: {}
    case 8: {}
    case 9: {}
    case 10: {}
    case 11: {}
}



Re: How to add more items to my input dialog? - LarzI - 24.09.2010

You could also do
pawn Код:
if(inputtext[0] = '1')
{
    if(inputtext[1] = '0') //10
    { }
    else if(inputtext[1] = '1') //11
    { }
    else if(inputtext[1] = '\0') //EOS (end of string) aka only '1'
    { }
}
But that's the harder way of doing it..