[HELP]HouseCode Reading
#1

How to check if HouseCode is same as inputtext please?

Код:
//OnPlayerDialogResponse

case DIALOG_HOUSECODE1:
{
            if(response)
            {
            if(strlen(inputtext) == PlayerInfo[playerid][pHouseCode])
             {
             SendClientMessage(playerid, 0xFFFFFF, "You have entered your house!"
             }
            else
             {
             SendClientMessage(playerid, 0xFFFFFF, "You typed bad HouseCode!"
             }
       }
}
Whats wrong with this one?
Reply
#2

https://sampwiki.blast.hk/wiki/Strcmp
Reply
#3

I tried this:

Код:
if(!strcmp(inputtext, PlayerInfo[playerid][pHouseCode]))
No work
Reply
#4

Do you want the code to be made of numbers only?
Reply
#5

Idk if i get u at all but yes, i want house codes from numbers. I save their codes by INI_WriteString and i need to read if player input exact code as he have saved
Reply
#6

Quote:
Originally Posted by ThomasEvil
Посмотреть сообщение
Idk if i get u at all but yes, i want house codes from numbers. I save their codes by INI_WriteString and i need to read if player input exact code as he have saved
Then you need to use https://sampwiki.blast.hk/wiki/YSI:INI#I....5D.2C_data.29

Then when you have to compare the codes, use https://sampwiki.blast.hk/wiki/Strval for inputtext.

Everything in this line will be the same except you will need to remove strlen and inputtext will be converted from a string into an integer using strval:

pawn Код:
if(strlen(inputtext) == PlayerInfo[playerid][pHouseCode])
And your "house system" is going to be broken, because player information and house information should be two separate things. After some time you should realize this.
Reply
#7

I also tried

Код:
if(!strcmp(inputtext, PlayerInfo[playerid][pHouseCode], false))
So it works when i use the code BUT it works when i type whatever kind of code too..
Reply
#8

Код:
if(strval(inputtext) == PlayerInfo[playerid][pHouseCode])
Same problem ... Work with ANY code :/
Reply
#9

Quote:
Originally Posted by ThomasEvil
Посмотреть сообщение
Код:
if(strval(inputtext) == PlayerInfo[playerid][pHouseCode])
Same problem ... Work with ANY code :/
Go read the forum rules:

http://forum.sa-mp.com/announcement.php?f=12

Quote:

No Double Posting - There is a modify button , use it. However, bumping a topic in which you have or require further information is allowed after at least 24 hours. Note that two identical posts appearing at the same time is usually a mistake attributed to lag, and will not be penalized (but the second one will be removed).

How do you create pHouseCode?
Reply
#10

Ok sorry.

I make it like

Код:
enum pInfo
          {
           pHouseCode,
           //...
           }
How can i read it both types at once? Like if i want read code "9498" or "house9498" pleasE?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)