How to add more items to my input dialog?
#1

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;
}
Reply
#2

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

It works fine. Thank you Man.
Reply
#4

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: {}
}
Reply
#5

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..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)