24.03.2015, 13:32
Hey there,
I'm trying to improve my knowledge and I was wondering how to do something.
I'm trying to create a system where you can "speak" to it and it does things for you, for example I tried making a door open and close using this.
But even if I write "door" in game it says "You have entered an invalid door code."
Whats wrong ?
I'm trying to improve my knowledge and I was wondering how to do something.
I'm trying to create a system where you can "speak" to it and it does things for you, for example I tried making a door open and close using this.
But even if I write "door" in game it says "You have entered an invalid door code."
Whats wrong ?
pawn Код:
if(dialogid ==DIALOG_DOOR)
{
if(!response)return 1;
if(response)
{
if(!strval(inputtext))
{
SendClientMessage(playerid, GREY, "You have entered an invalid door code.");
}
else
{
if(strcmp(inputtext, "door", true))
{
new value[10];
new File:lFile = fopen("Server/code1.txt", io_append);
if(lFile)
{
while(fread(lFile, value))
fclose(lFile);
}
if(strcmp(value, "1", true))
{
SendClientMessage(playerid, WHITE, "Value was 1, changing to 0.");
fremove("code1.txt");
new File:nFile = fopen("Server/code1.txt", io_append);
fwrite(nFile, "0");
fclose(nFile);
}
SendClientMessage(playerid, WHITE, "You are correct!");
}
else
{
SendClientMessage(playerid, GREY, "You have entered an invalid door code.");
}
}
}
}