[HELP]HouseCode Reading -
ThomasEvil - 25.03.2017
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?
Re: [HELP]HouseCode Reading -
Unte99 - 25.03.2017
https://sampwiki.blast.hk/wiki/Strcmp
Re: [HELP]HouseCode Reading -
ThomasEvil - 25.03.2017
I tried this:
Код:
if(!strcmp(inputtext, PlayerInfo[playerid][pHouseCode]))
No work
Re: [HELP]HouseCode Reading -
Unte99 - 25.03.2017
Do you want the code to be made of numbers only?
Re: [HELP]HouseCode Reading -
ThomasEvil - 25.03.2017
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
Re: [HELP]HouseCode Reading -
Unte99 - 25.03.2017
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.
Re: [HELP]HouseCode Reading -
ThomasEvil - 25.03.2017
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..
Re: [HELP]HouseCode Reading -
ThomasEvil - 25.03.2017
Код:
if(strval(inputtext) == PlayerInfo[playerid][pHouseCode])
Same problem ... Work with ANY code :/
Re: [HELP]HouseCode Reading -
Unte99 - 25.03.2017
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?
Re: [HELP]HouseCode Reading -
ThomasEvil - 25.03.2017
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?