PDA

View Full Version : How to compare input text?


(ETR)Geto244
13/06/2012, 07:39 AM
Hello!

Im making new gm and im having problem to compare input text.
I want to make, when player file dosn´t exist, than he must put server password before he can continue registration.
I have made:
#define ServeriParool "prooviparool" // defined server password

public OnPlayerConnect(playerid) // When player connects
{
if (PlayerFile_Load(playerid) == 1) // Is player file exist
{
ShowPlayerDialog(playerid, Dialoog_Sisselogimine, DIALOG_STYLE_PASSWORD, "Tere tulemast tagasi", "Sisesta parool et laadida enda kasutaja", "Logi Sisse", "Loobu"); // Show player login dialog
}
else // else if player file dont exist
ShowPlayerDialog(playerid, Dialoog_RegFoorumistLoetud, DIALOG_STYLE_INPUT, "TERE TULEMAST MEIE SERVERISSE!", "Sisesta serveri parool", "Jätka", "Loobu"); // Show player dialog server password

return 1;
}
// In dialog response
case Dialoog_RegFoorumistLoetud: // dialog server password
{
switch (response)
{
case 1:
{
if(strlen(inputtext) == ServeriParool) // If input text and server password is true
{
ShowPlayerDialog(playerid, Dialoog_RegFoorumistLoetudOk, DIALOG_STYLE_MSGBOX,"PAROOL ÕIGE", "TUBLI! OLED ILUSASTI FOORUMIST KÕIK LÄBI LUGENUD JA NÕUSTUNUD TINGIMUSTEGA. \n\ JÄTKAME NÜÜD REGISTREERIMISEGA", "JÄTKA"}; // When password is ok, show next dialog
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "Et jätkata registreerumist mine loe foorumist reeglite kohta ja saad parooli mida siia sisestama pead");
Kick(playerid); // Else send client message to player that he/she must go to forum and get the server password
}
}
}
}

i got error:
C:\Users\Geto244\Desktop\MyGm\gamemodes\MyGM.pwn(3 30) : error 033: array must be indexed (variable "-unknown-")

I dont understand how i must put it that it compare input text and server password

JhnzRep
13/06/2012, 07:46 AM
if(strcmp(inputtext, ServeriParool))
{
//blah blah
}

(ETR)Geto244
13/06/2012, 07:51 AM
Tnx, it worked :)